diff options
author | bors <bors@rust-lang.org> | 2018-06-27 23:08:59 +0000 |
---|---|---|
committer | bors <bors@rust-lang.org> | 2018-06-27 23:08:59 +0000 |
commit | 23578141f29c8488ab5092b50d4c264e3debdb4c (patch) | |
tree | ff87ab01060ef8e56f145c4115d34a0cca8620b5 | |
parent | 4bd52f5e3ef5d6c8abdd1fbaf7c9975800a0dc93 (diff) | |
parent | 843388ac7dad39243927e8c24bac74a238f2682f (diff) | |
download | rust-libc-23578141f29c8488ab5092b50d4c264e3debdb4c.tar.gz |
Auto merge of #1016 - debris:fs-swap-api, r=alexcrichton
added renamex_np, renameatx_np
these function can be used to atomically swap files
- added 2 macos specific functions - `renamex_np` and `renameatx_np` and two constants `RENAME_SWAP` and `RENAME_EXCL`
- [macos stdio.h](https://github.com/apple/darwin-xnu/blob/0ddccd8/bsd/sys/stdio.h#L45-L48)
- [docs](http://www.manpagez.com/man/2/renameatx_np/osx-10.12.3.php)
- ~added linux specific `renameat2`. according to the [docs](http://man7.org/linux/man-pages/man2/rename.2.html#VERSIONS) it was added to Linux in kernel 3.15.~
-rw-r--r-- | src/unix/bsd/apple/mod.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 30e4c129eb..fdc8daba26 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -1867,6 +1867,9 @@ pub const NI_MAXHOST: ::socklen_t = 1025; pub const Q_GETQUOTA: ::c_int = 0x300; pub const Q_SETQUOTA: ::c_int = 0x400; +pub const RENAME_SWAP: ::c_uint = 0x00000002; +pub const RENAME_EXCL: ::c_uint = 0x00000004; + pub const RTLD_LOCAL: ::c_int = 0x4; pub const RTLD_FIRST: ::c_int = 0x100; pub const RTLD_NODELETE: ::c_int = 0x80; @@ -2459,6 +2462,11 @@ extern { size: ::size_t, flags: ::c_int) -> ::ssize_t; pub fn removexattr(path: *const ::c_char, name: *const ::c_char, flags: ::c_int) -> ::c_int; + pub fn renamex_np(from: *const ::c_char, to: *const ::c_char, + flags: ::c_uint) -> ::c_int; + pub fn renameatx_np(fromfd: ::c_int, from: *const ::c_char, + tofd: ::c_int, to: *const ::c_char, + flags: ::c_uint) -> ::c_int; pub fn fremovexattr(filedes: ::c_int, name: *const ::c_char, flags: ::c_int) -> ::c_int; |