Skip to content

Commit e0ff1e6

Browse files
committed
Auto merge of #1387 - tormol:fionclex, r=gnzlbg
Add FIONCLEX and other FIO* constants for Linux, DragonFly and OpenBSD [OpenBSD header](https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/sys/filio.h?annotate=1.5) | [DragonFly header](http://gitweb.dragonflybsd.org/dragonfly.git/blame/refs/heads/master:/sys/sys/filio.h) | [Linux search](https://github.com/torvalds/linux/search?q=FIONCLEX+FIOQSIZE&unscoped_q=FIONCLEX+FIOQSIZE&type=Code) For Linux I've used [godbolt compiler explorer](https://godbolt.org/z/h-C7qM) to get final values where possible. Wile this crate has FIOCLEX for Fuchsia, Emscripten and Redox, I've not added FIONCLEX for them because those targets appear to support neither. I started adding FIOASYNC, FIOSETOWN and FIOGETOWN for all the Linux architectures, but gave up when I realized FIOASYNC is kind of deprecated and the other two useless without more symbols. If anybody is interested I have a [branch with how far I got](https://github.com/tormol/rust-libc/tree/sigio).
2 parents 11c762c + 2c10c4c commit e0ff1e6

File tree

26 files changed

+30
-18
lines changed

26 files changed

+30
-18
lines changed

src/unix/bsd/apple/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,11 +1737,6 @@ pub const TIOCPTYGRANT: ::c_uint = 0x20007454;
17371737
pub const TIOCPTYGNAME: ::c_uint = 0x40807453;
17381738
pub const TIOCPTYUNLK: ::c_uint = 0x20007452;
17391739

1740-
pub const FIONCLEX: ::c_uint = 0x20006602;
1741-
pub const FIONREAD: ::c_ulong = 0x4004667f;
1742-
pub const FIOASYNC: ::c_ulong = 0x8004667d;
1743-
pub const FIOSETOWN: ::c_ulong = 0x8004667c;
1744-
pub const FIOGETOWN: ::c_ulong = 0x4004667b;
17451740
pub const FIODTYPE: ::c_ulong = 0x4004667a;
17461741

17471742
pub const B0: speed_t = 0;

src/unix/bsd/freebsdlike/freebsd/mod.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -570,14 +570,6 @@ pub const TIOCSIG: ::c_uint = 0x2004745f;
570570
pub const TIOCM_DCD: ::c_int = 0x40;
571571
pub const H4DISC: ::c_int = 0x7;
572572

573-
pub const FIONCLEX: ::c_ulong = 0x20006602;
574-
pub const FIONREAD: ::c_ulong = 0x4004667f;
575-
pub const FIOASYNC: ::c_ulong = 0x8004667d;
576-
pub const FIOSETOWN: ::c_ulong = 0x8004667c;
577-
pub const FIOGETOWN: ::c_ulong = 0x4004667b;
578-
pub const FIODTYPE: ::c_ulong = 0x4004667a;
579-
pub const FIOGETLBA: ::c_ulong = 0x40046679;
580-
pub const FIODGNAME: ::c_ulong = 0x80106678;
581573
pub const FIONWRITE: ::c_ulong = 0x40046677;
582574
pub const FIONSPACE: ::c_ulong = 0x40046676;
583575
pub const FIOSEEKDATA: ::c_ulong = 0xc0086661;

src/unix/bsd/freebsdlike/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,10 @@ pub const SLIPDISC: ::c_int = 0x4;
997997
pub const PPPDISC: ::c_int = 0x5;
998998
pub const NETGRAPHDISC: ::c_int = 0x6;
999999

1000+
pub const FIODTYPE: ::c_ulong = 0x4004667a;
1001+
pub const FIOGETLBA: ::c_ulong = 0x40046679;
1002+
pub const FIODGNAME: ::c_ulong = 0x80106678;
1003+
10001004
pub const B0: speed_t = 0;
10011005
pub const B50: speed_t = 50;
10021006
pub const B75: speed_t = 75;

src/unix/bsd/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,12 @@ pub const LC_TIME: ::c_int = 5;
233233
pub const LC_MESSAGES: ::c_int = 6;
234234

235235
pub const FIOCLEX: ::c_ulong = 0x20006601;
236+
pub const FIONCLEX: ::c_ulong = 0x20006602;
237+
pub const FIONREAD: ::c_ulong = 0x4004667f;
236238
pub const FIONBIO: ::c_ulong = 0x8004667e;
239+
pub const FIOASYNC: ::c_ulong = 0x8004667d;
240+
pub const FIOSETOWN: ::c_ulong = 0x8004667c;
241+
pub const FIOGETOWN: ::c_ulong = 0x4004667b;
237242

238243
pub const PATH_MAX: ::c_int = 1024;
239244

src/unix/bsd/netbsdlike/netbsd/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,14 +1377,9 @@ pub const CHWFLOW: ::tcflag_t = ::MDMBUF | ::CRTSCTS | ::CDTRCTS;
13771377
pub const SOCK_CLOEXEC: ::c_int = 0x10000000;
13781378
pub const SOCK_NONBLOCK: ::c_int = 0x20000000;
13791379

1380-
pub const FIONCLEX: ::c_ulong = 0x20006602;
13811380
// Uncomment on next NetBSD release
13821381
// pub const FIOSEEKDATA: ::c_ulong = 0xc0086661;
13831382
// pub const FIOSEEKHOLE: ::c_ulong = 0xc0086662;
1384-
pub const FIONREAD: ::c_ulong = 0x4004667f;
1385-
pub const FIOASYNC: ::c_ulong = 0x8004667d;
1386-
pub const FIOSETOWN: ::c_ulong = 0x8004667c;
1387-
pub const FIOGETOWN: ::c_ulong = 0x4004667b;
13881383
pub const OFIOGETBMAP: ::c_ulong = 0xc004667a;
13891384
pub const FIOGETBMAP: ::c_ulong = 0xc008667a;
13901385
pub const FIONWRITE: ::c_ulong = 0x40046679;

src/unix/linux_like/android/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,7 @@ pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
785785
pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
786786

787787
pub const FIOCLEX: ::c_int = 0x5451;
788+
pub const FIONCLEX: ::c_int = 0x5450;
788789

789790
pub const SIGCHLD: ::c_int = 17;
790791
pub const SIGBUS: ::c_int = 7;

src/unix/linux_like/linux/gnu/b32/arm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ pub const SOCK_STREAM: ::c_int = 1;
322322
pub const SOCK_DGRAM: ::c_int = 2;
323323

324324
pub const FIOCLEX: ::c_ulong = 0x5451;
325+
pub const FIONCLEX: ::c_ulong = 0x5450;
325326
pub const FIONBIO: ::c_ulong = 0x5421;
326327

327328
pub const MCL_CURRENT: ::c_int = 0x0001;

src/unix/linux_like/linux/gnu/b32/mips.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,7 @@ pub const SO_ATTACH_BPF: ::c_int = 50;
698698
pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER;
699699

700700
pub const FIOCLEX: ::c_ulong = 0x6601;
701+
pub const FIONCLEX: ::c_ulong = 0x6602;
701702
pub const FIONBIO: ::c_ulong = 0x667e;
702703

703704
pub const SA_SIGINFO: ::c_int = 0x00000008;

src/unix/linux_like/linux/gnu/b32/powerpc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ pub const SOCK_STREAM: ::c_int = 1;
324324
pub const SOCK_DGRAM: ::c_int = 2;
325325

326326
pub const FIOCLEX: ::c_ulong = 0x20006601;
327+
pub const FIONCLEX: ::c_ulong = 0x20006602;
327328
pub const FIONBIO: ::c_ulong = 0x8004667e;
328329

329330
pub const MCL_CURRENT: ::c_int = 0x2000;

src/unix/linux_like/linux/gnu/b32/x86.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ pub const F_GETOWN: ::c_int = 9;
529529
pub const F_SETOWN: ::c_int = 8;
530530

531531
pub const FIOCLEX: ::c_ulong = 0x5451;
532+
pub const FIONCLEX: ::c_ulong = 0x5450;
532533
pub const FIONBIO: ::c_ulong = 0x5421;
533534

534535
pub const PTRACE_GETFPXREGS: ::c_uint = 18;

0 commit comments

Comments
 (0)