Alexander Batischev 2020-04-04 20:54:02 +03:00
parent 29b27da956
commit fda521b9d2
9 changed files with 163 additions and 0 deletions

View File

@ -124,6 +124,7 @@ fn test_apple(target: &str) {
"poll.h",
"pthread.h",
"pwd.h",
"regex.h",
"resolv.h",
"sched.h",
"semaphore.h",
@ -303,6 +304,7 @@ fn test_openbsd(target: &str) {
"netinet/tcp.h",
"netinet/udp.h",
"net/bpf.h",
"regex.h",
"resolv.h",
"pthread.h",
"dlfcn.h",
@ -903,6 +905,7 @@ fn test_netbsd(target: &str) {
"poll.h",
"pthread.h",
"pwd.h",
"regex.h",
"resolv.h",
"sched.h",
"semaphore.h",
@ -1098,6 +1101,7 @@ fn test_dragonflybsd(target: &str) {
"pthread.h",
"pthread_np.h",
"pwd.h",
"regex.h",
"resolv.h",
"sched.h",
"semaphore.h",
@ -1643,6 +1647,7 @@ fn test_freebsd(target: &str) {
"pthread.h",
"pthread_np.h",
"pwd.h",
"regex.h",
"resolv.h",
"sched.h",
"semaphore.h",
@ -2248,6 +2253,7 @@ fn test_linux(target: &str) {
"pthread.h",
"pty.h",
"pwd.h",
"regex.h",
"resolv.h",
"sched.h",
"semaphore.h",

View File

@ -1181,6 +1181,9 @@ pub const TIME_OOP: ::c_int = 3;
pub const TIME_WAIT: ::c_int = 4;
pub const TIME_ERROR: ::c_int = 5;
pub const REG_ENOSYS: ::c_int = -1;
pub const REG_ILLSEQ: ::c_int = 17;
f! {
pub fn WIFCONTINUED(status: ::c_int) -> bool {
status == 0x13

View File

@ -6,6 +6,7 @@ pub type socklen_t = u32;
pub type sa_family_t = u8;
pub type pthread_t = ::uintptr_t;
pub type nfds_t = ::c_uint;
pub type regoff_t = off_t;
s! {
pub struct sockaddr {
@ -101,6 +102,18 @@ s! {
pub if_index: ::c_uint,
pub if_name: *mut ::c_char,
}
pub struct regex_t {
__re_magic: ::c_int,
__re_nsub: ::size_t,
__re_endp: *const ::c_char,
__re_g: *mut ::c_void,
}
pub struct regmatch_t {
pub rm_so: regoff_t,
pub rm_eo: regoff_t,
}
}
s_no_extra_traits! {
@ -450,6 +463,41 @@ pub const BIOCGHDRCMPLT: ::c_ulong = 0x40044274;
pub const BIOCSHDRCMPLT: ::c_ulong = 0x80044275;
pub const SIOCGIFADDR: ::c_ulong = 0xc0206921;
pub const REG_BASIC: ::c_int = 0o0000;
pub const REG_EXTENDED: ::c_int = 0o0001;
pub const REG_ICASE: ::c_int = 0o0002;
pub const REG_NOSUB: ::c_int = 0o0004;
pub const REG_NEWLINE: ::c_int = 0o0010;
pub const REG_NOSPEC: ::c_int = 0o0020;
pub const REG_PEND: ::c_int = 0o0040;
pub const REG_DUMP: ::c_int = 0o0200;
pub const REG_NOMATCH: ::c_int = 1;
pub const REG_BADPAT: ::c_int = 2;
pub const REG_ECOLLATE: ::c_int = 3;
pub const REG_ECTYPE: ::c_int = 4;
pub const REG_EESCAPE: ::c_int = 5;
pub const REG_ESUBREG: ::c_int = 6;
pub const REG_EBRACK: ::c_int = 7;
pub const REG_EPAREN: ::c_int = 8;
pub const REG_EBRACE: ::c_int = 9;
pub const REG_BADBR: ::c_int = 10;
pub const REG_ERANGE: ::c_int = 11;
pub const REG_ESPACE: ::c_int = 12;
pub const REG_BADRPT: ::c_int = 13;
pub const REG_EMPTY: ::c_int = 14;
pub const REG_ASSERT: ::c_int = 15;
pub const REG_INVARG: ::c_int = 16;
pub const REG_ATOI: ::c_int = 255;
pub const REG_ITOA: ::c_int = 0o0400;
pub const REG_NOTBOL: ::c_int = 0o00001;
pub const REG_NOTEOL: ::c_int = 0o00002;
pub const REG_STARTEND: ::c_int = 0o00004;
pub const REG_TRACE: ::c_int = 0o00400;
pub const REG_LARGE: ::c_int = 0o01000;
pub const REG_BACKR: ::c_int = 0o02000;
f! {
pub fn CMSG_FIRSTHDR(mhdr: *const ::msghdr) -> *mut ::cmsghdr {
if (*mhdr).msg_controllen as usize >= ::mem::size_of::<::cmsghdr>() {
@ -785,6 +833,29 @@ extern "C" {
options: ::c_int,
rusage: *mut ::rusage,
) -> ::pid_t;
pub fn regcomp(
preg: *mut regex_t,
pattern: *const ::c_char,
cflags: ::c_int,
) -> ::c_int;
pub fn regexec(
preg: *const regex_t,
input: *const ::c_char,
nmatch: ::size_t,
pmatch: *mut regmatch_t,
eflags: ::c_int,
) -> ::c_int;
pub fn regerror(
errcode: ::c_int,
preg: *const regex_t,
errbuf: *mut ::c_char,
errbuf_size: ::size_t,
) -> ::size_t;
pub fn regfree(preg: *mut regex_t);
}
cfg_if! {

View File

@ -621,6 +621,8 @@ pub const SF_APPEND: ::c_ulong = 0x00040000;
pub const TIMER_ABSTIME: ::c_int = 1;
pub const REG_ENOSYS: ::c_int = 17;
#[link(name = "util")]
extern "C" {
pub fn setgrent();

View File

@ -2,6 +2,7 @@ pub type pthread_t = c_ulong;
pub type __priority_which_t = ::c_uint;
pub type __rlimit_resource_t = ::c_uint;
pub type Lmid_t = ::c_long;
pub type regoff_t = ::c_int;
s! {
pub struct statx {
@ -273,6 +274,17 @@ s! {
pub __glibc_reserved3: ::c_long,
pub __glibc_reserved4: ::c_long,
}
pub struct regex_t {
__buffer: *mut ::c_void,
__allocated: ::size_t,
__used: ::size_t,
__syntax: ::c_ulong,
__fastmap: *mut ::c_char,
__translate: *mut ::c_char,
__re_nsub: ::size_t,
__bitfield: u8,
}
}
impl siginfo_t {
@ -1127,6 +1139,12 @@ cfg_if! {
}
pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 3;
pub const REG_STARTEND: ::c_int = 4;
pub const REG_EEND: ::c_int = 14;
pub const REG_ESIZE: ::c_int = 15;
pub const REG_ERPAREN: ::c_int = 16;
extern "C" {
pub fn fgetspent_r(
fp: *mut ::FILE,

View File

@ -489,6 +489,11 @@ s! {
pub svm_cid: ::c_uint,
pub svm_zero: [u8; 4]
}
pub struct regmatch_t {
pub rm_so: regoff_t,
pub rm_eo: regoff_t,
}
}
s_no_extra_traits! {
@ -2512,6 +2517,29 @@ pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4;
pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2;
pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543;
pub const REG_EXTENDED: ::c_int = 1;
pub const REG_ICASE: ::c_int = 2;
pub const REG_NEWLINE: ::c_int = 4;
pub const REG_NOSUB: ::c_int = 8;
pub const REG_NOTBOL: ::c_int = 1;
pub const REG_NOTEOL: ::c_int = 2;
pub const REG_ENOSYS: ::c_int = -1;
pub const REG_NOMATCH: ::c_int = 1;
pub const REG_BADPAT: ::c_int = 2;
pub const REG_ECOLLATE: ::c_int = 3;
pub const REG_ECTYPE: ::c_int = 4;
pub const REG_EESCAPE: ::c_int = 5;
pub const REG_ESUBREG: ::c_int = 6;
pub const REG_EBRACK: ::c_int = 7;
pub const REG_EPAREN: ::c_int = 8;
pub const REG_EBRACE: ::c_int = 9;
pub const REG_BADBR: ::c_int = 10;
pub const REG_ERANGE: ::c_int = 11;
pub const REG_ESPACE: ::c_int = 12;
pub const REG_BADRPT: ::c_int = 13;
f! {
pub fn NLA_ALIGN(len: ::c_int) -> ::c_int {
return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1)
@ -3365,6 +3393,29 @@ extern "C" {
mask: u32,
) -> ::c_int;
pub fn fanotify_init(flags: ::c_uint, event_f_flags: ::c_uint) -> ::c_int;
pub fn regcomp(
preg: *mut ::regex_t,
pattern: *const ::c_char,
cflags: ::c_int,
) -> ::c_int;
pub fn regexec(
preg: *const ::regex_t,
input: *const ::c_char,
nmatch: ::size_t,
pmatch: *mut regmatch_t,
eflags: ::c_int,
) -> ::c_int;
pub fn regerror(
errcode: ::c_int,
preg: *const ::regex_t,
errbuf: *mut ::c_char,
errbuf_size: ::size_t,
) -> ::size_t;
pub fn regfree(preg: *mut ::regex_t);
}
cfg_if! {

View File

@ -3,6 +3,7 @@ pub type c_ulong = u32;
pub type nlink_t = u32;
pub type blksize_t = ::c_long;
pub type __u64 = ::c_ulonglong;
pub type regoff_t = ::c_int;
s! {
pub struct pthread_attr_t {

View File

@ -1,5 +1,6 @@
pub type c_long = i64;
pub type c_ulong = u64;
pub type regoff_t = ::c_long;
s! {
pub struct statfs64 {

View File

@ -109,6 +109,14 @@ s! {
pub l_len: ::off_t,
pub l_pid: ::pid_t,
}
pub struct regex_t {
__re_nsub: ::size_t,
__opaque: *mut ::c_void,
__padding: [*mut ::c_void; 4usize],
__nsub2: ::size_t,
__padding2: ::c_char,
}
}
s_no_extra_traits! {
@ -391,6 +399,8 @@ pub const RLIMIT_MSGQUEUE: ::c_int = 12;
pub const RLIMIT_NICE: ::c_int = 13;
pub const RLIMIT_RTPRIO: ::c_int = 14;
pub const REG_OK: ::c_int = 0;
extern "C" {
pub fn sendmmsg(
sockfd: ::c_int,