Skip to content

Commit 7df3af3

Browse files
committed
Merge branch 'master' of https://github.com/rust-lang/libc into emscripten
Conflicts: Cargo.lock src/unix/notbsd/linux/mips/mod.rs
2 parents f22bfe3 + 299e3f6 commit 7df3af3

File tree

15 files changed

+146
-123
lines changed

15 files changed

+146
-123
lines changed

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "libc"
4-
version = "0.2.23"
4+
version = "0.2.24"
55
authors = ["The Rust Project Developers"]
66
license = "MIT/Apache-2.0"
77
readme = "README.md"

src/unix/bsd/apple/mod.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -448,14 +448,8 @@ pub const _PC_PIPE_BUF: ::c_int = 6;
448448
pub const _PC_CHOWN_RESTRICTED: ::c_int = 7;
449449
pub const _PC_NO_TRUNC: ::c_int = 8;
450450
pub const _PC_VDISABLE: ::c_int = 9;
451-
pub const O_RDONLY: ::c_int = 0;
452-
pub const O_WRONLY: ::c_int = 1;
453-
pub const O_RDWR: ::c_int = 2;
454-
pub const O_APPEND: ::c_int = 8;
455-
pub const O_CREAT: ::c_int = 512;
456-
pub const O_EXCL: ::c_int = 2048;
457-
pub const O_NOCTTY: ::c_int = 131072;
458-
pub const O_TRUNC: ::c_int = 1024;
451+
pub const O_DSYNC: ::c_int = 0x400000;
452+
pub const O_NOCTTY: ::c_int = 0x20000;
459453
pub const O_CLOEXEC: ::c_int = 0x1000000;
460454
pub const O_DIRECTORY: ::c_int = 0x100000;
461455
pub const S_IFIFO: mode_t = 4096;
@@ -671,8 +665,6 @@ pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x0020;
671665
pub const AT_SYMLINK_FOLLOW: ::c_int = 0x0040;
672666
pub const AT_REMOVEDIR: ::c_int = 0x0080;
673667

674-
pub const O_ACCMODE: ::c_int = 3;
675-
676668
pub const TIOCMODG: ::c_ulong = 0x40047403;
677669
pub const TIOCMODS: ::c_ulong = 0x80047404;
678670
pub const TIOCM_LE: ::c_int = 0x1;
@@ -1024,10 +1016,6 @@ pub const LOCK_EX: ::c_int = 2;
10241016
pub const LOCK_NB: ::c_int = 4;
10251017
pub const LOCK_UN: ::c_int = 8;
10261018

1027-
pub const O_DSYNC: ::c_int = 4194304;
1028-
pub const O_SYNC: ::c_int = 128;
1029-
pub const O_NONBLOCK: ::c_int = 4;
1030-
10311019
pub const MAP_COPY: ::c_int = 0x0002;
10321020
pub const MAP_RENAME: ::c_int = 0x0020;
10331021
pub const MAP_NORESERVE: ::c_int = 0x0040;

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ pub const PTHREAD_STACK_MIN: ::size_t = 1024;
138138
pub const SIGSTKSZ: ::size_t = 40960;
139139
pub const MADV_INVAL: ::c_int = 10;
140140
pub const O_CLOEXEC: ::c_int = 0x00020000;
141+
pub const O_DIRECTORY: ::c_int = 0x08000000;
141142
pub const F_GETLK: ::c_int = 7;
142143
pub const F_SETLK: ::c_int = 8;
143144
pub const F_SETLKW: ::c_int = 9;
@@ -404,6 +405,13 @@ pub const TIOCMODG: ::c_uint = 0x40047403;
404405
pub const TIOCMODS: ::c_ulong = 0x80047404;
405406
pub const TIOCREMOTE: ::c_ulong = 0x80047469;
406407

