Skip to content

Commit 64a3be5

Browse files
committed
Add some platform-dependent constants to fcntl
1 parent bfb5e93 commit 64a3be5

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

stdlib/src/fcntl.rs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ mod fcntl {
99
PyResult, VirtualMachine,
1010
};
1111

12+
// TODO: supply these from <asm-generic/fnctl.h> (please file an issue/PR upstream):
13+
// LOCK_MAND, LOCK_READ, LOCK_WRITE, LOCK_RW, F_GETSIG, F_SETSIG, F_GETLK64, F_SETLK64,
14+
// F_SETLKW64, FASYNC, F_EXLCK, F_SHLCK, DN_ACCESS, DN_MODIFY, DN_CREATE, DN_DELETE,
15+
// DN_RENAME, DN_ATTRIB, DN_MULTISHOT
16+
// NOTE: these are/were from <stropts.h>, which may not be present on systems nowadays:
17+
// I_PUSH, I_POP, I_LOOK, I_FLUSH, I_FLUSHBAND, I_SETSIG, I_GETSIG, I_FIND, I_PEEK,
18+
// I_SRDOPT, I_GRDOPT, I_NREAD, I_FDINSERT, I_STR, I_SWROPT, I_GWROPT, I_SENDFD,
19+
// I_RECVFD, I_LIST, I_ATMARK, I_CKBAND, I_GETBAND, I_CANPUT, I_SETCLTIME, I_GETCLTIME,
20+
// I_LINK, I_UNLINK, I_PLINK, I_PUNLINK
21+
1222
#[pyattr]
1323
use libc::{FD_CLOEXEC, F_GETFD, F_GETFL, F_SETFD, F_SETFL};
1424

@@ -22,12 +32,27 @@ mod fcntl {
2232

2333
#[cfg(target_vendor = "apple")]
2434
#[pyattr]
25-
use libc::F_NOCACHE;
35+
use libc::{F_FULLFSYNC, F_NOCACHE};
2636

2737
#[cfg(target_os = "freebsd")]
2838
#[pyattr]
2939
use libc::{F_DUP2FD, F_DUP2FD_CLOEXEC};
3040

41+
#[cfg(any(target_os = "android", target_os = "linux"))]
42+
#[pyattr]
43+
use libc::{F_OFD_GETLK, F_OFD_SETLK, F_OFD_SETLKW};
44+
45+
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
46+
#[pyattr]
47+
use libc::{
48+
F_ADD_SEALS, F_GETLEASE, F_GETPIPE_SZ, F_GET_SEALS, F_NOTIFY, F_SEAL_GROW, F_SEAL_SEAL,
49+
F_SEAL_SHRINK, F_SEAL_WRITE, F_SETLEASE, F_SETPIPE_SZ,
50+
};
51+
52+
#[cfg(any(target_os = "dragonfly", target_os = "netbsd", target_vendor = "apple"))]
53+
#[pyattr]
54+
use libc::F_GETPATH;
55+
3156
#[pyfunction]
3257
fn fcntl(
3358
io::Fildes(fd): io::Fildes,

0 commit comments

Comments
 (0)