sys_fchown  [fs/open.c]


Changes ownership of a file. This system call is identical to sys_chown except that the file is specified using a file descriptor.

Arguments

eax 95
ebx File descriptor.
ecx New UID. If this value is -1, the user ID is not changed.
edx New GID. If this value is -1, the group ID is not changed

Return values

If the system call succeeds the return value is 0.
If the system call fails the return value is one of the following errno values (depending on the file systems other error values may be returned):

-ENOENT The file does not exist.
-EIO A low-level I/O error occurred while modifying the inode.
-EBADF ebx is not a valid, open, file descriptor.
-EPERM The calling process did not have the required permissions (see above) to change owner and/or group.
-EROFS The named file resides on a read-only file system.

Remarks

Only a process with a CAP_CHOWN capability may change the owner of a file. The owner of a file may change the group of the file to any group of which that owner is a member. A process with CAP_CHOWN may change the group arbitrarily.

The sys_fchown semantics are deliberately violated on NFS file systems which have UID mapping enabled. Additionally, the semantics of all system calls which access the file contents are violated, because sys_fchown may cause immediate access revocation on already open files. Client side caching may lead to a delay between the time where ownership have been changed to allow access for a user and the time where the file can actually be accessed by the user on other clients.

Compatibility

n/a