@@ -20,25 +20,16 @@ mod ffi {
2020 pub const F_GET_SEALS : c_int = 1034 ;
2121}
2222
23- #[ cfg( not( any( target_os = "ios" , target_os = "macos" ) ) ) ]
2423libc_bitflags ! {
25- pub flags AtFlags : c_int {
26- AT_SYMLINK_NOFOLLOW ,
24+ pub struct AtFlags : c_int {
25+ AT_SYMLINK_NOFOLLOW ;
2726 #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
28- AT_NO_AUTOMOUNT ,
27+ AT_NO_AUTOMOUNT ;
2928 #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
30- AT_EMPTY_PATH
29+ AT_EMPTY_PATH ;
3130 }
3231}
3332
34- #[ cfg( any( target_os = "ios" , target_os = "macos" ) ) ]
35- bitflags ! (
36- pub struct AtFlags : c_int {
37- // hack because bitflags require one entry
38- const EMPTY = 0x0 ;
39- }
40- ) ;
41-
4233pub fn open < P : ?Sized + NixPath > ( path : & P , oflag : OFlag , mode : Mode ) -> Result < RawFd > {
4334 let fd = try!( path. with_nix_path ( |cstr| {
4435 unsafe { libc:: open ( cstr. as_ptr ( ) , oflag. bits ( ) , mode. bits ( ) as c_uint ) }
@@ -54,7 +45,7 @@ pub fn openat<P: ?Sized + NixPath>(dirfd: RawFd, path: &P, oflag: OFlag, mode: M
5445 Errno :: result ( fd)
5546}
5647
57- fn wrap_readlink_result < ' a > ( buffer : & ' a mut [ u8 ] , res : ssize_t )
48+ fn wrap_readlink_result < ' a > ( buffer : & ' a mut [ u8 ] , res : ssize_t )
5849 -> Result < & ' a OsStr > {
5950 match Errno :: result ( res) {
6051 Err ( err) => Err ( err) ,
@@ -204,11 +195,11 @@ mod consts {
204195 use libc:: { self , c_int, c_uint} ;
205196
206197 libc_bitflags ! {
207- pub flags SpliceFFlags : c_uint {
208- SPLICE_F_MOVE ,
209- SPLICE_F_NONBLOCK ,
210- SPLICE_F_MORE ,
211- SPLICE_F_GIFT ,
198+ pub struct SpliceFFlags : c_uint {
199+ SPLICE_F_MOVE ;
200+ SPLICE_F_NONBLOCK ;
201+ SPLICE_F_MORE ;
202+ SPLICE_F_GIFT ;
212203 }
213204 }
214205
@@ -239,8 +230,8 @@ mod consts {
239230 ) ;
240231
241232 libc_bitflags ! (
242- pub flags FdFlag : c_int {
243- FD_CLOEXEC
233+ pub struct FdFlag : c_int {
234+ FD_CLOEXEC ;
244235 }
245236 ) ;
246237
@@ -261,49 +252,49 @@ mod consts {
261252 use libc:: { self , c_int} ;
262253
263254 libc_bitflags ! (
264- pub flags OFlag : c_int {
265- O_ACCMODE ,
266- O_RDONLY ,
267- O_WRONLY ,
268- O_RDWR ,
269- O_NONBLOCK ,
270- O_APPEND ,
271- O_SHLOCK ,
272- O_EXLOCK ,
273- O_ASYNC ,
274- O_SYNC ,
275- O_NOFOLLOW ,
276- O_CREAT ,
277- O_TRUNC ,
278- O_EXCL ,
279- O_NOCTTY ,
280- O_DIRECTORY ,
281- O_CLOEXEC ,
282- O_FSYNC ,
283- O_NDELAY ,
255+ pub struct OFlag : c_int {
256+ O_ACCMODE ;
257+ O_RDONLY ;
258+ O_WRONLY ;
259+ O_RDWR ;
260+ O_NONBLOCK ;
261+ O_APPEND ;
262+ O_SHLOCK ;
263+ O_EXLOCK ;
264+ O_ASYNC ;
265+ O_SYNC ;
266+ O_NOFOLLOW ;
267+ O_CREAT ;
268+ O_TRUNC ;
269+ O_EXCL ;
270+ O_NOCTTY ;
271+ O_DIRECTORY ;
272+ O_CLOEXEC ;
273+ O_FSYNC ;
274+ O_NDELAY ;
284275 #[ cfg( any( target_os = "netbsd" , target_os = "openbsd" , target_os = "macos" ,
285276 target_os = "ios" ) ) ]
286- O_DSYNC ,
277+ O_DSYNC ;
287278 #[ cfg( any( target_os = "netbsd" , target_os = "dragonfly" , target_os = "freebsd" ) ) ]
288- O_DIRECT ,
279+ O_DIRECT ;
289280 #[ cfg( any( target_os = "netbsd" , target_os = "openbsd" ) ) ]
290- O_RSYNC ,
281+ O_RSYNC ;
291282 #[ cfg( target_os = "freebsd" ) ]
292- O_EXEC ,
283+ O_EXEC ;
293284 #[ cfg( target_os = "freebsd" ) ]
294- O_TTY_INIT ,
285+ O_TTY_INIT ;
295286 #[ cfg( target_os = "netbsd" ) ]
296- O_ALT_IO ,
287+ O_ALT_IO ;
297288 #[ cfg( target_os = "netbsd" ) ]
298- O_NOSIGPIPE ,
289+ O_NOSIGPIPE ;
299290 #[ cfg( target_os = "netbsd" ) ]
300- O_SEARCH ,
291+ O_SEARCH ;
301292 }
302293 ) ;
303294
304295 libc_bitflags ! (
305- pub flags FdFlag : c_int {
306- FD_CLOEXEC
296+ pub struct FdFlag : c_int {
297+ FD_CLOEXEC ;
307298 }
308299 ) ;
309300}
0 commit comments