INtime SDK Help
chmod

Changes a file's permission mode. The permission mode controls file ownership and access rights.

#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <io.h>

int chmod (const char *filename, mode_t pmode);

Parameters

filename
Pathname of existing file.
pmode
New permission mode for file.

Remarks

pmode contains one or more of the manifest constants defined in SYS/STAT.H. The meaning of pmode is:

Value Description
S_IRGRP
S_IROTH
S_IRUSR
S_IRWXG
S_IRWXO
S_IRWXU
S_ISGID
S_ISUID
S_IWGRP
S_IWOTH
S_IWUSR
S_IXGRP
S_IXOTH
S_IXUSR
Read permission bit for POSIX file group
Read permission bit for POSIX World owner
Read permission bit for POSIX file owner
Mask for POSIX file group
Mask for POSIX World (other) owner
Mask for POSIX file owner
Set group ID on execution
Set user ID on execution
Write permission bit for POSIX file group
Write permission bit for POSIX World owner
Write permission bit for POSIX file owner
Execute or search permission bit for POSIX file group
Execute or search permission bit for POSIX World owner
Execute or search permission bit for POSIX file owner

Join more than one constant with the bitwise-OR operator (|).


This function translates POSIX file ownership rights this way:

POSIX Owner Real-time Owner
Owner
Group
World (other)
Owner 1 (first accessor)
Owner 2 (second accessor)
World

This function also translates POSIX access rights to the real-time OS equivalent this way:

POSIX Access Rights RT Access Rights
Owner
Group
World (other)
Read
Delete, Append, and Update
Ignored (no real-time OS equivalent)

Return Values

0 (zero).
Success.
-1; the function sets errno to ENOENT, indicating that the specified file could not be found.
Failure.

Requirements

Versions Defined in Include Link to
INtime 3.0 intime/rt/include/io.h sys/types.h
sys/stat.h
errno.h
io.h
clib.lib

See Also

creat