[BACK]Return to sticky.7 CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / share / man / man7

Annotation of src/share/man/man7/sticky.7, Revision 1.6

1.6     ! jruoho      1: .\"    $NetBSD: sticky.7,v 1.5 2007/02/05 14:54:31 rillig Exp $
1.1       christos    2: .\"
                      3: .\" Copyright (c) 1980, 1991, 1993
                      4: .\"    The Regents of the University of California.  All rights reserved.
                      5: .\"
                      6: .\" Redistribution and use in source and binary forms, with or without
                      7: .\" modification, are permitted provided that the following conditions
                      8: .\" are met:
                      9: .\" 1. Redistributions of source code must retain the above copyright
                     10: .\"    notice, this list of conditions and the following disclaimer.
                     11: .\" 2. Redistributions in binary form must reproduce the above copyright
                     12: .\"    notice, this list of conditions and the following disclaimer in the
                     13: .\"    documentation and/or other materials provided with the distribution.
                     14: .\" 3. Neither the name of the University nor the names of its contributors
                     15: .\"    may be used to endorse or promote products derived from this software
                     16: .\"    without specific prior written permission.
                     17: .\"
                     18: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     19: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     20: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     21: .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     22: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     23: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     24: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     25: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     26: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     27: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     28: .\" SUCH DAMAGE.
                     29: .\"
                     30: .\"     @(#)sticky.8   8.1 (Berkeley) 6/5/93
                     31: .\"
1.6     ! jruoho     32: .Dd May 10, 2011
1.2       wiz        33: .Dt STICKY 7
1.1       christos   34: .Os
                     35: .Sh NAME
                     36: .Nm sticky
1.2       wiz        37: .Nd Description of the `sticky' (S_ISVTX) bit functionality
1.1       christos   38: .Sh DESCRIPTION
                     39: A special file mode, called the
                     40: .Em sticky bit
1.2       wiz        41: (mode
                     42: .Dv S_ISVTX ) ,
1.1       christos   43: is used to indicate special treatment for directories.
                     44: See
                     45: .Xr chmod 2
1.2       wiz        46: or the file
1.1       christos   47: .Pa /usr/include/sys/stat.h
1.6     ! jruoho     48: .Ss Sticky files
1.5       rillig     49: For regular files, the use of mode
1.2       wiz        50: .Dv S_ISVTX
                     51: is reserved and can be set only by the super-user.
1.3       christos   52: .Nx
1.5       rillig     53: does not currently treat regular files that have the sticky bit set
1.4       wiz        54: specially, but this behavior might change in the future.
1.6     ! jruoho     55: .Ss Sticky directories
1.2       wiz        56: A directory whose
                     57: .Dq sticky bit
1.5       rillig     58: is set becomes a
1.2       wiz        59: directory in which the deletion of files is restricted.
1.1       christos   60: A file in a sticky directory may only be removed or renamed
                     61: by a user if the user has write permission for the directory and
                     62: the user is the owner of the file, the owner of the directory,
                     63: or the super-user.
                     64: This feature is usefully applied to directories such as
                     65: .Pa /tmp
1.2       wiz        66: which must be publicly writable but should deny users the license
                     67: to arbitrarily delete or rename each others' files.
1.1       christos   68: .Pp
                     69: Any user may create a sticky directory.
                     70: See
                     71: .Xr chmod 1
                     72: for details about modifying file modes.
                     73: .Sh HISTORY
1.3       christos   74: The sticky bit first appeared in V7, and this manual page appeared
1.4       wiz        75: in section 8.
                     76: Its initial use was to mark sharable executables
1.3       christos   77: that were frequently used so that they would stay in swap after
1.4       wiz        78: the process exited.
                     79: Sharable executables were compiled in a special way so their text
                     80: and read-only data could be shared amongst processes.
1.3       christos   81: .Xr vi 1
                     82: and
                     83: .Xr sh 1
                     84: were such executables.
1.2       wiz        85: This is where the term
                     86: .Dq sticky
1.4       wiz        87: comes from - the program would stick around in swap, and it would
                     88: not have to be fetched again from the file system.
                     89: Of course as long as there was a copy in the swap area, the file
                     90: was marked busy so it could not be overwritten.
                     91: On V7 this meant that the file could not be removed either, because
                     92: busy executables could not be removed, but this restriction was
                     93: lifted in BSD releases.
1.3       christos   94: .Pp
1.4       wiz        95: To replace such executables was a cumbersome process.
                     96: One had first to remove the sticky bit, then execute the binary so
                     97: that the copy from swap was flushed, overwrite the executable, and
                     98: finally reset the sticky bit.
1.1       christos   99: .Pp
1.2       wiz       100: Later, on SunOS 4, the sticky bit got an additional meaning for
                    101: files that had the bit set and were not executable: read and write
                    102: operations from and to those files would go directly to the disk
                    103: and bypass the buffer cache.
                    104: This was typically used on swap files for NFS clients on an NFS
                    105: server, so that swap I/O generated by the clients on the servers
                    106: would not evict useful data from the server's buffer cache.
                    107: .Sh BUGS
                    108: Neither
                    109: .Xr open 2
                    110: nor
                    111: .Xr mkdir 2
                    112: will create a file with the sticky bit set.

CVSweb <webmaster@jp.NetBSD.org>