SYNOPSIS
#include <sys/types.h>
#include <unistd.h>
int chown(const char *pathname, uid_t owner, gid_t group);
int fchown(int fildes, uid_t owner, gid_t group);
int lchown(const char *pathname, uid_t owner, gid_t group);
DESCRIPTION
The
The
The
When successfully completed, these functions mark the st_ctime field of the file for update.
If the owner or group is specified as (uid_t)-1 or (gid_t)-1 respectively, the corresponding ID of the file is unchanged.
PARAMETERS
- pathname
-
Points to the path name of the file to modify.
- fildes
-
Is the file descriptor of an open file.
- owner
-
Is the new user ID for the file.
- group
-
Is the new group ID for the file.
RETURN VALUES
If successful,
- EACCES
-
Search permission is denied on a component of the path name prefix of pathname.
- EBADF
-
fildes is not a valid file descriptor.
- EFAULT
-
pathname points outside the allocated address space of the process.
- EINTR
-
A signal interrupted the call.
- EINVAL
-
group or owner is invalid.
- EIO
-
An I/O error occurred while reading from or writing to the file system.
- ENAMETOOLONG
-
The length of pathname exceeds PATH_MAX or a path name component is longer than NAME_MAX while _POSIX_NO_TRUNC is in effect.
- ENOENT
-
Either a component of the pathname prefix or the file that pathname refers to does not exist or is a null path name.
- ENOTDIR
-
A component of the path name prefix of pathname refers is not a directory.
- EPERM
-
The effective user ID does not match the owner of the file or the calling process does not have appropriate privileges.
CONFORMANCE
MULTITHREAD SAFETY LEVEL
PORTING ISSUES
There are differences in how the NuTCRACKER Platform handles file ownership, compared to the referenced standard. Refer to the struct stat page, to File Management in the Windows Concepts chapter of the PTC MKS Toolkit UNIX to Windows Porting Guide, and also Security in the API-Specific Porting Issues chapter of the PTC MKS Toolkit UNIX to Windows Porting Guide.
Windows does not currently support symbolic links, so
AVAILABILITY
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- Miscellaneous:
- struct stat
PTC MKS Toolkit 10.4 Documentation Build 39.