|
| 1 | +-module(linux). |
| 2 | + |
| 3 | +-compile(export_all). |
| 4 | + |
| 5 | +sys_unshare() -> % kernel/fork.c |
| 6 | + 272. |
| 7 | + |
| 8 | + |
| 9 | +%% linux/sched.h |
| 10 | +clone_vm() -> hex_to_int(<<"0x00000100">>). % set if VM shared between processes |
| 11 | +clone_fs() -> hex_to_int(<<"0x00000200">>). % set if fs info shared between processes |
| 12 | +clone_files() -> hex_to_int(<<"0x00000400">>). % set if open files shared between processes |
| 13 | +clone_sighand() -> hex_to_int(<<"0x00000800">>). % set if signal handlers and blocked signals shared |
| 14 | +clone_ptrace() -> hex_to_int(<<"0x00002000">>). % set if we want to let tracing continue on the child too |
| 15 | +clone_vfork() -> hex_to_int(<<"0x00004000">>). % set if the parent wants the child to wake it up on mm_release |
| 16 | +clone_parent() -> hex_to_int(<<"0x00008000">>). % set if we want to have the same parent as the cloner |
| 17 | +clone_thread() -> hex_to_int(<<"0x00010000">>). % Same thread group? |
| 18 | +clone_newns() -> hex_to_int(<<"0x00020000">>). % New mount namespace group |
| 19 | +clone_sysvsem() -> hex_to_int(<<"0x00040000">>). % share system V SEM_UNDO semantics |
| 20 | +clone_settls() -> hex_to_int(<<"0x00080000">>). % create a new TLS for the child |
| 21 | +clone_parent_settid() -> hex_to_int(<<"0x00100000">>). % set the TID in the parent |
| 22 | +clone_child_cleartid() -> hex_to_int(<<"0x00200000">>). % clear the TID in the child |
| 23 | +clone_detached() -> hex_to_int(<<"0x00400000">>). % Unused, ignored |
| 24 | +clone_untraced() -> hex_to_int(<<"0x00800000">>). % set if the tracing process can't force CLONE_PTRACE on this clone |
| 25 | +clone_child_settid() -> hex_to_int(<<"0x01000000">>). % set the TID in the child |
| 26 | +clone_newcgroup() -> hex_to_int(<<"0x02000000">>). % New cgroup namespace |
| 27 | +clone_newuts() -> hex_to_int(<<"0x04000000">>). % New utsname namespace |
| 28 | +clone_newipc() -> hex_to_int(<<"0x08000000">>). % New ipc namespace |
| 29 | +clone_newuser() -> hex_to_int(<<"0x10000000">>). % New user namespace |
| 30 | +clone_newpid() -> hex_to_int(<<"0x20000000">>). % New pid namespace |
| 31 | +clone_newnet() -> hex_to_int(<<"0x40000000">>). % New network namespace |
| 32 | +clone_io() -> hex_to_int(<<"0x80000000">>). % Clone io context |
| 33 | + |
| 34 | + |
| 35 | +%% linux/fs.h |
| 36 | +ms_rdonly() -> 1. % Mount read-only |
| 37 | +ms_nosuid() -> 2. % Ignore suid and sgid bits |
| 38 | +ms_nodev() -> 4. % Disallow access to device special files |
| 39 | +ms_noexec() -> 8. % Disallow program execution |
| 40 | +ms_synchronous() -> 16. % Writes are synced at once |
| 41 | +ms_remount() -> 32. % Alter flags of a mounted FS |
| 42 | +ms_mandlock() -> 64. % Allow mandatory locks on an FS |
| 43 | +ms_dirsync() -> 128. % Directory modifications are synchronous |
| 44 | +ms_noatime() -> 1024.% Do not update access times. |
| 45 | +ms_nodiratime() -> 2048.% Do not update directory access times |
| 46 | +ms_bind() -> 4096. |
| 47 | +ms_move() -> 8192. |
| 48 | +ms_rec() -> 16384. |
| 49 | +ms_silent() -> 32768. |
| 50 | +ms_posixacl() -> (1 bsl 16). % VFS does not apply the umask |
| 51 | +ms_unbindable() -> (1 bsl 17). % change to unbindable |
| 52 | +ms_private() -> (1 bsl 18). % change to private |
| 53 | +ms_strictatime() -> (1 bsl 24). % Always perform atime updates |
| 54 | +ms_mgc_val() -> hex_to_int(<<"0xC0ED0000">>).% Old magic mount flag |
| 55 | + |
| 56 | +mnt_force() -> hex_to_int(<<"0x00000001">>).% Attempt to forcibily umount |
| 57 | +mnt_detach() -> hex_to_int(<<"0x00000002">>).% Just detach from the tree |
| 58 | +mnt_expire() -> hex_to_int(<<"0x00000004">>).% Mark for expiry |
| 59 | +umount_nofollow() -> hex_to_int(<<"0x00000008">>).% Don't follow symlink on umount |
| 60 | +umount_unused() -> hex_to_int(<<"0x80000000">>).% Flag guaranteed to be unused |
| 61 | + |
| 62 | +hex_to_int(Hex) -> |
| 63 | + erlang:binary_to_integer(erlang:list_to_binary(lists:subtract(erlang:binary_to_list(Hex),"0x")), 16). |
0 commit comments