xref: /openbsd-src/lib/libc/sys/revoke.2 (revision b2ea75c1b17e1a9a339660e7ed45cd24946b230e)
1.\"	$OpenBSD: revoke.2,v 1.7 2000/10/18 05:12:11 aaron Exp $
2.\"	$NetBSD: revoke.2,v 1.3 1995/10/12 15:41:11 jtc Exp $
3.\"
4.\" Copyright (c) 1993
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" This code is derived from software contributed to Berkeley by
8.\" Berkeley Software Design, Inc.
9.\"
10.\" Redistribution and use in source and binary forms, with or without
11.\" modification, are permitted provided that the following conditions
12.\" are met:
13.\" 1. Redistributions of source code must retain the above copyright
14.\"    notice, this list of conditions and the following disclaimer.
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\"    notice, this list of conditions and the following disclaimer in the
17.\"    documentation and/or other materials provided with the distribution.
18.\" 3. All advertising materials mentioning features or use of this software
19.\"    must display the following acknowledgement:
20.\"	This product includes software developed by the University of
21.\"	California, Berkeley and its contributors.
22.\" 4. Neither the name of the University nor the names of its contributors
23.\"    may be used to endorse or promote products derived from this software
24.\"    without specific prior written permission.
25.\"
26.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36.\" SUCH DAMAGE.
37.\"
38.\"     @(#)revoke.2	8.1 (Berkeley) 6/4/93
39.\"
40.Dd June 4, 1993
41.Dt REVOKE 2
42.Os
43.Sh NAME
44.Nm revoke
45.Nd revoke file access
46.Sh SYNOPSIS
47.Fd #include <unistd.h>
48.Ft int
49.Fn revoke "const char *path"
50.Sh DESCRIPTION
51The
52.Nm revoke
53function invalidates all current open file descriptors in the system
54for the file named by
55.Fa path .
56Subsequent operations on any such descriptors
57fail, with the exceptions that a
58.Fn read
59from a character device file which has been revoked
60returns a count of zero (end of file),
61and a
62.Fn close
63call will succeed.
64If the file is a special file for a device which is open,
65the device close function
66is called as if all open references to the file had been closed.
67.Pp
68Access to a file may be revoked only by its owner or the superuser.
69The
70.Nm revoke
71function 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.
75A \-1 return value indicates 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 EPERM
96The caller is neither the owner of the file nor the superuser.
97.El
98.Sh SEE ALSO
99.Xr close 2
100.Sh HISTORY
101The
102.Nm revoke
103function was introduced in
104.Bx 4.3 Reno .
105