revoke Subroutine

Purpose

Revokes access to a file.

Library

Standard C Library (libc.a)

Syntax

int revoke ( Path)
char *Path;

Description

The revoke subroutine revokes access to a file by all processes.

All accesses to the file are revoked. Subsequent attempts to access the file using a file descriptor established before the revoke subroutine fail and cause the process to receive a return value of -1, and the errno global variable is set to EBADF.

A process can revoke access to a file only if its effective user ID is the same as the file owner ID, or if the calling process is privileged.

Note: The revoke subroutine has no affect on subsequent attempts to open the file. To assure exclusive access to the file, the caller should change the access mode of the file before issuing the revoke subroutine. Currently the revoke subroutine works only on terminal devices. The chmod subroutine changes file access modes.

Parameters

Item Description
Path Path name of the file for which access is to be revoked.

Return Values

Upon successful completion, the revoke subroutine returns a value of 0.

If the revoke subroutine fails, a value of -1 returns and the errno global variable is set to indicate the error.

Error Codes

The revoke subroutine fails if any of the following are true:

Item Description
ENOTDIR A component of the path prefix is not a directory.
EACCES Search permission is denied on a component of the path prefix.
ENOENT A component of the path prefix does not exist, or the process has the disallow truncation attribute (see the ulimit subroutine).
ENOENT The path name is null.
ENOENT A symbolic link was named, but the file to which it refers does not exist.
ESTALE The process's root or current directory is located in a virtual file system that has been unmounted.
EFAULT The Path parameter points outside of the process's address space.
ELOOP Too many symbolic links were encountered in translating the path name.
ENAMETOOLONG A component of a path name exceeds 255 characters, or an entire path name exceeds 1023 characters.
EIO An I/O error occurred during the operation.
EPERM The effective user ID of the calling process is not the same as the file's owner ID.
EINVAL Access rights revocation is not implemented for this file.