Skip to content

Commit f4f1ae9

Browse files
authored
Merge pull request #3969 from tgross35/backport-corn
[0.2] Backports
2 parents e7ef0da + 016e498 commit f4f1ae9

File tree

14 files changed

+243
-78
lines changed

14 files changed

+243
-78
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
1-
Thanks for considering submitting a PR!
1+
<!-- Thank you for submitting a PR!
22
3-
We have the [contribution guide](https://github.com/rust-lang/libc/blob/main/CONTRIBUTING.md). Please read it if you're new here!
3+
We have the contribution guide, please read it if you are new here!
4+
<https://github.com/rust-lang/libc/blob/main/CONTRIBUTING.md>
45
5-
Here's a checklist for things that will be checked during review or continuous integration.
6+
Please fill out the below template.
7+
-->
68

7-
- \[ ] Edit corresponding file(s) under `libc-test/semver` when you add/remove item(s), e.g. edit `linux.txt` if you add an item to `src/unix/linux_like/linux/mod.rs`
8-
- \[ ] Your PR doesn't contain any private or *unstable* values like `*LAST` or `*MAX` (see [#3131](https://github.com/rust-lang/libc/issues/3131))
9-
- \[ ] If your PR has a breaking change, please clarify it
10-
- \[ ] If your PR increments version number, it must NOT contain any other changes (otherwise a release could be delayed)
11-
- \[ ] Make sure `ci/style.sh` passes
12-
- \[ ] `cd libc-test && cargo test`
13-
- (this might fail on your env due to environment difference between your env and CI. Ignore failures if you are not sure)
9+
# Description
1410

15-
Delete this line and everything above before opening your PR.
11+
<!-- Add a short description about what this change does -->
12+
13+
# Sources
14+
15+
<!-- All API changes must have links to headers and/or documentation,
16+
preferably both -->
17+
18+
# Checklist
19+
20+
<!-- Please make sure the following has been done before submitting a PR,
21+
or mark it as a draft if you are not sure. -->
22+
23+
- [ ] Relevant tests in `libc-test/semver` have been updated
24+
- [ ] No placeholder or unstable values like `*LAST` or `*MAX` are
25+
included (see [#3131](https://github.com/rust-lang/libc/issues/3131))
26+
- [ ] Tested locally (`cd libc-test && cargo test --target mytarget`);
27+
especially relevant for platforms that may not be checked in CI

libc-test/semver/android.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1904,9 +1904,11 @@ POSIX_FADV_NORMAL
19041904
POSIX_FADV_RANDOM
19051905
POSIX_FADV_SEQUENTIAL
19061906
POSIX_FADV_WILLNEED
1907+
PR_GET_NAME
19071908
PR_GET_NO_NEW_PRIVS
19081909
PR_GET_SECCOMP
19091910
PR_GET_TIMING
1911+
PR_SET_NAME
19101912
PR_SET_NO_NEW_PRIVS
19111913
PR_SET_SECCOMP
19121914
PR_TIMING_STATISTICAL

libc-test/semver/apple.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,7 @@ LOCAL_PEEREPID
849849
LOCAL_PEEREUUID
850850
LOCAL_PEERPID
851851
LOCAL_PEERUUID
852+
LOCAL_PEERTOKEN
852853
LOGIN_PROCESS
853854
LOG_AUTHPRIV
854855
LOG_CRON
@@ -2019,6 +2020,8 @@ log2phys
20192020
login_tty
20202021
lutimes
20212022
mach_absolute_time
2023+
mach_error_string
2024+
mach_error_t
20222025
mach_header
20232026
mach_header_64
20242027
mach_host_self

libc-test/semver/emscripten.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
AT_EACCESS
22
getentropy
3+
getgrgid
4+
getgrnam
5+
getgrnam_r
6+
getgrgid_r
37
posix_fallocate64
48
getpwnam_r
59
getpwuid_r

libc-test/semver/linux-gnu.txt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -337,23 +337,6 @@ NFT_USERDATA_MAXLEN
337337
NF_NETDEV_INGRESS
338338
NF_NETDEV_NUMHOOKS
339339
NILFS_SUPER_MAGIC
340-
NT_PRSTATUS
341-
NT_PRFPREG
342-
NT_FPREGSET
343-
NT_PRPSINFO
344-
NT_PRXREG
345-
NT_TASKSTRUCT
346-
NT_PLATFORM
347-
NT_AUXV
348-
NT_GWINDOWS
349-
NT_ASRS
350-
NT_PSTATUS
351-
NT_PSINFO
352-
NT_PRCRED
353-
NT_UTSNAME
354-
NT_LWPSTATUS
355-
NT_LWPSINFO
356-
NT_PRFPXREG
357340
NTF_EXT_LEARNED
358341
NTF_MASTER
359342
NTF_OFFLOADED

libc-test/semver/linux.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3950,3 +3950,20 @@ eventfd_write
39503950
__c_anonymous_ifru_map
39513951
__c_anonymous_ifr_ifru
39523952
__c_anonymous_ifc_ifcu
3953+
NT_PRSTATUS
3954+
NT_PRFPREG
3955+
NT_FPREGSET
3956+
NT_PRPSINFO
3957+
NT_PRXREG
3958+
NT_TASKSTRUCT
3959+
NT_PLATFORM
3960+
NT_AUXV
3961+
NT_GWINDOWS
3962+
NT_ASRS
3963+
NT_PSTATUS
3964+
NT_PSINFO
3965+
NT_PRCRED
3966+
NT_UTSNAME
3967+
NT_LWPSTATUS
3968+
NT_LWPSINFO
3969+
NT_PRFPXREG

src/unix/bsd/apple/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ pub type thread_inspect_t = ::mach_port_t;
5656
pub type thread_act_t = ::mach_port_t;
5757
pub type thread_act_array_t = *mut ::thread_act_t;
5858
pub type policy_t = ::c_int;
59+
pub type mach_error_t = ::kern_return_t;
5960
pub type mach_vm_address_t = u64;
6061
pub type mach_vm_offset_t = u64;
6162
pub type mach_vm_size_t = u64;
@@ -4194,11 +4195,18 @@ pub const TCP_CONNECTION_INFO: ::c_int = 0x106;
41944195

41954196
pub const SOL_LOCAL: ::c_int = 0;
41964197

4198+
/// Retrieve peer credentials.
41974199
pub const LOCAL_PEERCRED: ::c_int = 0x001;
4200+
/// Retrieve peer PID.
41984201
pub const LOCAL_PEERPID: ::c_int = 0x002;
4202+
/// Retrieve effective peer PID.
41994203
pub const LOCAL_PEEREPID: ::c_int = 0x003;
4204+
/// Retrieve peer UUID.
42004205
pub const LOCAL_PEERUUID: ::c_int = 0x004;
4206+
/// Retrieve effective peer UUID.
42014207
pub const LOCAL_PEEREUUID: ::c_int = 0x005;
4208+
/// Retrieve peer audit token.
4209+
pub const LOCAL_PEERTOKEN: ::c_int = 0x006;
42024210

42034211
pub const SOL_SOCKET: ::c_int = 0xffff;
42044212

@@ -6323,6 +6331,8 @@ extern "C" {
63236331
pub fn copyfile_state_get(s: copyfile_state_t, flags: u32, dst: *mut ::c_void) -> ::c_int;
63246332
pub fn copyfile_state_set(s: copyfile_state_t, flags: u32, src: *const ::c_void) -> ::c_int;
63256333

6334+
pub fn mach_error_string(error_value: ::mach_error_t) -> *mut ::c_char;
6335+
63266336
// Added in macOS 10.13
63276337
// ISO/IEC 9899:2011 ("ISO C11") K.3.7.4.1
63286338
pub fn memset_s(s: *mut ::c_void, smax: ::size_t, c: ::c_int, n: ::size_t) -> ::c_int;

src/unix/linux_like/android/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3153,6 +3153,8 @@ pub const PR_GET_TIMING: ::c_int = 13;
31533153
pub const PR_SET_TIMING: ::c_int = 14;
31543154
pub const PR_TIMING_STATISTICAL: ::c_int = 0;
31553155
pub const PR_TIMING_TIMESTAMP: ::c_int = 1;
3156+
pub const PR_SET_NAME: ::c_int = 15;
3157+
pub const PR_GET_NAME: ::c_int = 16;
31563158

31573159
// linux/if_addr.h
31583160
pub const IFA_UNSPEC: ::c_ushort = 0;

src/unix/linux_like/emscripten/mod.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,6 +1793,24 @@ extern "C" {
17931793
buflen: ::size_t,
17941794
result: *mut *mut passwd,
17951795
) -> ::c_int;
1796+
1797+
// grp.h
1798+
pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
1799+
pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
1800+
pub fn getgrnam_r(
1801+
name: *const ::c_char,
1802+
grp: *mut ::group,
1803+
buf: *mut ::c_char,
1804+
buflen: ::size_t,
1805+
result: *mut *mut ::group,
1806+
) -> ::c_int;
1807+
pub fn getgrgid_r(
1808+
gid: ::gid_t,
1809+
grp: *mut ::group,
1810+
buf: *mut ::c_char,
1811+
buflen: ::size_t,
1812+
result: *mut *mut ::group,
1813+
) -> ::c_int;
17961814
}
17971815

17981816
// Alias <foo> to <foo>64 to mimic glibc's LFS64 support

src/unix/linux_like/linux/gnu/mod.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,25 +1103,6 @@ pub const XSK_UNALIGNED_BUF_ADDR_MASK: ::c_ulonglong = (1 << XSK_UNALIGNED_BUF_O
11031103

11041104
pub const XDP_PKT_CONTD: ::__u32 = 1 << 0;
11051105

1106-
// elf.h
1107-
pub const NT_PRSTATUS: ::c_int = 1;
1108-
pub const NT_PRFPREG: ::c_int = 2;
1109-
pub const NT_FPREGSET: ::c_int = 2;
1110-
pub const NT_PRPSINFO: ::c_int = 3;
1111-
pub const NT_PRXREG: ::c_int = 4;
1112-
pub const NT_TASKSTRUCT: ::c_int = 4;
1113-
pub const NT_PLATFORM: ::c_int = 5;
1114-
pub const NT_AUXV: ::c_int = 6;
1115-
pub const NT_GWINDOWS: ::c_int = 7;
1116-
pub const NT_ASRS: ::c_int = 8;
1117-
pub const NT_PSTATUS: ::c_int = 10;
1118-
pub const NT_PSINFO: ::c_int = 13;
1119-
pub const NT_PRCRED: ::c_int = 14;
1120-
pub const NT_UTSNAME: ::c_int = 15;
1121-
pub const NT_LWPSTATUS: ::c_int = 16;
1122-
pub const NT_LWPSINFO: ::c_int = 17;
1123-
pub const NT_PRFPXREG: ::c_int = 20;
1124-
11251106
pub const ELFOSABI_ARM_AEABI: u8 = 64;
11261107

11271108
// linux/sched.h

src/unix/linux_like/linux/mod.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4907,6 +4907,25 @@ pub const SCHED_FLAG_KEEP_PARAMS: ::c_int = 0x10;
49074907
pub const SCHED_FLAG_UTIL_CLAMP_MIN: ::c_int = 0x20;
49084908
pub const SCHED_FLAG_UTIL_CLAMP_MAX: ::c_int = 0x40;
49094909

4910+
// elf.h
4911+
pub const NT_PRSTATUS: ::c_int = 1;
4912+
pub const NT_PRFPREG: ::c_int = 2;
4913+
pub const NT_FPREGSET: ::c_int = 2;
4914+
pub const NT_PRPSINFO: ::c_int = 3;
4915+
pub const NT_PRXREG: ::c_int = 4;
4916+
pub const NT_TASKSTRUCT: ::c_int = 4;
4917+
pub const NT_PLATFORM: ::c_int = 5;
4918+
pub const NT_AUXV: ::c_int = 6;
4919+
pub const NT_GWINDOWS: ::c_int = 7;
4920+
pub const NT_ASRS: ::c_int = 8;
4921+
pub const NT_PSTATUS: ::c_int = 10;
4922+
pub const NT_PSINFO: ::c_int = 13;
4923+
pub const NT_PRCRED: ::c_int = 14;
4924+
pub const NT_UTSNAME: ::c_int = 15;
4925+
pub const NT_LWPSTATUS: ::c_int = 16;
4926+
pub const NT_LWPSINFO: ::c_int = 17;
4927+
pub const NT_PRFPXREG: ::c_int = 20;
4928+
49104929
pub const SCHED_FLAG_KEEP_ALL: ::c_int = SCHED_FLAG_KEEP_POLICY | SCHED_FLAG_KEEP_PARAMS;
49114930

49124931
pub const SCHED_FLAG_UTIL_CLAMP: ::c_int = SCHED_FLAG_UTIL_CLAMP_MIN | SCHED_FLAG_UTIL_CLAMP_MAX;

src/unix/newlib/espidf/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,15 @@ pub const MSG_EOR: ::c_int = 0x08;
8989

9090
pub const PTHREAD_STACK_MIN: ::size_t = 768;
9191

92-
pub const SIGABRT: ::c_int = 1;
93-
pub const SIGFPE: ::c_int = 1;
94-
pub const SIGILL: ::c_int = 1;
95-
pub const SIGINT: ::c_int = 1;
96-
pub const SIGSEGV: ::c_int = 1;
97-
pub const SIGTERM: ::c_int = 1;
92+
pub const SIGABRT: ::c_int = 6;
93+
pub const SIGFPE: ::c_int = 8;
94+
pub const SIGILL: ::c_int = 4;
95+
pub const SIGINT: ::c_int = 2;
96+
pub const SIGSEGV: ::c_int = 11;
97+
pub const SIGTERM: ::c_int = 15;
9898
pub const SIGHUP: ::c_int = 1;
99-
pub const SIGQUIT: ::c_int = 1;
100-
pub const NSIG: ::size_t = 2;
99+
pub const SIGQUIT: ::c_int = 3;
100+
pub const NSIG: ::size_t = 32;
101101

102102
extern "C" {
103103
pub fn pthread_create(

src/unix/newlib/generic.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
33
s! {
44
pub struct sigset_t {
5+
#[cfg(target_os = "horizon")]
56
__val: [::c_ulong; 16],
7+
#[cfg(not(target_os = "horizon"))]
8+
__val: u32,
69
}
710

811
pub struct stat {

0 commit comments

Comments
 (0)