1*0a6a1f1dSLionel Sambuc.\" $NetBSD: revoke.2,v 1.16 2014/11/11 08:10:02 njoly Exp $ 22fe8fb19SBen Gras.\" 32fe8fb19SBen Gras.\" Copyright (c) 1993 42fe8fb19SBen Gras.\" The Regents of the University of California. All rights reserved. 52fe8fb19SBen Gras.\" 62fe8fb19SBen Gras.\" This code is derived from software contributed to Berkeley by 72fe8fb19SBen Gras.\" Berkeley Software Design, Inc. 82fe8fb19SBen Gras.\" 92fe8fb19SBen Gras.\" Redistribution and use in source and binary forms, with or without 102fe8fb19SBen Gras.\" modification, are permitted provided that the following conditions 112fe8fb19SBen Gras.\" are met: 122fe8fb19SBen Gras.\" 1. Redistributions of source code must retain the above copyright 132fe8fb19SBen Gras.\" notice, this list of conditions and the following disclaimer. 142fe8fb19SBen Gras.\" 2. Redistributions in binary form must reproduce the above copyright 152fe8fb19SBen Gras.\" notice, this list of conditions and the following disclaimer in the 162fe8fb19SBen Gras.\" documentation and/or other materials provided with the distribution. 172fe8fb19SBen Gras.\" 3. Neither the name of the University nor the names of its contributors 182fe8fb19SBen Gras.\" may be used to endorse or promote products derived from this software 192fe8fb19SBen Gras.\" without specific prior written permission. 202fe8fb19SBen Gras.\" 212fe8fb19SBen Gras.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 222fe8fb19SBen Gras.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 232fe8fb19SBen Gras.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 242fe8fb19SBen Gras.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 252fe8fb19SBen Gras.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 262fe8fb19SBen Gras.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 272fe8fb19SBen Gras.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 282fe8fb19SBen Gras.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 292fe8fb19SBen Gras.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 302fe8fb19SBen Gras.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 312fe8fb19SBen Gras.\" SUCH DAMAGE. 322fe8fb19SBen Gras.\" 332fe8fb19SBen Gras.\" @(#)revoke.2 8.1 (Berkeley) 6/4/93 342fe8fb19SBen Gras.\" 35f14fb602SLionel Sambuc.Dd July 3, 2011 362fe8fb19SBen Gras.Dt REVOKE 2 372fe8fb19SBen Gras.Os 382fe8fb19SBen Gras.Sh NAME 392fe8fb19SBen Gras.Nm revoke 402fe8fb19SBen Gras.Nd revoke file access 412fe8fb19SBen Gras.Sh LIBRARY 422fe8fb19SBen Gras.Lb libc 432fe8fb19SBen Gras.Sh SYNOPSIS 442fe8fb19SBen Gras.In unistd.h 452fe8fb19SBen Gras.Ft int 462fe8fb19SBen Gras.Fn revoke "const char *path" 472fe8fb19SBen Gras.Sh DESCRIPTION 482fe8fb19SBen GrasThe 49f14fb602SLionel Sambuc.Fn revoke 502fe8fb19SBen Grasfunction invalidates all current open file descriptors in the system 512fe8fb19SBen Grasfor the file named by 522fe8fb19SBen Gras.Fa path . 532fe8fb19SBen GrasSubsequent operations on any such descriptors 542fe8fb19SBen Grasfail, with the exceptions that a 55f14fb602SLionel Sambuc.Xr read 2 562fe8fb19SBen Grasfrom a character device file which has been revoked 572fe8fb19SBen Grasreturns a count of zero (end of file), 582fe8fb19SBen Grasand a 59f14fb602SLionel Sambuc.Xr close 2 602fe8fb19SBen Grascall will succeed. 612fe8fb19SBen GrasIf the file is a special file for a device which is open, 622fe8fb19SBen Grasthe device close function 632fe8fb19SBen Grasis called as if all open references to the file had been closed. 642fe8fb19SBen Gras.Pp 652fe8fb19SBen GrasAccess to a file may be revoked only by its owner or the super user. 662fe8fb19SBen Gras.Pp 67f14fb602SLionel SambucThe 68f14fb602SLionel Sambuc.Fn revoke 69f14fb602SLionel Sambucfunction is normally used to prepare a terminal device for a new login session, 702fe8fb19SBen Graspreventing any access by a previous user of the terminal. 712fe8fb19SBen Gras.Sh RETURN VALUES 722fe8fb19SBen GrasA 0 value indicates that the call succeeded. 732fe8fb19SBen GrasA \-1 return value indicates an error occurred and 742fe8fb19SBen Gras.Va errno 752fe8fb19SBen Grasis set to indicate the reason. 762fe8fb19SBen Gras.Sh ERRORS 772fe8fb19SBen GrasAccess to the named file is revoked unless one of the following: 782fe8fb19SBen Gras.Bl -tag -width Er 79f14fb602SLionel Sambuc.It Bq Er EACCES 80f14fb602SLionel SambucSearch permission is denied for a component of the path prefix. 81f14fb602SLionel Sambuc.It Bq Er EFAULT 82f14fb602SLionel Sambuc.Fa path 83f14fb602SLionel Sambucpoints outside the process's allocated address space. 84f14fb602SLionel Sambuc.It Bq Er ELOOP 85f14fb602SLionel SambucToo many symbolic links were encountered in translating the pathname. 862fe8fb19SBen Gras.It Bq Er ENAMETOOLONG 87*0a6a1f1dSLionel SambucA component of a pathname exceeded 88*0a6a1f1dSLionel Sambuc.Brq Dv NAME_MAX 89*0a6a1f1dSLionel Sambuccharacters, 90*0a6a1f1dSLionel Sambucor an entire path name exceeded 91*0a6a1f1dSLionel Sambuc.Brq Dv PATH_MAX 92*0a6a1f1dSLionel Sambuccharacters. 932fe8fb19SBen Gras.It Bq Er ENOENT 942fe8fb19SBen GrasThe named file or a component of the path name does not exist. 95f14fb602SLionel Sambuc.It Bq Er ENOTDIR 96f14fb602SLionel SambucA component of the path prefix is not a directory. 972fe8fb19SBen Gras.It Bq Er EPERM 982fe8fb19SBen GrasThe caller is neither the owner of the file nor the super user. 992fe8fb19SBen Gras.El 1002fe8fb19SBen Gras.Sh SEE ALSO 1012fe8fb19SBen Gras.Xr close 2 , 1022fe8fb19SBen Gras.Xr dup 2 , 1032fe8fb19SBen Gras.Xr fcntl 2 , 1042fe8fb19SBen Gras.Xr flock 2 , 1052fe8fb19SBen Gras.Xr fstat 2 , 1062fe8fb19SBen Gras.Xr read 2 , 1072fe8fb19SBen Gras.Xr write 2 1082fe8fb19SBen Gras.Sh HISTORY 1092fe8fb19SBen GrasThe 110f14fb602SLionel Sambuc.Fn revoke 1112fe8fb19SBen Grasfunction was introduced in 1122fe8fb19SBen Gras.Bx 4.3 Reno . 113