Set the rights of a file descriptor. This can only be used to remove rights.
fd_fdstat_set_rights() function is used to set the rights of a file descriptor. It allows modifying the access rights associated with the file descriptor by applying new rights or removing existing rights.
In POSIX systems, file descriptors are associated with access rights that define the operations that can be performed on the file or resource represented by the descriptor. These access rights control actions such as reading, writing, or seeking within the file. The
fd_fdstat_set_rights() function enables applications to modify the access rights associated with a file descriptor, restricting or expanding the available operations.
;;; This can only be used to remove rights, and returns `errno::notcapable` if called in a way that would attempt to add rights ;;; Adjust the rights associated with a file descriptor. (@interface func (export "fd_fdstat_set_rights") (param $fd $fd) ;;; The desired rights of the file descriptor. (param $fs_rights_base $rights) (param $fs_rights_inheriting $rights) (result $error (expected (error $errno))) )
ctx: A mutable reference to the function environment.
fd: The file descriptor to apply the new rights to.
fs_rights_base: The base rights to apply to the file descriptor.
fs_rights_inheriting: The inheriting rights to apply to the file descriptor.
The function returns an
Errno value indicating the success or failure of the operation.
This function has been instrumented with debug-level logging. It will log the following information:
%fd: The file descriptor being modified.
fd_fdstat_set_rights() function is used to modify the access rights associated with a file descriptor. It allows applications to set or remove rights from the file descriptor. However, it can only be used to remove rights, not add new ones.
Please note that when setting new rights, they must be a subset of the current rights. If any of the new rights are not included in the current rights, the function will return