| /third_party/rust/rust/library/std/src/sys/unix/ |
| D | mod.rs | 3 use crate::ffi::CStr; 4 use crate::io::ErrorKind; 6 pub use self::rand::hashmap_random_keys; 31 pub use self::l4re::net; 74 // because some unix-like operating systems such as Linux share process-id and in init() 75 // thread-id for the main thread and so renaming the main thread will rename the in init() 99 use crate::sys::os::errno; in init() 101 use libc::open as open64; in init() 103 use libc::open64; in init() 105 libc::pollfd { fd: 0, events: 0, revents: 0 }, in init() [all …]
|
| D | net.rs | 1 use crate::cmp; 2 use crate::ffi::CStr; 3 use crate::io::{self, BorrowedBuf, BorrowedCursor, IoSlice, IoSliceMut}; 4 use crate::mem; 5 use crate::net::{Shutdown, SocketAddr}; 6 use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd}; 7 use crate::str; 8 use crate::sys::fd::FileDesc; 9 use crate::sys_common::net::{getsockopt, setsockopt, sockaddr_to_addr}; 10 use crate::sys_common::{AsInner, FromInner, IntoInner}; [all …]
|
| D | futex.rs | 11 use crate::sync::atomic::AtomicU32; 12 use crate::time::Duration; 20 pub fn futex_wait(futex: &AtomicU32, expected: u32, timeout: Option<Duration>) -> bool { in futex_wait() 21 use super::time::Timespec; in futex_wait() 22 use crate::ptr::null; in futex_wait() 23 use crate::sync::atomic::Ordering::Relaxed; in futex_wait() 29 .and_then(|d| Timespec::now(libc::CLOCK_MONOTONIC).checked_add_duration(&d)) in futex_wait() 45 let umtx_timeout = timespec.map(|t| libc::_umtx_time { in futex_wait() 47 _flags: libc::UMTX_ABSTIME, in futex_wait() 48 _clockid: libc::CLOCK_MONOTONIC as u32, in futex_wait() [all …]
|
| D | thread.rs | 1 use crate::cmp; 2 use crate::ffi::CStr; 3 use crate::io; 4 use crate::mem; 5 use crate::num::NonZeroUsize; 6 use crate::ptr; 7 use crate::sys::{os, stack_overflow}; 8 use crate::time::Duration; 11 use crate::sys::weak::dlsym; 13 use crate::sys::weak::weak; [all …]
|
| D | fd.rs | 6 use crate::cmp; 7 use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut, Read}; 8 use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd}; 9 use crate::sys::cvt; 10 use crate::sys_common::{AsInner, FromInner, IntoInner}; 18 use libc::off64_t; 25 use libc::off_t as off64_t; 30 // The maximum read limit on most POSIX-like systems is `SSIZE_MAX`, 34 // On macOS, however, apparently the 64-bit libc is either buggy or 39 const READ_LIMIT: usize = libc::c_int::MAX as usize - 1; [all …]
|
| D | fs.rs | 4 use crate::os::unix::prelude::*; 6 use crate::ffi::{CStr, OsStr, OsString}; 7 use crate::fmt; 8 use crate::io::{self, BorrowedCursor, Error, IoSlice, IoSliceMut, SeekFrom}; 9 use crate::mem; 20 use crate::mem::MaybeUninit; 21 use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd}; 22 use crate::path::{Path, PathBuf}; 23 use crate::ptr; 24 use crate::sync::Arc; [all …]
|
| D | rand.rs | 1 pub fn hashmap_random_keys() -> (u64, u64) { in hashmap_random_keys() 29 use crate::fs::File; 30 use crate::io::Read; 33 use crate::sys::weak::syscall; 36 fn getrandom(buf: &mut [u8]) -> libc::ssize_t { in getrandom() 37 use crate::sync::atomic::{AtomicBool, Ordering}; in getrandom() 38 use crate::sys::os::errno; in getrandom() 45 buffer: *mut libc::c_void, in getrandom() 46 length: libc::size_t, in getrandom() 47 flags: libc::c_uint in getrandom() [all …]
|
| D | os.rs | 8 use crate::os::unix::prelude::*; 10 use crate::error::Error as StdError; 11 use crate::ffi::{CStr, CString, OsStr, OsString}; 12 use crate::fmt; 13 use crate::io; 14 use crate::iter; 15 use crate::mem; 16 use crate::path::{self, PathBuf}; 17 use crate::ptr; 18 use crate::slice; [all …]
|
| D | stack_overflow.rs | 3 use self::imp::{drop_handler, make_handler}; 5 pub use self::imp::cleanup; 6 pub use self::imp::init; 9 data: *mut libc::c_void, 13 pub unsafe fn new() -> Handler { in new() 17 fn null() -> Handler { in null() 41 use super::Handler; 42 use crate::io; 43 use crate::mem; 44 use crate::ptr; [all …]
|
| /third_party/rust/rust/src/tools/miri/tests/pass-dep/shims/ |
| D | libc-misc.rs | 1 //@ignore-target-windows: No libc on Windows 2 //@compile-flags: -Zmiri-disable-isolation 5 use std::fs::{remove_file, File}; 6 use std::os::unix::io::AsRawFd; 7 use std::path::PathBuf; 9 fn tmp() -> PathBuf { in tmp() 10 use std::ffi::{c_char, CStr, CString}; in tmp() 24 ) -> usize; in tmp() 35 use std::ffi::OsString; in test_posix_realpath_alloc() 36 use std::ffi::{CStr, CString}; in test_posix_realpath_alloc() [all …]
|
| D | libc-fs.rs | 1 //@ignore-target-windows: no libc on Windows 2 //@compile-flags: -Zmiri-disable-isolation 7 use std::convert::TryInto; 8 use std::ffi::{c_char, CStr, CString}; 9 use std::fs::{canonicalize, remove_dir_all, remove_file, File}; 10 use std::io::{Error, ErrorKind, Write}; 11 use std::os::unix::ffi::OsStrExt; 12 use std::path::PathBuf; 25 fn tmp() -> PathBuf { in tmp() 38 ) -> usize; in tmp() [all …]
|
| /third_party/rust/rust/src/tools/miri/tests/pass-dep/concurrency/ |
| D | linux-futex.rs | 1 //@only-target-linux 2 //@compile-flags: -Zmiri-disable-isolation 4 use std::mem::MaybeUninit; 5 use std::ptr; 6 use std::sync::atomic::AtomicI32; 7 use std::sync::atomic::Ordering; 8 use std::thread; 9 use std::time::{Duration, Instant}; 16 assert_eq!(libc::syscall(libc::SYS_futex, &futex as *const i32, libc::FUTEX_WAKE, 1), 0); in wake_nobody() 22 libc::syscall( in wake_nobody() [all …]
|
| /third_party/rust/rust/library/std/src/sys/unix/process/ |
| D | process_vxworks.rs | 1 use crate::fmt; 2 use crate::io::{self, Error, ErrorKind}; 3 use crate::num::NonZeroI32; 4 use crate::sys; 5 use crate::sys::cvt; 6 use crate::sys::process::process_common::*; 7 use crate::sys_common::thread; 8 use core::ffi::NonZero_c_int; 9 use libc::RTP_ID; 10 use libc::{self, c_char, c_int}; [all …]
|
| D | process_unix.rs | 1 use crate::fmt; 2 use crate::io::{self, Error, ErrorKind}; 3 use crate::mem; 4 use crate::num::NonZeroI32; 5 use crate::sys; 6 use crate::sys::cvt; 7 use crate::sys::process::process_common::*; 8 use core::ffi::NonZero_c_int; 11 use crate::os::linux::process::PidFd; 14 use crate::sys::weak::raw_syscall; [all …]
|
| /third_party/rust/crates/nix/ |
| D | CONVENTIONS.md | 3 In order to achieve our goal of wrapping [libc][libc] code in idiomatic rust 16 [kacl]: https://github.com/olivierlacan/keep-a-changelog/tree/18adb5f5be7a898d046f6a4acb93e39dcf40c… 18 ## libc constants, functions and structs 20 We do not define integer constants ourselves, but use or reexport them from the 21 [libc crate][libc]. 23 We use the functions exported from [libc][libc] instead of writing our own 26 We use the `struct` definitions from [libc][libc] internally instead of writing 27 our own. If we want to add methods to a libc type, we use the newtype pattern. 31 pub struct SigSet(libc::sigset_t); 38 When creating newtypes, we use Rust's `CamelCase` type naming convention. [all …]
|
| /third_party/rust/rust/compiler/rustc_data_structures/src/flock/ |
| D | unix.rs | 1 use std::fs::{File, OpenOptions}; 2 use std::io; 3 use std::mem; 4 use std::os::unix::prelude::*; 5 use std::path::Path; 13 pub fn new(p: &Path, wait: bool, create: bool, exclusive: bool) -> io::Result<Lock> { in new() 18 .mode(libc::S_IRWXU as u32) in new() 21 let lock_type = if exclusive { libc::F_WRLCK } else { libc::F_RDLCK }; in new() 23 let mut flock: libc::flock = unsafe { mem::zeroed() }; in new() 24 flock.l_type = lock_type as libc::c_short; in new() [all …]
|
| /third_party/rust/crates/nix/src/sys/socket/ |
| D | sockopt.rs | 2 use super::{GetSockOpt, SetSockOpt}; 3 use crate::errno::Errno; 4 use crate::sys::time::TimeVal; 5 use crate::Result; 6 use cfg_if::cfg_if; 7 use libc::{self, c_int, c_void, socklen_t}; 8 use std::ffi::{OsStr, OsString}; 9 use std::{ 14 use std::os::unix::ffi::OsStrExt; 15 use std::os::unix::io::RawFd; [all …]
|
| D | addr.rs | 15 pub use self::datalink::LinkAddr; 17 pub use self::vsock::VsockAddr; 18 use super::sa_family_t; 19 use crate::errno::Errno; 21 use crate::sys::socket::addr::alg::AlgAddr; 23 use crate::sys::socket::addr::netlink::NetlinkAddr; 28 use crate::sys::socket::addr::sys_control::SysControlAddr; 29 use crate::{NixPath, Result}; 30 use cfg_if::cfg_if; 31 use memoffset::offset_of; [all …]
|
| /third_party/rust/crates/nix/src/ |
| D | fcntl.rs | 1 use crate::errno::Errno; 2 use libc::{self, c_char, c_int, c_uint, size_t, ssize_t}; 3 use std::ffi::OsString; 5 use std::os::raw; 6 use std::os::unix::ffi::OsStringExt; 7 use std::os::unix::io::RawFd; 10 use crate::{sys::stat::Mode, NixPath, Result}; 12 use std::ptr; // For splice and copy_file_range 24 pub use self::posix_fadvise::{posix_fadvise, PosixFadviseAdvice}; 50 /// Use alternate I/O semantics. [all …]
|
| /third_party/rust/crates/rustix/ |
| D | Cargo.toml | 8 description = "Safe Rust bindings to POSIX/Unix/Linux/Winsock2-like syscalls" 10 license = "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT" 14 categories = ["os::unix-apis", "date-and-time", "filesystem", "network-programming"] 16 rust-version = "1.48" 18 [build-dependencies] 23 itoa = { version = "1.0.1", default-features = false, optional = true } 24 io-lifetimes = { version = "1.0.0", default-features = false, features = ["close"], optional = true… 26 # Special dependencies used in rustc-dep-of-std mode. 27 core = { version = "1.0.0", optional = true, package = "rustc-std-workspace-core" } 28 alloc = { version = "1.0.0", optional = true, package = "rustc-std-workspace-alloc" } [all …]
|
| /third_party/rust/rust/library/std/src/sys/unix/locks/ |
| D | pthread_condvar.rs | 1 use crate::cell::UnsafeCell; 2 use crate::ptr; 3 use crate::sync::atomic::{AtomicPtr, Ordering::Relaxed}; 4 use crate::sys::locks::{pthread_mutex, Mutex}; 6 use crate::sys::time::TIMESPEC_MAX; 8 use crate::sys::time::TIMESPEC_MAX_CAPPED; 9 use crate::sys_common::lazy_box::{LazyBox, LazyInit}; 10 use crate::time::Duration; 12 struct AllocatedCondvar(UnsafeCell<libc::pthread_cond_t>); 16 mutex: AtomicPtr<libc::pthread_mutex_t>, [all …]
|
| /third_party/rust/rust/tests/ui/allocator/ |
| D | no_std-alloc-error-handler-custom.rs | 1 // run-pass 2 // ignore-android no libc 3 // ignore-emscripten no libc 4 // ignore-sgx no libc 5 // ignore-wasm32 no libc 6 // only-linux 7 // compile-flags:-C panic=abort 8 // aux-build:helper.rs 16 extern crate libc; 25 use alloc::boxed::Box; [all …]
|
| /third_party/rust/crates/nix/src/sys/ioctl/ |
| D | mod.rs | 3 //! This library is pretty low-level and messy. `ioctl` is not fun. 8 //! The `ioctl` syscall is the grab-bag syscall on POSIX systems. Don't want to add a new 15 //! * Provide read/write access to out-of-band data related to a device such as configuration 17 //! * Provide a mechanism for performing full-duplex data transfers (for instance, xfer on SPI 29 //! Historically `ioctl` numbers were arbitrary hard-coded values. In Linux (before 2.6) and some 30 //! unices this has changed to a more-ordered system where the ioctl numbers are partitioned into 32 …`Documentation/ioctl/ioctl-number.rst`](https://elixir.bootlin.com/linux/latest/source/Documentati… 40 //! preferring to use the 4 components above to generate the final ioctl identifier. Because of 41 //! how old `ioctl`s are, however, there are many hard-coded `ioctl` identifiers. These are 54 //! macro, we know it's a `read` ioctl and can use the `ioctl_read!` macro as follows: [all …]
|
| /third_party/rust/rust/library/std/src/os/unix/net/ |
| D | ancillary.rs | 3 use super::{sockaddr_un, SocketAddr}; 4 use crate::io::{self, IoSlice, IoSliceMut}; 5 use crate::marker::PhantomData; 6 use crate::mem::{size_of, zeroed}; 7 use crate::os::unix::io::RawFd; 8 use crate::path::Path; 9 use crate::ptr::{eq, read_unaligned}; 10 use crate::slice::from_raw_parts; 11 use crate::sys::net::Socket; 13 // FIXME(#43348): Make libc adapt #[doc(cfg(...))] so we don't need these fake definitions here? [all …]
|
| D | addr.rs | 1 use crate::ffi::OsStr; 3 use crate::os::net::linux_ext; 4 use crate::os::unix::ffi::OsStrExt; 5 use crate::path::Path; 6 use crate::sealed::Sealed; 7 use crate::sys::cvt; 8 use crate::{fmt, io, mem, ptr}; 10 // FIXME(#43348): Make libc adapt #[doc(cfg(...))] so we don't need these fake definitions here? 13 mod libc { module 14 pub use libc::c_int; [all …]
|