1*61186Sbostic.\" Copyright (c) 1980, 1991, 1993 2*61186Sbostic.\" The Regents of the University of California. All rights reserved. 320050Smckusick.\" 447208Scael.\" %sccs.include.redist.man% 520050Smckusick.\" 6*61186Sbostic.\" @(#)umask.2 8.1 (Berkeley) 06/04/93 747208Scael.\" 847208Scael.Dd 947208Scael.Dt UMASK 2 1047208Scael.Os BSD 4 1147208Scael.Sh NAME 1247208Scael.Nm umask 1347208Scael.Nd set file creation mode mask 1447208Scael.Sh SYNOPSIS 1547208Scael.Fd #include <sys/stat.h> 1647208Scael.Ft mode_t 1747208Scael.Fn umask "mode_t numask" 1847208Scael.Sh DESCRIPTION 1947208ScaelThe 2047208Scael.Fn umask 2147208Scaelroutine sets the process's file mode creation mask to 2247208Scael.Fa numask 2347208Scaeland returns the previous value of the mask. The 9 low-order 2447208Scaelaccess permission 2547208Scaelbits of 2647208Scael.Fa numask 2747208Scaelare used by system calls, including 2847208Scael.Xr open 2 , 2947208Scael.Xr mkdir 2 , 3047208Scaeland 3147208Scael.Xr mkfifo 2 , 3247208Scaelto turn off corresponding bits 3347208Scaelrequested in file mode. 3453132Sbostic(See 3547208Scael.Xr chmod 2 ) . 3620051SmckusickThis clearing allows each user to restrict the default access 3720051Smckusickto his files. 3847208Scael.Pp 3953132SbosticThe default mask value is S_IWGRP|S_IWOTH (022, write access for the 4053132Sbosticowner only). 4147208ScaelChild processes inherit the mask of the calling process. 4247208Scael.Sh RETURN VALUES 4320051SmckusickThe previous value of the file mode mask is returned by the call. 4447208Scael.Sh ERRORS 4547208ScaelThe 4647208Scael.Fn umask 4747208Scaelfunction is always successful. 4847208Scael.Sh SEE ALSO 4947208Scael.Xr chmod 2 , 5047208Scael.Xr mknod 2 , 5147208Scael.Xr open 2 5247208Scael.Sh STANDARDS 5347208ScaelThe 5447208Scael.Fn umask 5553132Sbosticfunction call is expected to conform to IEEE Std 1003.1-1988 5647208Scael.Pq Dq Tn POSIX . 57