408+
// Constants used by "at" family of system calls.
409+
pub const AT_FDCWD: ::c_int = 0xFFFAFDCD; // invalid file descriptor
410+
pub const AT_SYMLINK_NOFOLLOW: ::c_int = 1;
411+
pub const AT_REMOVEDIR: ::c_int = 2;
412+
pub const AT_EACCESS: ::c_int = 4;
413+
pub const AT_SYMLINK_FOLLOW: ::c_int = 8;
414+
407415
extern {
408416
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
409417
-> ::c_int;

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ pub const SF_NODISKIO: ::c_int = 0x00000001;
139139
pub const SF_MNOWAIT: ::c_int = 0x00000002;
140140
pub const SF_SYNC: ::c_int = 0x00000004;
141141
pub const O_CLOEXEC: ::c_int = 0x00100000;
142+
pub const O_DIRECTORY: ::c_int = 0x00020000;
143+
pub const O_EXEC: ::c_int = 0x00040000;
144+
pub const O_TTY_INIT: ::c_int = 0x00080000;
142145
pub const F_GETLK: ::c_int = 11;
143146
pub const F_SETLK: ::c_int = 12;
144147
pub const F_SETLKW: ::c_int = 13;
@@ -508,6 +511,12 @@ pub const P_ALL: idtype_t = 7;
508511
pub const B460800: ::speed_t = 460800;
509512
pub const B921600: ::speed_t = 921600;
510513

514+
pub const AT_FDCWD: ::c_int = -100;
515+
pub const AT_EACCESS: ::c_int = 0x100;
516+
pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
517+
pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
518+
pub const AT_REMOVEDIR: ::c_int = 0x800;
519+
511520
extern {
512521
pub fn __error() -> *mut ::c_int;
513522

src/unix/bsd/freebsdlike/mod.rs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -272,15 +272,9 @@ pub const FILENAME_MAX: ::c_uint = 1024;
272272
pub const L_tmpnam: ::c_uint = 1024;
273273
pub const TMP_MAX: ::c_uint = 308915776;
274274

275-
pub const O_RDONLY: ::c_int = 0;
276-
pub const O_WRONLY: ::c_int = 1;
277-
pub const O_RDWR: ::c_int = 2;
278-
pub const O_ACCMODE: ::c_int = 3;
279-
pub const O_APPEND: ::c_int = 8;
280-
pub const O_CREAT: ::c_int = 512;
281-
pub const O_EXCL: ::c_int = 2048;
282275
pub const O_NOCTTY: ::c_int = 32768;
283-
pub const O_TRUNC: ::c_int = 1024;
276+
pub const O_DIRECT: ::c_int = 0x00010000;
277+
284278
pub const S_IFIFO: mode_t = 4096;
285279
pub const S_IFCHR: mode_t = 8192;
286280
pub const S_IFBLK: mode_t = 24576;
@@ -452,11 +446,6 @@ pub const F_SETFD: ::c_int = 2;
452446
pub const F_GETFL: ::c_int = 3;
453447
pub const F_SETFL: ::c_int = 4;
454448

455-
pub const AT_EACCESS: ::c_int = 0x100;
456-
pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
457-
pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
458-
pub const AT_REMOVEDIR: ::c_int = 0x800;
459-
460449
pub const SIGTRAP: ::c_int = 5;
461450

462451
pub const GLOB_APPEND : ::c_int = 0x0001;
@@ -687,9 +676,6 @@ pub const LOCK_EX: ::c_int = 2;
687676
pub const LOCK_NB: ::c_int = 4;
688677
pub const LOCK_UN: ::c_int = 8;
689678

690-
pub const O_SYNC: ::c_int = 128;
691-
pub const O_NONBLOCK: ::c_int = 4;
692-
693679
pub const MAP_COPY: ::c_int = 0x0002;
694680
pub const MAP_RENAME: ::c_int = 0x0020;
695681
pub const MAP_NORESERVE: ::c_int = 0x0040;
@@ -876,8 +862,6 @@ pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
876862

877863
pub const CRTSCTS: ::tcflag_t = 0x00030000;
878864

879-
pub const AT_FDCWD: ::c_int = -100;
880-
881865
f! {
882866
pub fn WIFCONTINUED(status: ::c_int) -> bool {
883867
status == 0x13

src/unix/bsd/mod.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,22 @@ pub const ST_RDONLY: ::c_ulong = 1;
187187

188188
pub const NCCS: usize = 20;
189189

190+
pub const O_ACCMODE: ::c_int = 0x3;
191+
pub const O_RDONLY: ::c_int = 0;
192+
pub const O_WRONLY: ::c_int = 1;
193+
pub const O_RDWR: ::c_int = 2;
194+
pub const O_APPEND: ::c_int = 8;
195+
pub const O_CREAT: ::c_int = 512;
196+
pub const O_TRUNC: ::c_int = 1024;
197+
pub const O_EXCL: ::c_int = 2048;
190198
pub const O_ASYNC: ::c_int = 0x40;
191-
pub const O_FSYNC: ::c_int = 0x80;
192-
pub const O_NDELAY: ::c_int = 0x4;
199+
pub const O_SYNC: ::c_int = 0x80;
200+
pub const O_NONBLOCK: ::c_int = 0x4;
193201
pub const O_NOFOLLOW: ::c_int = 0x100;
202+
pub const O_SHLOCK: ::c_int = 0x10;
203+
pub const O_EXLOCK: ::c_int = 0x20;
204+
pub const O_FSYNC: ::c_int = O_SYNC;
205+
pub const O_NDELAY: ::c_int = O_NONBLOCK;
194206

195207
pub const F_GETOWN: ::c_int = 5;
196208
pub const F_SETOWN: ::c_int = 6;

src/unix/bsd/netbsdlike/mod.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,7 @@ pub const BUFSIZ : ::c_uint = 1024;
127127
pub const FOPEN_MAX : ::c_uint = 20;
128128
pub const FILENAME_MAX : ::c_uint = 1024;
129129
pub const L_tmpnam : ::c_uint = 1024;
130-
pub const O_RDONLY : ::c_int = 0;
131-
pub const O_WRONLY : ::c_int = 1;
132-
pub const O_RDWR : ::c_int = 2;
133-
pub const O_ACCMODE : ::c_int = 3;
134-
pub const O_APPEND : ::c_int = 8;
135-
pub const O_CREAT : ::c_int = 512;
136-
pub const O_EXCL : ::c_int = 2048;
137130
pub const O_NOCTTY : ::c_int = 32768;
138-
pub const O_TRUNC : ::c_int = 1024;
139-
pub const O_SYNC : ::c_int = 128;
140131
pub const S_IFIFO : mode_t = 4096;
141132
pub const S_IFCHR : mode_t = 8192;
142133
pub const S_IFBLK : mode_t = 24576;
@@ -478,8 +469,6 @@ pub const LOCK_EX: ::c_int = 2;
478469
pub const LOCK_NB: ::c_int = 4;
479470
pub const LOCK_UN: ::c_int = 8;
480471

481-
pub const O_NONBLOCK : ::c_int = 4;
482-
483472
pub const IPPROTO_RAW : ::c_int = 255;
484473

485474
pub const _SC_ARG_MAX : ::c_int = 1;

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,9 @@ pub const O_CLOEXEC: ::c_int = 0x400000;
270270
pub const O_ALT_IO: ::c_int = 0x40000;
271271
pub const O_NOSIGPIPE: ::c_int = 0x1000000;
272272
pub const O_SEARCH: ::c_int = 0x800000;
273-
pub const O_EXLOCK: ::c_int = 0x20;
274-
pub const O_SHLOCK: ::c_int = 0x10;
275273
pub const O_DIRECTORY: ::c_int = 0x200000;
274+
pub const O_DIRECT : ::c_int = 0x00080000;
275+
pub const O_RSYNC : ::c_int = 0x00020000;
276276

277277
pub const MS_SYNC : ::c_int = 0x4;
278278
pub const MS_INVALIDATE : ::c_int = 0x2;
@@ -644,6 +644,15 @@ pub const P_PGID: idtype_t = 4;
644644
pub const B460800: ::speed_t = 460800;
645645
pub const B921600: ::speed_t = 921600;
646646

647+
// dirfd() is a macro on netbsd to access
648+
// the first field of the struct where dirp points to:
649+
// http://cvsweb.netbsd.org/bsdweb.cgi/src/include/dirent.h?rev=1.36
650+
f! {
651+
pub fn dirfd(dirp: *mut ::DIR) -> ::c_int {
652+
unsafe { *(dirp as *const ::c_int) }
653+
}
654+
}
655+
647656
extern {
648657
pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
649658
pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use unix::bsd::O_SYNC;
2+
13
pub type clock_t = i64;
24
pub type suseconds_t = ::c_long;
35
pub type dev_t = i32;
@@ -140,6 +142,8 @@ pub const UT_LINESIZE: usize = 8;
140142
pub const UT_HOSTSIZE: usize = 256;
141143

142144
pub const O_CLOEXEC: ::c_int = 0x10000;
145+
pub const O_DIRECTORY: ::c_int = 0x20000;
146+
pub const O_RSYNC: ::c_int = O_SYNC;
143147

144148
pub const MS_SYNC : ::c_int = 0x0002;
145149
pub const MS_INVALIDATE : ::c_int = 0x0004;

0 commit comments

Comments
 (0)