home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-07-13 | 3.0 KB | 124 lines | [TEXT/CWIE] |
- /* sys/stat.h */
-
- #ifndef _eSTAT
- #define _eSTAT
-
- #define lstat e_lstat
- #define stat e_stat
-
- /* I'd like to:
- #undef _STAT
- #include <stat.h>
- but it's too broken; see changes marked "-- e" below */
-
- #ifndef _TIME
- #include <time.h>
- #endif
-
- // added for e_access.c & mosml -- e
- #ifndef F_OK
- #include <sys/unistd.h>
- #endif
-
- /*
- * Local typedefs for stat struct
- */
- typedef unsigned long mode_t;
- typedef unsigned long ino_t;
- typedef unsigned long dev_t;
- typedef short nlink_t;
- typedef unsigned long uid_t;
- typedef unsigned long gid_t;
- typedef long off_t;
-
- #pragma options align=mac68k
- #if defined(__CFM68K__) && !defined(__USING_STATIC_LIBS__)
- #pragma import on
- #endif
-
- // in case they were already define (by including stst.h for example) -- e
-
- #undef S_IFMT
- #undef S_IFIFO
- #undef S_IFCHR
- #undef S_IFDIR
- #undef S_IFBLK
- #undef S_IFREG
- #undef S_IFLNK
- #undef S_IFSOCK
- #undef S_ISFIFO
- #undef S_ISCHR
- #undef S_ISDIR
- #undef S_ISBLK
- #undef S_ISREG
- #undef S_ISLNK
- #undef S_ISSOCK
-
- /*
- * (stat) st_mode bit values (only ones relevant for the Mac)
- * NB: all modes marked as (GUSI) mean that the mode is used only by GUSI
- * (Grand Unified Sockets Interface).
- */
- #define S_IFMT 0x0E00 /* type of file */ // was 0x0F00 -- e
- #define S_IFIFO 0x0000 /* fifo queue */ // was 0x0100 -- e
- #define S_IFCHR 0x0200 /* character special (GUSI) */
- #define S_IFDIR 0x0400 /* directory */
- #define S_IFBLK 0x0600 /* blocking stream */
- #define S_IFREG 0x0800 /* regular */
- #define S_IFLNK 0x0A00 /* symbolic link */
- #define S_IFSOCK 0x0E00 /* socket (GUSI) */
-
- /*
- * File type macros
- */
- #define S_ISFIFO(m) (((m)&(S_IFMT)) == (S_IFIFO))
- #define S_ISCHR(m) (((m)&(S_IFMT)) == (S_IFCHR))
- #define S_ISDIR(m) (((m)&(S_IFMT)) == (S_IFDIR))
- #define S_ISBLK(m) (((m)&(S_IFMT)) == (S_IFBLK))
- #define S_ISREG(m) (((m)&(S_IFMT)) == (S_IFREG))
- #define S_ISLNK(m) (((m)&(S_IFMT)) == (S_IFLNK))
- #define S_ISSOCK(m) (((m)&(S_IFMT)) == (S_IFSOCK))
-
- struct stat
- {
- mode_t st_mode; /* File mode; see #define's below */
- ino_t st_ino; /* File serial number */
- dev_t st_dev; /* ID of device containing this file */
- nlink_t st_nlink; /* Number of links */
- uid_t st_uid; /* User ID of the file's owner */
- gid_t st_gid; /* Group ID of the file's group */
- dev_t st_rdev; /* Device type */
- off_t st_size; /* File size in bytes */
- time_t st_atime; /* Time of last access */
- time_t st_mtime; /* Time of last data modification */
- time_t st_ctime; /* Time of last file status change */
- long st_blksize; /* Optimal blocksize */
- long st_blocks; /* blocks allocated for file */
- };
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- int stat( const char *path, struct stat *buf );
-
- int lstat( const char *path, struct stat *buf );
-
- /* these two don't go here but it works to fool mosml's unix.c -- e */
-
- char *realpath( char *linkname, char *buffer );
- long readlink( char *linkname, char *buffer, long maxlen );
-
- #ifdef __cplusplus
- }
- #endif
-
- #if defined(__CFM68K__) && !defined(__USING_STATIC_LIBS__)
- #pragma import reset
- #endif
- #pragma options align=reset
-
- #endif
-
- /* */
-