xref: /netbsd-src/lib/libc/sys/revoke.2 (revision ce0bb6e8d2e560ecacbe865a848624f94498063b)
1.\"	$NetBSD: revoke.2,v 1.2 1995/02/27 12:36:23 cgd Exp $
2.\"
3.\" Copyright (c) 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" This code is derived from software contributed to Berkeley by
7.\" Berkeley Software Design, Inc.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\" 3. All advertising materials mentioning features or use of this software
18.\"    must display the following acknowledgement:
19.\"	This product includes software developed by the University of
20.\"	California, Berkeley and its contributors.
21.\" 4. Neither the name of the University nor the names of its contributors
22.\"    may be used to endorse or promote products derived from this software
23.\"    without specific prior written permission.
24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35.\" SUCH DAMAGE.
36.\"
37.\"     @(#)revoke.2	8.1 (Berkeley) 6/4/93
38.\"
39.Dd June 4, 1993
40.Dt REVOKE 2
41.Os
42.Sh NAME
43.Nm revoke
44.Nd revoke file access
45.Sh SYNOPSIS
46.Ft int
47.Fn revoke "char *path"
48.Sh DESCRIPTION
49The
50.Nm revoke
51function invalidates all current open file descriptors in the system
52for the file named by
53.Fa path .
54Subsequent operations on any such descriptors
55fail, with the exceptions that a
56.Fn read
57from a character device file which has been revoked
58returns a count of zero (end of file),
59and a
60.Fn close
61call will succeed.
62If the file is a special file for a device which is open,
63the device close function
64is called as if all open references to the file had been closed.
65.Pp
66Access to a file may be revoked only by its owner or the super user.
67The
68.Nm revoke
69function is currently supported only for block and character special
70device files.
71It is normally used to prepare a terminal device for a new login session,
72preventing any access by a previous user of the terminal.
73.Sh RETURN VALUES
74A 0 value indicated that the call succeeded.  A \-1 return value
75indicates an error occurred and
76.Va errno
77is set to indicated the reason.
78.Sh ERRORS
79Access to the named file is revoked unless one of the following:
80.Bl -tag -width Er
81.It Bq Er ENOTDIR
82A component of the path prefix is not a directory.
83.It Bq Er ENAMETOOLONG
84A component of a pathname exceeded 255 characters,
85or an entire path name exceeded 1024 characters.
86.It Bq Er ENOENT
87The named file or a component of the path name does not exist.
88.It Bq Er EACCES
89Search permission is denied for a component of the path prefix.
90.It Bq Er ELOOP
91Too many symbolic links were encountered in translating the pathname.
92.It Bq Er EFAULT
93.Fa Path
94points outside the process's allocated address space.
95.It Bq Er EINVAL
96The named file is neither a character special or block
97special file.
98.It Bq Er EPERM
99The caller is neither the owner of the file nor the super user.
100.El
101.Sh SEE ALSO
102.Xr close 2
103.Sh HISTORY
104The
105.Nm revoke
106function was introduced in
107.Bx 4.3 Reno .
108