SETMODE

Section: C Library Functions (3)
Index Return to Main Contents

BSD mandoc
 

NAME

getmode setmode - modify mode bits  

SYNOPSIS

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, Fn setmode returns NULL .  

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 are Ud .


 

Index

NAME
SYNOPSIS
DESCRIPTION
ERRORS
SEE ALSO
HISTORY

This document was created by man2html, using the manual pages.
Time: 06:42:12 GMT, May 19, 2025