RTEMS Logo

RTEMS 4.6.4 On-Line Library


Configuration Space Manager cfg_chown - Changes the owner and/or group of a file.

PREV UP next Bookshelf New Chapters

3.4.16: cfg_chown - Changes the owner and/or group of a file.

CALLING SEQUENCE:

#include <sys/types.h>
#include <unistd.h>

int cfg_chown(
  const char *path,
  uid_t       owner,
  gid_t       group
);

STATUS CODES:

A successful call to cfg_chown() returns a value of zero and an unsuccessful call returns the errno.

EACCES
Search permission is denied for a directory in a file's path prefix
EINVAL
Invalid argument
ENAMETOOLONG
Length of a filename string exceeds PATH_MAX and _POSIX_NO_TRUNC is in effect.
ENOENT
A file or directory does not exist.
ENOTDIR
A component of the specified pathname was not a directory when a directory was expected.
EPERM
Operation is not permitted. Process does not have the appropriate priviledges or permissions to perform the requested operations.
EROFS
Read-only file system.

DESCRIPTION:

The user ID and group ID of the file named by path are set to owner and path, respectively.

For regular files, the set group ID (S_ISGID) and set user ID (S_ISUID) bits are cleared.

Some systems consider it a security violation to allow the owner of a file to be changed, If users are billed for disk space usage, loaning a file to another user could result in incorrect billing. The cfg_chown() function may be restricted to privileged users for some or all files. The group ID can still be changed to one of the supplementary group IDs.

NOTES:

This function may be restricted for some file. The pathconf function can be used to test the _PC_CHOWN_RESTRICTED flag.


PREV UP next Bookshelf New Chapters

Copyright © 1988-2004 OAR Corporation