xref: /original-bsd/lib/libc/sys/revoke.2 (revision c3e32dec)
1.\" Copyright (c) 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Berkeley Software Design, Inc.
6.\"
7.\" %sccs.include.redist.man%
8.\"
9.\"     @(#)revoke.2	8.1 (Berkeley) 06/04/93
10.\"
11.Dd
12.Dt REVOKE 2
13.Os
14.Sh NAME
15.Nm revoke
16.Nd revoke file access
17.Sh SYNOPSIS
18.Ft int
19.Fn revoke "char *path"
20.Sh DESCRIPTION
21The
22.Nm revoke
23function invalidates all current open file descriptors in the system
24for the file named by
25.Fa path .
26Subsequent operations on any such descriptors
27fail, with the exceptions that a
28.Fn read
29from a character device file which has been revoked
30returns a count of zero (end of file),
31and a
32.Fn close
33call will succeed.
34If the file is a special file for a device which is open,
35the device close function
36is called as if all open references to the file had been closed.
37.Pp
38Access to a file may be revoked only by its owner or the super user.
39The
40.Nm revoke
41function is currently supported only for block and character special
42device files.
43It is normally used to prepare a terminal device for a new login session,
44preventing any access by a previous user of the terminal.
45.Sh RETURN VALUES
46A 0 value indicated that the call succeeded.  A \-1 return value
47indicates an error occurred and
48.Va errno
49is set to indicated the reason.
50.Sh ERRORS
51Access to the named file is revoked unless one of the following:
52.Bl -tag -width Er
53.It Bq Er ENOTDIR
54A component of the path prefix is not a directory.
55.It Bq Er ENAMETOOLONG
56A component of a pathname exceeded 255 characters,
57or an entire path name exceeded 1024 characters.
58.It Bq Er ENOENT
59The named file or a component of the path name does not exist.
60.It Bq Er EACCES
61Search permission is denied for a component of the path prefix.
62.It Bq Er ELOOP
63Too many symbolic links were encountered in translating the pathname.
64.It Bq Er EFAULT
65.Fa Path
66points outside the process's allocated address space.
67.It Bq Er EINVAL
68The named file is neither a character special or block
69special file.
70.It Bq Er EPERM
71The caller is neither the owner of the file nor the super user.
72.El
73.Sh SEE ALSO
74.Xr close 2
75.Sh HISTORY
76The
77.Nm revoke
78function was introduced in
79.Bx 4.3 Reno .
80