diff --git a/Cargo.lock b/Cargo.lock index c39458fe57..87cdedda28 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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]] diff --git a/Cargo.toml b/Cargo.toml index 830310960d..703e3bea74 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 diff --git a/cros_async/Cargo.toml b/cros_async/Cargo.toml index 848e461bb9..fcaf95bc7e 100644 --- a/cros_async/Cargo.toml +++ b/cros_async/Cargo.toml @@ -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] diff --git a/devices/Cargo.toml b/devices/Cargo.toml index b1e78274f5..0a55dc99b5 100644 --- a/devices/Cargo.toml +++ b/devices/Cargo.toml @@ -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" } diff --git a/io_uring/Cargo.toml b/io_uring/Cargo.toml index b018e7a4c1..3b7cc7c366 100644 --- a/io_uring/Cargo.toml +++ b/io_uring/Cargo.toml @@ -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 diff --git a/io_uring/src/syscalls.rs b/io_uring/src/syscalls.rs index e3c9f8630b..f3a3b41a05 100644 --- a/io_uring/src/syscalls.rs +++ b/io_uring/src/syscalls.rs @@ -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 = std::result::Result; pub unsafe fn io_uring_setup(num_entries: usize, params: &io_uring_params) -> Result { - 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, diff --git a/run_tests b/run_tests index aa705b5abb..95c92b8d0f 100755 --- a/run_tests +++ b/run_tests @@ -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": [], diff --git a/sys_util/Cargo.toml b/sys_util/Cargo.toml index 158e56df1f..7edffd9f58 100644 --- a/sys_util/Cargo.toml +++ b/sys_util/Cargo.toml @@ -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] diff --git a/sys_util/src/fork.rs b/sys_util/src/fork.rs index a1e9b132d1..7f4a256402 100644 --- a/sys_util/src/fork.rs +++ b/sys_util/src/fork.rs @@ -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; diff --git a/sys_util/src/lib.rs b/sys_util/src/lib.rs index d1bcf164b0..43bdcc4d19 100644 --- a/sys_util/src/lib.rs +++ b/sys_util/src/lib.rs @@ -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; diff --git a/sys_util/src/shm.rs b/sys_util/src/shm.rs index 0fdbf9f952..927734aef0 100644 --- a/sys_util/src/shm.rs +++ b/sys_util/src/shm.rs @@ -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}; diff --git a/vm_memory/Cargo.toml b/vm_memory/Cargo.toml index a1f569d1bf..631ad9b841 100644 --- a/vm_memory/Cargo.toml +++ b/vm_memory/Cargo.toml @@ -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]