Article View: mod.computers.apollo
Article #58Bug in "struct stat"
From: Neal Holtz
Date: Sat, 28 Dec 1985 01:31
Date: Sat, 28 Dec 1985 01:31
45 lines
2504 bytes
2504 bytes
A warning, though I suspect its been discovered many times.
The header file <sys/stat.h> that we got with Aegis SR9 CC is
wrong. stat(3) (BSD4.2 version) returns a few more words
of data than the header file leaves room for. Nasty. The
correct version seems to be (as in the CLIB manual, page 3-72 BSD4.2):
/* stat.h, /usr/include, 06/19/85
stat structure and related flags
Changes:
06/19/85 jrw original coding. */
/* stat buffer -- returned from stat(2): */
struct stat {
dev_t st_dev; /* device id */
ino_t st_ino; /* inode number */
ushort st_mode; /* mode (see below) */
short st_nlink; /* # links */
ushort st_uid; /* uid of owner */
ushort st_gid; /* gid of owner */
dev_t st_rdev; /* dev id for b/c spec files */
off_t st_size; /* file size, in bytes */
time_t st_atime; /* data access time */
time_t st_mtime; /* data mod time */
time_t st_ctime; /* attribute mod time */
};
/* st_mode word definition: */
#define S_IFMT 0170000 /* format mask: */
#define S_IFDIR 0040000 /* directory */
#define S_IFCHR 0020000 /* character special */
#define S_IFBLK 0060000 /* block special */
#define S_IFREG 0100000 /* regular */
#define S_IFIFO 0010000 /* pipe (fifo) */
#define S_ISUID 04000 /* set user id on execution */
#define S_ISGID 02000 /* set group id on execution */
#define S_ISVTX 01000 /* save pure text (sticky bit; unimplemented) */
#define S_IREAD 00400 /* read (owner) */
#define S_IWRITE 00200 /* write (owner) */
#define S_IEXEC 00100 /* execute (file) | search (dir) (owner) */
Technical Details
Message-ID:
<12:holtz@cascade.carleton.cdn>Path:
arc1-ca.pugleaf.net!utzoo!decvax!ucbvax!apolloShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ucbvax.BERKELEY.EDU Path: arc1-ca.pugleaf.net!utzoo!decvax!ucbvax!apollo From: holtz%cascade.carleton.cdn%ubc.CSNET@CSNET-RELAY.ARPA (Neal Holtz) Newsgroups: mod.computers.apollo Subject: Bug in "struct stat" Message-ID: <12:holtz@cascade.carleton.cdn> Date: Fri, 27-Dec-85 20:31:22 EST Article-I.D.: cascade.12:holtz Posted: Fri Dec 27 20:31:22 1985 Date-Received: Sat, 28-Dec-85 18:15:39 EST Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 46 Approved: apollo@yale-comix.arpa