Skip to content

Commit

Permalink
Merge branch 'rust-lang:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
elecm committed Nov 6, 2023
2 parents 1984a01 + bbd3e20 commit 3b32212
Show file tree
Hide file tree
Showing 9 changed files with 349 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "libc"
version = "0.2.149"
version = "0.2.150"
authors = ["The Rust Project Developers"]
license = "MIT OR Apache-2.0"
readme = "README.md"
Expand Down
4 changes: 2 additions & 2 deletions libc-test/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "libc-test"
version = "0.2.149"
version = "0.2.150"
authors = ["The Rust Project Developers"]
license = "MIT OR Apache-2.0"
build = "build.rs"
Expand All @@ -12,7 +12,7 @@ A test crate for the libc crate.

[dependencies.libc]
path = ".."
version = "0.2.149"
version = "0.2.150"
default-features = false

[build-dependencies]
Expand Down
11 changes: 2 additions & 9 deletions libc-test/build.rs
Expand Up @@ -523,15 +523,6 @@ fn test_openbsd(target: &str) {
"sys/param.h",
}

cfg.skip_type(move |ty| {
if ty.starts_with("__c_anonymous_") {
return true;
}
match ty {
_ => false,
}
});

cfg.skip_struct(move |ty| {
if ty.starts_with("__c_anonymous_") {
return true;
Expand Down Expand Up @@ -1569,6 +1560,7 @@ fn test_android(target: &str) {
"libgen.h",
"limits.h",
"link.h",
"linux/sysctl.h",
"locale.h",
"malloc.h",
"net/ethernet.h",
Expand Down Expand Up @@ -3267,6 +3259,7 @@ fn test_linux(target: &str) {
"libgen.h",
"limits.h",
"link.h",
"linux/sysctl.h",
"locale.h",
"malloc.h",
"mntent.h",
Expand Down
5 changes: 5 additions & 0 deletions libc-test/semver/redox.txt
Expand Up @@ -180,6 +180,7 @@ bsearch
chroot
clearerr
difftime
endgrent
endpwent
endservent
epoll_create
Expand All @@ -191,7 +192,10 @@ explicit_bzero
fchdir
fmemopen
getdtablesize
getgrent
getgrgid
getgrgid_r
getgrnam
getgrnam_r
getgrouplist
getline
Expand All @@ -212,6 +216,7 @@ pipe2
pthread_condattr_setclock
qsort
reallocarray
setgrent
setpwent
setrlimit
setservent
Expand Down
33 changes: 33 additions & 0 deletions src/unix/bsd/netbsdlike/netbsd/mod.rs
Expand Up @@ -60,6 +60,39 @@ impl siginfo_t {
self.si_addr
}

pub unsafe fn si_code(&self) -> ::c_int {
self.si_code
}

pub unsafe fn si_errno(&self) -> ::c_int {
self.si_errno
}

pub unsafe fn si_pid(&self) -> ::pid_t {
#[repr(C)]
struct siginfo_timer {
_si_signo: ::c_int,
_si_errno: ::c_int,
_si_code: ::c_int,
__pad1: ::c_int,
_pid: ::pid_t,
}
(*(self as *const siginfo_t as *const siginfo_timer))._pid
}

pub unsafe fn si_uid(&self) -> ::uid_t {
#[repr(C)]
struct siginfo_timer {
_si_signo: ::c_int,
_si_errno: ::c_int,
_si_code: ::c_int,
__pad1: ::c_int,
_pid: ::pid_t,
_uid: ::uid_t,
}
(*(self as *const siginfo_t as *const siginfo_timer))._uid
}

pub unsafe fn si_value(&self) -> ::sigval {
#[repr(C)]
struct siginfo_timer {
Expand Down
41 changes: 39 additions & 2 deletions src/unix/bsd/netbsdlike/openbsd/mod.rs
Expand Up @@ -548,12 +548,46 @@ impl siginfo_t {
self.si_addr
}

pub unsafe fn si_value(&self) -> ::sigval {
pub unsafe fn si_code(&self) -> ::c_int {
self.si_code
}

pub unsafe fn si_errno(&self) -> ::c_int {
self.si_errno
}

pub unsafe fn si_pid(&self) -> ::pid_t {
#[repr(C)]
struct siginfo_timer {
_si_signo: ::c_int,
_si_code: ::c_int,
_si_errno: ::c_int,
_pad: [::c_int; SI_PAD],
_pid: ::pid_t,
}
(*(self as *const siginfo_t as *const siginfo_timer))._pid
}

pub unsafe fn si_uid(&self) -> ::uid_t {
#[repr(C)]
struct siginfo_timer {
_si_signo: ::c_int,
_si_code: ::c_int,
_si_errno: ::c_int,
_pad: [::c_int; SI_PAD],
_pid: ::pid_t,
_uid: ::uid_t,
}
(*(self as *const siginfo_t as *const siginfo_timer))._uid
}

pub unsafe fn si_value(&self) -> ::sigval {
#[repr(C)]
struct siginfo_timer {
_si_signo: ::c_int,
_si_code: ::c_int,
_si_errno: ::c_int,
_pad: [::c_int; SI_PAD],
_pid: ::pid_t,
_uid: ::uid_t,
value: ::sigval,
Expand Down Expand Up @@ -625,7 +659,7 @@ s_no_extra_traits! {
pub ifru_metric: ::c_int,
pub ifru_vnetid: i64,
pub ifru_media: u64,
pub ifru_data: *mut ::c_char,
pub ifru_data: ::caddr_t,
pub ifru_index: ::c_uint,
}
}
Expand Down Expand Up @@ -1652,6 +1686,9 @@ pub const NTFS_MFLAG_ALLNAMES: ::c_int = 0x2;

pub const TMPFS_ARGS_VERSION: ::c_int = 1;

const SI_MAXSZ: ::size_t = 128;
const SI_PAD: ::size_t = (SI_MAXSZ / ::mem::size_of::<::c_int>()) - 3;

pub const MAP_STACK: ::c_int = 0x4000;
pub const MAP_CONCEAL: ::c_int = 0x8000;

Expand Down
129 changes: 129 additions & 0 deletions src/unix/linux_like/android/mod.rs
Expand Up @@ -3162,6 +3162,135 @@ pub const RTMSG_DELDEVICE: u32 = 0x12;
pub const RTMSG_NEWROUTE: u32 = 0x21;
pub const RTMSG_DELROUTE: u32 = 0x22;

pub const CTL_KERN: ::c_int = 1;
pub const CTL_VM: ::c_int = 2;
pub const CTL_NET: ::c_int = 3;
pub const CTL_FS: ::c_int = 5;
pub const CTL_DEBUG: ::c_int = 6;
pub const CTL_DEV: ::c_int = 7;
pub const CTL_BUS: ::c_int = 8;
pub const CTL_ABI: ::c_int = 9;
pub const CTL_CPU: ::c_int = 10;

pub const CTL_BUS_ISA: ::c_int = 1;

pub const INOTIFY_MAX_USER_INSTANCES: ::c_int = 1;
pub const INOTIFY_MAX_USER_WATCHES: ::c_int = 2;
pub const INOTIFY_MAX_QUEUED_EVENTS: ::c_int = 3;

pub const KERN_OSTYPE: ::c_int = 1;
pub const KERN_OSRELEASE: ::c_int = 2;
pub const KERN_OSREV: ::c_int = 3;
pub const KERN_VERSION: ::c_int = 4;
pub const KERN_SECUREMASK: ::c_int = 5;
pub const KERN_PROF: ::c_int = 6;
pub const KERN_NODENAME: ::c_int = 7;
pub const KERN_DOMAINNAME: ::c_int = 8;
pub const KERN_PANIC: ::c_int = 15;
pub const KERN_REALROOTDEV: ::c_int = 16;
pub const KERN_SPARC_REBOOT: ::c_int = 21;
pub const KERN_CTLALTDEL: ::c_int = 22;
pub const KERN_PRINTK: ::c_int = 23;
pub const KERN_NAMETRANS: ::c_int = 24;
pub const KERN_PPC_HTABRECLAIM: ::c_int = 25;
pub const KERN_PPC_ZEROPAGED: ::c_int = 26;
pub const KERN_PPC_POWERSAVE_NAP: ::c_int = 27;
pub const KERN_MODPROBE: ::c_int = 28;
pub const KERN_SG_BIG_BUFF: ::c_int = 29;
pub const KERN_ACCT: ::c_int = 30;
pub const KERN_PPC_L2CR: ::c_int = 31;
pub const KERN_RTSIGNR: ::c_int = 32;
pub const KERN_RTSIGMAX: ::c_int = 33;
pub const KERN_SHMMAX: ::c_int = 34;
pub const KERN_MSGMAX: ::c_int = 35;
pub const KERN_MSGMNB: ::c_int = 36;
pub const KERN_MSGPOOL: ::c_int = 37;
pub const KERN_SYSRQ: ::c_int = 38;
pub const KERN_MAX_THREADS: ::c_int = 39;
pub const KERN_RANDOM: ::c_int = 40;
pub const KERN_SHMALL: ::c_int = 41;
pub const KERN_MSGMNI: ::c_int = 42;
pub const KERN_SEM: ::c_int = 43;
pub const KERN_SPARC_STOP_A: ::c_int = 44;
pub const KERN_SHMMNI: ::c_int = 45;
pub const KERN_OVERFLOWUID: ::c_int = 46;
pub const KERN_OVERFLOWGID: ::c_int = 47;
pub const KERN_SHMPATH: ::c_int = 48;
pub const KERN_HOTPLUG: ::c_int = 49;
pub const KERN_IEEE_EMULATION_WARNINGS: ::c_int = 50;
pub const KERN_S390_USER_DEBUG_LOGGING: ::c_int = 51;
pub const KERN_CORE_USES_PID: ::c_int = 52;
pub const KERN_TAINTED: ::c_int = 53;
pub const KERN_CADPID: ::c_int = 54;
pub const KERN_PIDMAX: ::c_int = 55;
pub const KERN_CORE_PATTERN: ::c_int = 56;
pub const KERN_PANIC_ON_OOPS: ::c_int = 57;
pub const KERN_HPPA_PWRSW: ::c_int = 58;
pub const KERN_HPPA_UNALIGNED: ::c_int = 59;
pub const KERN_PRINTK_RATELIMIT: ::c_int = 60;
pub const KERN_PRINTK_RATELIMIT_BURST: ::c_int = 61;
pub const KERN_PTY: ::c_int = 62;
pub const KERN_NGROUPS_MAX: ::c_int = 63;
pub const KERN_SPARC_SCONS_PWROFF: ::c_int = 64;
pub const KERN_HZ_TIMER: ::c_int = 65;
pub const KERN_UNKNOWN_NMI_PANIC: ::c_int = 66;
pub const KERN_BOOTLOADER_TYPE: ::c_int = 67;
pub const KERN_RANDOMIZE: ::c_int = 68;
pub const KERN_SETUID_DUMPABLE: ::c_int = 69;
pub const KERN_SPIN_RETRY: ::c_int = 70;
pub const KERN_ACPI_VIDEO_FLAGS: ::c_int = 71;
pub const KERN_IA64_UNALIGNED: ::c_int = 72;
pub const KERN_COMPAT_LOG: ::c_int = 73;
pub const KERN_MAX_LOCK_DEPTH: ::c_int = 74;

pub const VM_OVERCOMMIT_MEMORY: ::c_int = 5;
pub const VM_PAGE_CLUSTER: ::c_int = 10;
pub const VM_DIRTY_BACKGROUND: ::c_int = 11;
pub const VM_DIRTY_RATIO: ::c_int = 12;
pub const VM_DIRTY_WB_CS: ::c_int = 13;
pub const VM_DIRTY_EXPIRE_CS: ::c_int = 14;
pub const VM_NR_PDFLUSH_THREADS: ::c_int = 15;
pub const VM_OVERCOMMIT_RATIO: ::c_int = 16;
pub const VM_PAGEBUF: ::c_int = 17;
pub const VM_HUGETLB_PAGES: ::c_int = 18;
pub const VM_SWAPPINESS: ::c_int = 19;
pub const VM_LOWMEM_RESERVE_RATIO: ::c_int = 20;
pub const VM_MIN_FREE_KBYTES: ::c_int = 21;
pub const VM_MAX_MAP_COUNT: ::c_int = 22;
pub const VM_LAPTOP_MODE: ::c_int = 23;
pub const VM_BLOCK_DUMP: ::c_int = 24;
pub const VM_HUGETLB_GROUP: ::c_int = 25;
pub const VM_VFS_CACHE_PRESSURE: ::c_int = 26;
pub const VM_LEGACY_VA_LAYOUT: ::c_int = 27;
pub const VM_SWAP_TOKEN_TIMEOUT: ::c_int = 28;
pub const VM_DROP_PAGECACHE: ::c_int = 29;
pub const VM_PERCPU_PAGELIST_FRACTION: ::c_int = 30;
pub const VM_ZONE_RECLAIM_MODE: ::c_int = 31;
pub const VM_MIN_UNMAPPED: ::c_int = 32;
pub const VM_PANIC_ON_OOM: ::c_int = 33;
pub const VM_VDSO_ENABLED: ::c_int = 34;

pub const NET_CORE: ::c_int = 1;
pub const NET_ETHER: ::c_int = 2;
pub const NET_802: ::c_int = 3;
pub const NET_UNIX: ::c_int = 4;
pub const NET_IPV4: ::c_int = 5;
pub const NET_IPX: ::c_int = 6;
pub const NET_ATALK: ::c_int = 7;
pub const NET_NETROM: ::c_int = 8;
pub const NET_AX25: ::c_int = 9;
pub const NET_BRIDGE: ::c_int = 10;
pub const NET_ROSE: ::c_int = 11;
pub const NET_IPV6: ::c_int = 12;
pub const NET_X25: ::c_int = 13;
pub const NET_TR: ::c_int = 14;
pub const NET_DECNET: ::c_int = 15;
pub const NET_ECONET: ::c_int = 16;
pub const NET_SCTP: ::c_int = 17;
pub const NET_LLC: ::c_int = 18;
pub const NET_NETFILTER: ::c_int = 19;
pub const NET_DCCP: ::c_int = 20;

// Most `*_SUPER_MAGIC` constants are defined at the `linux_like` level; the
// following are only available on newer Linux versions than the versions
// currently used in CI in some configurations, so we define them here.
Expand Down

0 comments on commit 3b32212

Please sign in to comment.