Skip to content

Commit 73fff21

Browse files
committed
Unify BSD consts
1 parent dbeda43 commit 73fff21

File tree

1 file changed

+16
-145
lines changed

1 file changed

+16
-145
lines changed

src/fcntl.rs

Lines changed: 16 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -255,111 +255,7 @@ mod consts {
255255

256256
}
257257

258-
#[cfg(any(target_os = "macos", target_os = "ios"))]
259-
mod consts {
260-
use libc::{self, c_int};
261-
262-
libc_bitflags!(
263-
pub flags OFlag: c_int {
264-
O_ACCMODE,
265-
O_RDONLY,
266-
O_WRONLY,
267-
O_RDWR,
268-
O_CREAT,
269-
O_EXCL,
270-
O_NOCTTY,
271-
O_TRUNC,
272-
O_APPEND,
273-
O_NONBLOCK,
274-
O_DSYNC,
275-
O_DIRECTORY,
276-
O_NOFOLLOW,
277-
O_CLOEXEC,
278-
O_SYNC,
279-
O_NDELAY,
280-
O_FSYNC,
281-
}
282-
);
283-
284-
libc_bitflags!(
285-
pub flags FdFlag: c_int {
286-
FD_CLOEXEC
287-
}
288-
);
289-
}
290-
291-
#[cfg(target_os = "freebsd")]
292-
mod consts {
293-
use libc::{self, c_int};
294-
295-
libc_bitflags!(
296-
pub flags OFlag: c_int {
297-
O_ACCMODE,
298-
O_RDONLY,
299-
O_WRONLY,
300-
O_RDWR,
301-
O_CREAT,
302-
O_EXCL,
303-
O_NOCTTY,
304-
O_TRUNC,
305-
O_APPEND,
306-
O_NONBLOCK,
307-
O_DIRECTORY,
308-
O_NOFOLLOW,
309-
O_CLOEXEC,
310-
O_SYNC,
311-
O_NDELAY,
312-
O_FSYNC,
313-
O_SHLOCK,
314-
O_EXLOCK,
315-
O_DIRECT,
316-
O_EXEC,
317-
O_TTY_INIT,
318-
}
319-
);
320-
321-
libc_bitflags!(
322-
pub flags FdFlag: c_int {
323-
FD_CLOEXEC
324-
}
325-
);
326-
}
327-
328-
#[cfg(target_os = "openbsd")]
329-
mod consts {
330-
use libc::{self, c_int};
331-
332-
libc_bitflags!(
333-
pub flags OFlag: c_int {
334-
O_ACCMODE,
335-
O_RDONLY,
336-
O_WRONLY,
337-
O_RDWR,
338-
O_CREAT,
339-
O_EXCL,
340-
O_NOCTTY,
341-
O_TRUNC,
342-
O_APPEND,
343-
O_NONBLOCK,
344-
O_DIRECTORY,
345-
O_NOFOLLOW,
346-
O_CLOEXEC,
347-
O_SYNC,
348-
O_NDELAY,
349-
O_FSYNC,
350-
O_SHLOCK,
351-
O_EXLOCK,
352-
}
353-
);
354-
355-
libc_bitflags!(
356-
pub flags FdFlag: c_int {
357-
FD_CLOEXEC
358-
}
359-
);
360-
}
361-
362-
#[cfg(target_os = "netbsd")]
258+
#[cfg(any(target_os = "netbsd", target_os = "dragonfly", target_os = "openbsd", target_os = "freebsd", target_os = "macos", target_os = "ios"))]
363259
mod consts {
364260
use libc::{self,c_int};
365261

@@ -380,51 +276,26 @@ mod consts {
380276
O_TRUNC,
381277
O_EXCL,
382278
O_NOCTTY,
383-
O_DSYNC,
384-
O_RSYNC,
385-
O_ALT_IO,
386-
O_DIRECT,
387-
O_NOSIGPIPE,
388279
O_DIRECTORY,
389280
O_CLOEXEC,
390-
O_SEARCH,
391281
O_FSYNC,
392282
O_NDELAY,
393-
}
394-
);
395-
396-
libc_bitflags!(
397-
pub flags FdFlag: c_int {
398-
FD_CLOEXEC
399-
}
400-
);
401-
}
402-
403-
#[cfg(target_os = "dragonfly")]
404-
mod consts {
405-
use libc::c_int;
406-
407-
libc_bitflags!(
408-
pub flags OFlag: c_int {
409-
O_ACCMODE,
410-
O_RDONLY,
411-
O_WRONLY,
412-
O_RDWR,
413-
O_CREAT,
414-
O_EXCL,
415-
O_NOCTTY,
416-
O_TRUNC,
417-
O_APPEND,
418-
O_NONBLOCK,
419-
O_DIRECTORY,
420-
O_NOFOLLOW,
421-
O_CLOEXEC,
422-
O_SYNC,
423-
O_NDELAY,
424-
O_FSYNC,
425-
O_SHLOCK,
426-
O_EXLOCK,
283+
#[cfg(any(target_os = "netbsd", target_os = "openbsd", target_os = "macos", target_os = "ios"))]
284+
O_DSYNC,
285+
#[cfg(any(target_os = "netbsd", target_os = "dragonfly", target_os = "freebsd"))]
427286
O_DIRECT,
287+
#[cfg(any(target_os = "netbsd", target_os = "openbsd"))]
288+
O_RSYNC,
289+
#[cfg(target_os = "freebsd")]
290+
O_EXEC,
291+
#[cfg(target_os = "freebsd")]
292+
O_TTY_INIT,
293+
#[cfg(target_os = "netbsd")]
294+
O_ALT_IO,
295+
#[cfg(target_os = "netbsd")]
296+
O_NOSIGPIPE,
297+
#[cfg(target_os = "netbsd")]
298+
O_SEARCH,
428299
}
429300
);
430301

0 commit comments

Comments
 (0)