sys_umask  [kernel/sys.c]


Sets the calling process's file mode creation mask.

The 9 low-order access permission bits of this mask are used by system calls, including sys_open, sys_mkdir, and sys_mknod to turn off corresponding bits requested in file mode. This clearing allows each user to restrict the default access to his files.

Arguments

eax 60
ebx New file creation mask. It may be constrcuted from any of the following values:
S_ISUID  - set user ID on execution
S_ISGID  - set group ID on execution
S_ISVTX  - on directories, restricted deletion flag
S_IRWXU  - owner has read, write and execute permission
S_IRUSR  - owner has read permission
S_IWUSR  - owner has write permission
S_IXUSR  - owner has execute permission
S_IRWXG  - group has read, write and execute permission
S_IRGRP  - group has read permission
S_IWGRP  - group has write permission
S_IXGRP  - group has execute permission
S_IRWXO  - others have read, write and execute permission
S_IROTH  - others have read permission
S_IWOTH  - others have write permission
S_IXOTH  - others have execute permission

For example if 'S_IWGRP or S_IWOTH' (default file creation mask value) is set for file creation mask and sys_open tries to create a new file using 'S_IRUSR or S_IWUSR or S_IRGRP or S_IWRGRP or S_IROTH or S_IWOTH' permissions. The resulting file will have 'S_IRUSR or S_IWUSR or S_IRGRP or S_IROTH' permissions:

S_IRUSR or S_IWUSR or S_IRGRP or S_IWRGRP or S_IROTH or S_IWOTH = 666o; i.e. -rw-rw-rw-
S_IWGRP or S_IWOTH = 22o; i.e. -----w--w-

Will result in,
666o and (not 22o) = 644o; i.e., -rw-r--r--

Return values

This system call always succeeds and the previous value of the mask is returned.

Remarks

Child process created via sys_fork inherits its parent's file creation mask . The file creation mask is left unchanged by sys_execve.

Compatibility

n/a