1.\" $OpenBSD: revoke.2,v 1.16 2021/06/30 18:46:49 schwarze 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. Neither the name of the University nor the names of its contributors 19.\" may be used to endorse or promote products derived from this software 20.\" without specific prior written permission. 21.\" 22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32.\" SUCH DAMAGE. 33.\" 34.\" @(#)revoke.2 8.1 (Berkeley) 6/4/93 35.\" 36.Dd $Mdocdate: June 30 2021 $ 37.Dt REVOKE 2 38.Os 39.Sh NAME 40.Nm revoke 41.Nd revoke file access 42.Sh SYNOPSIS 43.In unistd.h 44.Ft int 45.Fn revoke "const char *path" 46.Sh DESCRIPTION 47The 48.Fn revoke 49function invalidates all current open file descriptors in the system 50for the tty device named by 51.Fa path . 52Subsequent operations on any such descriptors 53fail, with the exceptions that a 54.Fn read 55from a tty which has been revoked returns a count of zero (end of file), 56and a 57.Fn close 58call will succeed. 59If the file is a special file for a device which is open, 60the device close function 61is called as if all open references to the file had been closed. 62.Pp 63Access to a file may be revoked only by its owner or the superuser. 64The 65.Fn revoke 66function is used to prepare a terminal device for a new login session, 67preventing any access by a previous user of the terminal. 68The 69.Xr pty 4 70subsystem has this as an implicit operation, but hardwired 71.Xr tty 4 72require the operation. 73.Sh RETURN VALUES 74.Rv -std 75.Sh ERRORS 76Access to the named file is revoked unless one of the following: 77.Bl -tag -width Er 78.It Bq Er ENOTDIR 79A component of the path prefix is not a directory. 80.It Bq Er ENAMETOOLONG 81A component of a pathname exceeded 82.Dv NAME_MAX 83characters, or an entire pathname (including the terminating NUL) 84exceeded 85.Dv PATH_MAX 86bytes. 87.It Bq Er ENOENT 88The named file or a component of the pathname does not exist. 89.It Bq Er ENOTTY 90.Fa path 91is not associated with a tty special device. 92.It Bq Er EACCES 93Search permission is denied for a component of the path prefix. 94.It Bq Er ELOOP 95Too many symbolic links were encountered in translating the pathname. 96.It Bq Er EFAULT 97.Fa path 98points outside the process's allocated address space. 99.It Bq Er EPERM 100The caller is neither the owner of the file nor the superuser. 101.El 102.Sh SEE ALSO 103.Xr close 2 104.Sh HISTORY 105The 106.Fn revoke 107function was introduced in 108.Bx 4.3 Reno . 109