This commit is contained in:
Michael Kerrisk 2007-06-23 07:05:05 +00:00
parent 5852aba2e0
commit c91e381d47
2 changed files with 44 additions and 22 deletions

View File

@ -187,33 +187,34 @@ The following POSIX macros are defined to check the file type using the
field:
.RS
.TP 1.2i
S_ISREG(m)
.BR S_ISREG (m)
is it a regular file?
.TP
S_ISDIR(m)
.BR S_ISDIR (m)
directory?
.TP
S_ISCHR(m)
.BR S_ISCHR (m)
character device?
.TP
S_ISBLK(m)
.BR S_ISBLK (m)
block device?
.TP
S_ISFIFO(m)
.BR S_ISFIFO (m)
FIFO (named pipe)?
.TP
S_ISLNK(m)
.BR S_ISLNK (m)
symbolic link? (Not in POSIX.1-1996.)
.TP
S_ISSOCK(m)
.BR S_ISSOCK (m)
socket? (Not in POSIX.1-1996.)
.RE
.PP
The following flags are defined for the
.I st_mode
field:
.RS
.TS
l l l.
lB l l.
S_IFMT 0170000 bitmask for the file type bitfields
S_IFSOCK 0140000 socket
S_IFLNK 0120000 symbolic link
@ -238,6 +239,7 @@ S_IROTH 00004 others have read permission
S_IWOTH 00002 others have write permission
S_IXOTH 00001 others have execute permission
.TE
.RE
.P
The set-group-ID bit
.RB ( S_ISGID )
@ -316,19 +318,37 @@ fields may be less portable.
The interpretation differs between systems,
and possibly on a single system when NFS mounts are involved.)
.LP
POSIX does not describe the S_IFMT, S_IFSOCK, S_IFLNK, S_IFREG, S_IFBLK,
S_IFDIR, S_IFCHR, S_IFIFO, S_ISVTX bits, but instead demands the use of
the macros S_ISDIR(), etc.
POSIX does not describe the
.BR S_IFMT ,
.BR S_IFSOCK ,
.BR S_IFLNK ,
.BR S_IFREG ,
.BR S_IFBLK ,
.BR S_IFDIR ,
.BR S_IFCHR ,
.BR S_IFIFO ,
.BR S_ISVTX
bits, but instead demands the use of
the macros
.BR S_ISDIR (),
etc.
The
S_ISLNK()
.BR S_ISLNK ()
and
S_ISSOCK()
.BR S_ISSOCK ()
macros are not in
POSIX.1-1996, but both are present in POSIX.1-2001;
the former is from SVID 4, the latter from SUSv2.
.LP
Unix V7 (and later systems) had S_IREAD, S_IWRITE, S_IEXEC, where POSIX
prescribes the synonyms S_IRUSR, S_IWUSR, S_IXUSR.
Unix V7 (and later systems) had
.BR S_IREAD ,
.BR S_IWRITE ,
.BR S_IEXEC ,
where POSIX
prescribes the synonyms
.BR S_IRUSR ,
.BR S_IWUSR ,
.BR S_IXUSR .
.SS "Other Systems"
Values that have been (or are) in use on various systems:
.TS
@ -336,13 +356,14 @@ l l l l l.
hex name ls octal description
f000 S_IFMT 170000 mask for file type
0000 000000 SCO out-of-service inode, BSD unknown type
SVID-v2 and XPG2 have both 0 and 0100000 for ordinary file
SVID-v2 and XPG2 have both 0 and 0100000
for ordinary file
1000 S_IFIFO p| 010000 FIFO (named pipe)
2000 S_IFCHR c 020000 character special (V7)
3000 S_IFMPC 030000 multiplexed character special (V7)
4000 S_IFDIR d/ 040000 directory (V7)
5000 S_IFNAM 050000 XENIX named special file
with two subtypes, distinguished by st_rdev values 1, 2:
with two subtypes, distinguished by \fIst_rdev\fP values 1, 2
0001 S_INSEM s 000001 XENIX semaphore subtype of IFNAM
0002 S_INSHD m 000002 XENIX shared data subtype of IFNAM
6000 S_IFBLK b 060000 block special (V7)
@ -355,13 +376,13 @@ b000 S_IFSHAD 130000 Solaris shadow inode for ACL (not seen by userspace)
c000 S_IFSOCK s= 140000 socket (BSD; also "S_IFSOC" on VxFS)
d000 S_IFDOOR D> 150000 Solaris door
e000 S_IFWHT w% 160000 BSD whiteout (not used for inode)
0200 S_ISVTX 001000 `sticky bit': save swapped text even after use (V7)
reserved (SVID-v2)
On non-directories: don't cache this file (SunOS)
On directories: restricted deletion flag (SVID-v4.2)
0400 S_ISGID 002000 set-group-ID on execution (V7)
for directories: use BSD semantics for propagation of GID
for directories: use BSD semantics for
propagation of GID
0400 S_ENFMT 002000 SysV file locking enforcement (shared with S_ISGID)
0800 S_ISUID 004000 set-user-ID on execution (V7)
0800 S_CDF 004000 directory is a context dependent file (HP-UX)

View File

@ -45,9 +45,9 @@ cfmakeraw, cfgetospeed, cfgetispeed, cfsetispeed, cfsetospeed, cfsetspeed \-
get and set terminal attributes, line control, get and set baud rate
.SH SYNOPSIS
.nf
#include <termios.h>
.B #include <termios.h>
.br
#include <unistd.h>
.B #include <unistd.h>
.sp
.BI "int tcgetattr(int " fd ", struct termios *" termios_p );
.sp
@ -368,7 +368,8 @@ characters are converted to uppercase.
.\" [requires _BSD_SOURCE or _SVID_SOURCE or _XOPEN_SOURCE]
.\" glibc is probably now wrong to allow
.B _XOPEN_SOURCE
to expose XCASE.
to expose
.BR XCASE .
.TP
.B ECHO
Echo input characters.