setmode

Langue: en

Autres versions - même langue

Version: 348553 (ubuntu - 24/10/10)

Section: 3 (Bibliothèques de fonctions)


BSD mandoc

NAME

getmode setmode - modify mode bits

LIBRARY

Lb libbsd

SYNOPSIS

In unistd.h Ft mode_t Fn getmode const void *set mode_t mode Ft void * Fn setmode const char *mode_str

DESCRIPTION

The Fn getmode function returns a copy of the file permission bits Fa mode as altered by the values pointed to by Fa set . While only the mode bits are altered, other parts of the file mode may be examined.

The Fn setmode function takes an absolute (octal) or symbolic value, as described in chmod(1), as an argument and returns a pointer to mode values to be supplied to Fn getmode . Because some of the symbolic values are relative to the file creation mask, Fn setmode may call umask(2). If this occurs, the file creation mask will be restored before Fn setmode returns. If the calling program changes the value of its file creation mask after calling Fn setmode , Fn setmode must be called again if Fn getmode is to modify future file modes correctly.

If the mode passed to Fn setmode is invalid or if memory cannot be allocated for the return value, Fn setmode returns NULL

The value returned from Fn setmode is obtained from Fn malloc and should be returned to the system with Fn free when the program is done with it, generally after a call to Fn getmode .

ERRORS

The Fn setmode function may fail and set errno for any of the errors specified for the library routine malloc(3).

SEE ALSO

chmod(1), stat(2), umask(2), malloc(3)

HISTORY

The Fn getmode and Fn setmode functions first appeared in BSD 4.4