remove dependencies on syscall_defines

The syscall_defines crate is redundant with an up to date libc. This
change removes any dependency on syscall_defines. A new libc is required
to bring in some new syscall numbers like the ones for io_uring.

TEST=./test_all
BUG=None

Cq-Depend: chromium:2832000
Change-Id: I6df7fb992bacb5efd54cefca08836d52f4bfcd8c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2832001
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Allen Webb <allenwebb@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Zach Reizner <zachr@chromium.org>
This commit is contained in:
Zach Reizner 2021-04-16 18:12:24 -07:00 committed by Commit Bot
parent a9759cb072
commit 6d6efb20c0
12 changed files with 12 additions and 35 deletions

13
Cargo.lock generated
View file

@ -184,7 +184,6 @@ dependencies = [
"slab",
"sync",
"sys_util",
"syscall_defines",
"thiserror",
]
@ -321,7 +320,6 @@ dependencies = [
"smallvec",
"sync",
"sys_util",
"syscall_defines",
"tempfile",
"thiserror",
"tpm2",
@ -527,7 +525,6 @@ dependencies = [
"libc",
"sync",
"sys_util",
"syscall_defines",
]
[[package]]
@ -576,9 +573,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.81"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb"
checksum = "9385f66bf6105b241aa65a61cb923ef20efc665cb9f9bb50ac2f0c4b7f378d41"
[[package]]
name = "libchromeos"
@ -1077,14 +1074,9 @@ dependencies = [
"serde",
"serde_json",
"sync",
"syscall_defines",
"tempfile",
]
[[package]]
name = "syscall_defines"
version = "0.1.0"
[[package]]
name = "tempfile"
version = "3.0.7"
@ -1209,7 +1201,6 @@ dependencies = [
"cros_async",
"data_model",
"libc",
"syscall_defines",
]
[[package]]

View file

@ -36,7 +36,6 @@ exclude = [
"rand_ish",
"sync",
"sys_util",
"syscall_defines",
"tempfile",
"vm_memory",
]
@ -79,7 +78,7 @@ kernel_cmdline = { path = "kernel_cmdline" }
kernel_loader = { path = "kernel_loader" }
kvm = { path = "kvm", optional = true }
kvm_sys = { path = "kvm_sys", optional = true }
libc = "0.2.65"
libc = "0.2.93"
libcras = "*"
minijail = "*" # provided by ebuild
net_util = { path = "net_util" }
@ -118,7 +117,6 @@ libvda = { path = "../../platform2/arc/vm/libvda/rust" } # ignored by ebuild
minijail = { path = "../../aosp/external/minijail/rust/minijail" } # ignored by ebuild
p9 = { path = "../../platform2/vm_tools/p9" } # ignored by ebuild
sync = { path = "sync" }
syscall_defines = { path = "syscall_defines" }
sys_util = { path = "sys_util" }
tempfile = { path = "tempfile" }
vmm_vhost = { path = "../../third_party/rust-vmm/vhost", features = ["vhost-user-master"] } # ignored by ebuild

View file

@ -16,7 +16,6 @@ slab = "0.4"
sync = { path = "../sync" } # provided by ebuild
sys_util = { path = "../sys_util" } # provided by ebuild
data_model = { path = "../data_model" } # provided by ebuild
syscall_defines = { path = "../syscall_defines" } # provided by ebuild
thiserror = "1.0.20"
[dependencies.futures]

View file

@ -47,7 +47,6 @@ serde = { version = "1", features = [ "derive" ] }
smallvec = "1.6.1"
sync = { path = "../sync" }
sys_util = { path = "../sys_util" }
syscall_defines = { path = "../syscall_defines" }
thiserror = "1.0.20"
tpm2 = { path = "../tpm2", optional = true }
usb_util = { path = "../usb_util" }

View file

@ -7,7 +7,6 @@ edition = "2018"
[dependencies]
data_model = { path = "../data_model" } # provided by ebuild
libc = "*"
syscall_defines = { path = "../syscall_defines" } # provided by ebuild
sync = { path = "../sync" } # provided by ebuild
sys_util = { path = "../sys_util" } # provided by ebuild

View file

@ -6,8 +6,7 @@ use std::io::Error;
use std::os::unix::io::RawFd;
use std::ptr::null_mut;
use libc::{c_int, c_long, c_void};
use syscall_defines::linux::LinuxSyscall::*;
use libc::{c_int, c_long, c_void, syscall, SYS_io_uring_enter, SYS_io_uring_setup};
use crate::bindings::*;
@ -15,7 +14,7 @@ use crate::bindings::*;
pub type Result<T> = std::result::Result<T, c_int>;
pub unsafe fn io_uring_setup(num_entries: usize, params: &io_uring_params) -> Result<RawFd> {
let ret = libc::syscall(
let ret = syscall(
SYS_io_uring_setup as c_long,
num_entries as c_int,
params as *const _,
@ -27,7 +26,7 @@ pub unsafe fn io_uring_setup(num_entries: usize, params: &io_uring_params) -> Re
}
pub unsafe fn io_uring_enter(fd: RawFd, to_submit: u64, to_wait: u64, flags: u32) -> Result<()> {
let ret = libc::syscall(
let ret = syscall(
SYS_io_uring_enter as c_long,
fd,
to_submit as c_int,

View file

@ -58,7 +58,6 @@ CRATE_REQUIREMENTS: Dict[str, List[Requirements]] = {
"sync": [],
"sys_util": [Requirements.SINGLE_THREADED, Requirements.PRIVILEGED],
"poll_token_derive": [],
"syscall_defines": [],
"tempfile": [],
"tpm2-sys": [],
"tpm2": [],

View file

@ -12,7 +12,6 @@ poll_token_derive = { version = "*", path = "poll_token_derive" }
serde = { version = "1", features = [ "derive" ] }
serde_json = "1"
sync = { path = "../sync" } # provided by ebuild
syscall_defines = { path = "../syscall_defines" } # provided by ebuild
tempfile = { path = "../tempfile" } # provided by ebuild
[target.'cfg(target_os = "android")'.dependencies]

View file

@ -8,8 +8,7 @@ use std::path::Path;
use std::process;
use std::result;
use libc::{c_long, pid_t, syscall, CLONE_NEWPID, CLONE_NEWUSER, SIGCHLD};
use syscall_defines::linux::LinuxSyscall::SYS_clone;
use libc::{c_long, pid_t, syscall, SYS_clone, CLONE_NEWPID, CLONE_NEWUSER, SIGCHLD};
use crate::errno_result;

View file

@ -101,13 +101,10 @@ use std::ptr;
use std::time::Duration;
use libc::{
c_int, c_long, fcntl, pipe2, syscall, sysconf, waitpid, F_GETFL, F_SETFL, O_CLOEXEC, SIGKILL,
WNOHANG, _SC_IOV_MAX, _SC_PAGESIZE,
c_int, c_long, fcntl, pipe2, syscall, sysconf, waitpid, SYS_getpid, SYS_gettid, F_GETFL,
F_SETFL, O_CLOEXEC, SIGKILL, WNOHANG, _SC_IOV_MAX, _SC_PAGESIZE,
};
use syscall_defines::linux::LinuxSyscall::SYS_getpid;
use syscall_defines::linux::LinuxSyscall::SYS_gettid;
/// Re-export libc types that are part of the API.
pub type Pid = libc::pid_t;
pub type Uid = libc::uid_t;

View file

@ -8,12 +8,11 @@ use std::io::{self, Read, Seek, SeekFrom, Write};
use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
use libc::{
self, c_char, c_int, c_long, c_uint, close, fcntl, ftruncate64, off64_t, syscall, EINVAL,
F_ADD_SEALS, F_GET_SEALS, F_SEAL_GROW, F_SEAL_SEAL, F_SEAL_SHRINK, F_SEAL_WRITE,
MFD_ALLOW_SEALING,
self, c_char, c_int, c_long, c_uint, close, fcntl, ftruncate64, off64_t, syscall,
SYS_memfd_create, EINVAL, F_ADD_SEALS, F_GET_SEALS, F_SEAL_GROW, F_SEAL_SEAL, F_SEAL_SHRINK,
F_SEAL_WRITE, MFD_ALLOW_SEALING,
};
use serde::{Deserialize, Serialize};
use syscall_defines::linux::LinuxSyscall::SYS_memfd_create;
use crate::{errno, errno_result, Result};

View file

@ -10,7 +10,6 @@ cros_async = { path = "../cros_async" } # provided by ebuild
data_model = { path = "../data_model" } # provided by ebuild
libc = "*"
base = { path = "../base" } # provided by ebuild
syscall_defines = { path = "../syscall_defines" } # provided by ebuild
bitflags = "1"
[workspace]