xref: /original-bsd/share/man/man8/sticky.8 (revision c3e32dec)
1.\" Copyright (c) 1980, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)sticky.8	8.1 (Berkeley) 06/05/93
7.\"
8.Dd
9.Dt STICKY 8
10.Os BSD 4
11.Sh NAME
12.Nm sticky
13.Nd sticky text and append-only directories
14.Sh DESCRIPTION
15A special file mode, called the
16.Em sticky bit
17(mode S_ISVTX),
18is used to indicate special treatment
19for shareable executable files and directories.
20See
21.Xr chmod 2
22or
23the file
24.Pa /usr/include/sys/stat.h
25for an explanation of file modes.
26.Sh STICKY TEXT EXECUTABLE FILES
27An executable shareable file whose sticky bit is set
28will not be immediately discarded from swap space after execution.
29The kernel will hoard the text segment of the file for future
30reuse and avoid having to reload the program.
31Shareable text segments are normally placed
32in a least-frequently-used cache after use,
33and thus the `sticky bit' has little effect on commonly-used text images.
34.Pp
35Sharable executable files are created with the
36.Fl n
37and
38.Fl z
39options of
40the loader
41.Xr ld 1 .
42.Pp
43Only the super-user can set the sticky bit
44on a sharable executable file.
45.Sh STICKY DIRECTORIES
46A directory whose `sticky bit' is set
47becomes an append-only directory, or, more accurately,
48a directory in which the deletion of files is restricted.
49A file in a sticky directory may only be removed or renamed
50by a user if the user has write permission for the directory and
51the user is the owner of the file, the owner of the directory,
52or the super-user.
53This feature is usefully applied to directories such as
54.Pa /tmp
55which must be publicly writable but
56should deny users the license to arbitrarily
57delete or rename each others' files.
58.Pp
59Any user may create a sticky directory.
60See
61.Xr chmod 1
62for details about modifying file modes.
63.Sh BUGS
64Since the text areas of sticky text executables are stashed in the swap area,
65abuse of the feature can cause a system to run out of swap.
66.Pp
67Neither
68.Xr open 2
69nor
70.Xr mkdir 2
71will create a file with the sticky bit set.
72.Sh HISTORY
73A
74.Nm
75command appeared in Version 32V AT&T UNIX.
76