From 8cbe3acdb2357e42adf9727a7c381d73f3d6972d Mon Sep 17 00:00:00 2001 From: yjhmelody Date: Sun, 11 Aug 2019 00:24:20 +0800 Subject: [PATCH] Add unix constant for os module --- vm/src/stdlib/os.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/vm/src/stdlib/os.rs b/vm/src/stdlib/os.rs index bb8bdec660..ca52a633bb 100644 --- a/vm/src/stdlib/os.rs +++ b/vm/src/stdlib/os.rs @@ -1051,6 +1051,18 @@ fn extend_module_platform_specific(vm: &VirtualMachine, module: PyObjectRef) -> "setgid" => ctx.new_rustfunc(os_setgid), "setpgid" => ctx.new_rustfunc(os_setpgid), "setuid" => ctx.new_rustfunc(os_setuid), + "O_DSYNC" => ctx.new_int(4096), + "O_RSYNC" => ctx.new_int(1_052_672), + "O_NDELAY" => ctx.new_int(0o0_004_000), + "O_NONBLOCK" => ctx.new_int(0o0_004_000), + "O_NOCTTY" => ctx.new_int(0o0_000_400), + "O_CLOEXEC" => ctx.new_int(0o2_000_000), + "POSIX_FADV_NORMAL" => ctx.new_int(0), + "POSIX_FADV_RANDOM" => ctx.new_int(1), + "POSIX_FADV_SEQUENTIAL" => ctx.new_int(2), + "POSIX_FADV_WILLNEED" => ctx.new_int(3), + "POSIX_FADV_DONTNEED" => ctx.new_int(4), + "POSIX_FADV_NOREUSE" => ctx.new_int(5), }); #[cfg(not(target_os = "redox"))]