Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

revoke(2) [opendarwin man page]

REVOKE(2)						      BSD System Calls Manual							 REVOKE(2)

NAME
revoke -- revoke file access SYNOPSIS
#include <unistd.h> int revoke(const char *path); DESCRIPTION
The revoke function invalidates all current open file descriptors in the system for the file named by path. Subsequent operations on any such descriptors fail, with the exceptions that a read() from a character device file which has been revoked returns a count of zero (end of file), and a close() call will succeed. If the file is a special file for a device which is open, the device close function is called as if all open references to the file had been closed. Access to a file may be revoked only by its owner or the super user. The revoke function is currently supported only for block and character special device files. It is normally used to prepare a terminal device for a new login session, preventing any access by a previous user of the terminal. RETURN VALUES
A 0 value indicated that the call succeeded. A -1 return value indicates an error occurred and errno is set to indicated the reason. ERRORS
Access to the named file is revoked unless one of the following: [ENOTDIR] A component of the path prefix is not a directory. [ENAMETOOLONG] A component of a pathname exceeded 255 characters, or an entire path name exceeded 1024 characters. [ENOENT] The named file or a component of the path name does not exist. [EACCES] Search permission is denied for a component of the path prefix. [ELOOP] Too many symbolic links were encountered in translating the pathname. [EFAULT] Path points outside the process's allocated address space. [EINVAL] The named file is neither a character special or block special file. [EPERM] The caller is neither the owner of the file nor the super user. SEE ALSO
close(2) HISTORY
The revoke function was introduced in 4.3BSD-Reno. BSD
June 4, 1993 BSD

Check Out this Related Man Page

revoke(2)							System Calls Manual							 revoke(2)

NAME
revoke - Voids all references to a file SYNOPSIS
revoke( char *path); PARAMETERS
Points to a null-terminated string containing the appropriate pathname. DESCRIPTION
The call invalidates all file descriptors associated with the pathname specified in path, which must be a block or character special file. Any open file system object on the device on which the revoked file system object resides subsequently holds an invalid file descriptor, and will receive errors if it attempts to access the file with any read, write, ioctl, or select system call. The only call that will suc- ceed under these conditions is close(). A subsequent call to open() will result in a valid file descriptor and thereby reenable access to the file. The behavior of the revoke() system call depends on the setting of a sysconfigtab variable, revoke-tty-only. By default, the revoke-tty- only parameter is set on. In this case, the system call conforms to the behavior of earlier versions of the call, but only for tty devices. For all other devices, the call returns an error, ENOTTY. You can set off the revoke-tty-only parameter to make the system call conform to its behavior in earlier versions of Tru64 UNIX . The effective user ID of the process must be the same as the owner of the file, or must have superuser privilege in order to use the call in this manner. RETURN VALUES
Upon successful completion, a value of 0 (zero) is returned. If the revoke() function fails, it returns a value of -1, and errno is set to indicate the error. ERRORS
If the revoke() function fails, errno may be set to one of the following values: The file represented by the pathname is of the incorrect type. The size of the pathname exceeds PATH_MAX or a pathname component is longer than NAME_MAX. A component of the specified pathname does not exist, or the path parameter points to an empty string. A component of the path prefix is not a directory. The sysconfigtab variable revoke-tty-only is set on, but the device is not a tty. delim off revoke(2)
Man Page