mod.rs 927 B

1234567891011121314151617181920212223242526272829303132
  1. //! fcntl implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/fcntl.h.html
  2. use crate::unix::c_str::CStr;
  3. pub use self::platform::*;
  4. use crate::unix::platform;
  5. #[no_mangle]
  6. pub unsafe extern "C" fn creat(path: *const ::c_char, mode: ::mode_t) -> ::c_int {
  7. sys_open(path, O_WRONLY | O_CREAT | O_TRUNC, mode)
  8. }
  9. #[repr(C)]
  10. #[derive(Copy,Clone)]
  11. pub struct flock {
  12. pub l_type: ::c_short,
  13. pub l_whence: ::c_short,
  14. pub l_start: ::off_t,
  15. pub l_len: ::off_t,
  16. pub l_pid: ::pid_t,
  17. }
  18. #[no_mangle]
  19. pub extern "C" fn sys_fcntl(fildes: ::c_int, cmd: ::c_int, arg: ::c_int) -> ::c_int {
  20. platform::pal::fcntl(fildes, cmd, arg)
  21. }
  22. #[no_mangle]
  23. pub unsafe extern "C" fn sys_open(path: *const ::c_char, oflag: ::c_int, mode: ::mode_t) -> ::c_int {
  24. platform::pal::open(path, oflag, mode)
  25. }
  26. #[no_mangle]
  27. pub unsafe extern "C" fn cbindgen_stupid_struct_user_for_fcntl(a: flock) {}