#ifndef __STAT_LOADED #define __STAT_LOADED 1 /**************************************************************************** ** ** - stat/fstat UNIX emulation functions ** ***************************************************************************** ** Header introduced by the ISO POSIX-1 Standard ***************************************************************************** ** ** Copyright 2000 Compaq Computer Corporation ** ** Compaq and the Compaq logo Registered in U.S. Patent and Trademark Office. ** ** Confidential computer software. Valid license from Compaq required for ** possession, use or copying. Consistent with FAR 12.211 and 12.212, ** Commercial Computer Software, Computer Software Documentation, and ** Technical Data for Commercial Items are licensed to the U.S. Government ** under vendor's standard commercial license. ** ****************************************************************************** */ #pragma __nostandard #include #ifdef __cplusplus extern "C" { #endif #if __INITIAL_POINTER_SIZE # pragma __pointer_size __save # pragma __pointer_size 32 #endif /* ** Do not naturally align data structures */ #pragma __member_alignment __save #pragma __nomember_alignment /* ** Disable warning messages */ #pragma __message __save #pragma __message __disable (__MISALGNDSTRCT) #pragma __message __disable (__MISALGNDMEM) /* ** Create 'public' typedefs that are either insensitive to pointer or are ** sensitive to pointer size and must use short pointers. */ /* ** X/Open definitions */ #if defined _XOPEN_SOURCE || (!defined _POSIX_C_SOURCE && !defined _DECC_V4_SOURCE) # ifndef __TIME_T # define __TIME_T 1 typedef __time_t time_t; # endif # ifndef __DEV_T # define __DEV_T 1 typedef __dev_t dev_t; # endif # ifndef __INO_T # define __INO_T 1 typedef __ino_t ino_t; # endif # ifndef __NLINK_T # define __NLINK_T 1 typedef __nlink_t nlink_t; # endif # ifndef __MODE_T # define __MODE_T 1 typedef __mode_t mode_t; # endif # ifndef __OFF_T # define __OFF_T 1 typedef __off_t off_t; # endif # ifndef __UID_T # define __UID_T 1 typedef __uid_t uid_t; # endif # ifndef __GID_T # define __GID_T 1 typedef __gid_t gid_t; # endif #endif /* ** ISO POSIX-1 defines off_t to be a signed arithmetic type, and ** requires the st_size field to be of type off_t. DEC C V5.0 ** and prior declared the field as unsigned. ** ** Also note that times are given in units of seconds since the ** Epoch i.e. times returned are measured in seconds since ** 00:00:00 GMT, Jan. 1, 1970. */ struct stat { __dev_t st_dev; /* pointer to physical device name */ __ino_t st_ino[3]; /* 3 words to receive fid */ __mode_t st_mode; /* file "mode" i.e. prot, dir, reg, etc. */ __nlink_t st_nlink; /* for compatibility - not really used */ __uid_t st_uid; /* from ACP - QIO uic field */ __gid_t st_gid; /* either short group number extracted from st_uid or long group number from POSIX_OWNER ACE */ #if defined _XOPEN_SOURCE || !defined _POSIX_C_SOURCE __dev_t st_rdev; /* for compatibility - always zero */ #else __dev_t st_fill1; #endif #ifdef _DECC_V4_SOURCE unsigned int st_size; /* file size in bytes, was unsigned */ #else __off_t st_size; /* file size in bytes */ #endif __time_t st_atime; /* file access time; always same as st_mtime */ __time_t st_mtime; /* last modification time */ __time_t st_ctime; /* file creation time */ #ifndef _POSIX_C_SOURCE char st_fab_rfm; /* record format */ char st_fab_rat; /* record attributes */ char st_fab_fsz; /* fixed header size */ unsigned int st_fab_mrs; /* record size */ #else char st_fill2[3]; unsigned int st_fill3; #endif }; /* ** DEC C extensions */ #ifndef _POSIX_C_SOURCE typedef struct stat stat_t; #endif /* ** Private definitions */ #define __S_IFMT 0170000 /* type of file */ #define __S_IFIFO 0010000 /* pipe or fifo */ #define __S_IFDIR 0040000 /* directory */ #define __S_IFCHR 0020000 /* character special */ #define __S_IFBLK 0060000 /* block special */ #define __S_IFREG 0100000 /* regular */ #define __S_IFMPC 0030000 /* multiplexed char special */ #define __S_IFMPB 0070000 /* multiplexed block special */ #define __S_IFSOCK 0140000 /* socket */ #define __S_IFLNK 0120000 /* symbolic link */ /* ** ISO POSIX-1 definitions */ #define S_ISUID 0004000 /* set user id on execution */ #define S_ISGID 0002000 /* set group id on execution */ #define S_IRWXU 0000700 /* read,write,execute perm: owner */ #define S_IRUSR 0000400 /* read permission: owner */ #define S_IWUSR 0000200 /* write permission: owner */ #define S_IXUSR 0000100 /* execute/search permission: owner */ #define S_IRWXG 0000070 /* read,write,execute perm: group */ #define S_IRGRP 0000040 /* read permission: group */ #define S_IWGRP 0000020 /* write permission: group */ #define S_IXGRP 0000010 /* execute/search permission: group */ #define S_IRWXO 0000007 /* read,write,execute perm: other */ #define S_IROTH 0000004 /* read permission: other */ #define S_IWOTH 0000002 /* write permission: other */ #define S_IXOTH 0000001 /* execute/search permission: other */ #define S_ISFIFO(m) (((m)& __S_IFMT) == __S_IFIFO) #define S_ISDIR(m) (((m)& __S_IFMT) == __S_IFDIR) #define S_ISCHR(m) (((m)& __S_IFMT) == __S_IFCHR) #define S_ISBLK(m) (((m)& __S_IFMT) == __S_IFBLK) #define S_ISREG(m) (((m)& __S_IFMT) == __S_IFREG) /* ** X/Open XPG4 definitions */ #if defined _XOPEN_SOURCE || !defined _POSIX_C_SOURCE # define S_IFMT __S_IFMT /* type of file */ # define S_IFIFO __S_IFIFO /* pipe or fifo */ # define S_IFDIR __S_IFDIR /* directory */ # define S_IFCHR __S_IFCHR /* character special */ # define S_IFBLK __S_IFBLK /* block special */ # define S_IFREG __S_IFREG /* regular */ #endif /* ** X/Open XPG4 V2 definitions */ #if defined _XOPEN_SOURCE_EXTENDED || !defined _POSIX_C_SOURCE # define S_IFSOCK __S_IFSOCK /* socket */ # define S_IFLNK __S_IFLNK /* symbolic link */ # define S_ISLNK(m) (((m)& S_IFMT) == S_IFLNK) # define S_ISSOCK(m) (((m)& S_IFMT) == S_IFSOCK) # define S_ISVTX 0001000 /* save swapped text even after use */ #endif /* ** DEC C extensions */ #ifndef _POSIX_C_SOURCE # define S_IREAD 0000400 /* read permission, owner */ # define S_IWRITE 0000200 /* write permission, owner */ # define S_IEXEC 0000100 /* execute/search permission, owner */ # define S_IFMPC __S_IFMPC /* multiplexed char special */ # define S_IFMPB __S_IFMPB /* multiplexed block special */ #endif /* ** We are done defining things which must always be short pointers. If ** the user has used /pointer_size=short or /pointer_size=long, we will ** allow ong pointers to be used in function calls. */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size 64 #endif /* ** On Alpha, beginning in version of OpenVMS Alpha following V7.3, stat ** and fstat support 32-bit gid_t datatype. The stat and fstat functions ** supporting long gid_t datatype can return UTC time only. If local time ** is required, define _VMS_V6_SOURCE macro. Defining _DECC_SHORT_GID_T ** or _VMS_V6_SOURCE macro causes DEC C RTL to use 16-bit gid_t datatype. */ #if __USE_LONG_GID_T # pragma __extern_prefix __save # pragma __extern_prefix "__long_gid_" #else /* ** Beginning in OpenVMS Version 7.0 stat has two implementations. ** One for compatibility stat() which returns time in terms of ** local time and one __utc_stat() which returns time in terms of UTC. */ #if __CRTL_VER >= 70000000 # if !defined _VMS_V6_SOURCE # ifdef __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix __save # pragma __extern_prefix "__utc_" # else # define stat(__p1,__p2) __utc_stat(__p1,__p2) # define fstat(__p1,__p2) __utc_fstat(__p1,__p2) # endif # endif #endif /* __CRTL_VER >= 70000000 */ #endif /* __USE_LONG_GID_T */ /* ** Function prototypes */ int fstat (int __file_desc, struct stat *__buffer); /* ** If we cannot use extern prefix, then the user cannot get the ellipsis form ** of the prototype. Applications which must use the optional arguments may ** either upgrade the compiler or change the call site to use decc$stat or ** decc$__utc_stat instead of stat. */ #if (defined _POSIX_C_SOURCE) || (!defined __CAN_USE_EXTERN_PREFIX) int stat (const char *__path, struct stat *__buf); #else int stat (const char *__path, struct stat *__buf, ...); #endif /* ** Disable extern_prefix if we enabled it earlier */ #if __USE_LONG_GID_T # pragma __extern_prefix __restore #else #if __CRTL_VER >= 70000000 # if !defined _VMS_V6_SOURCE # ifdef __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix __restore # endif # endif #endif #endif #if __USE_LONG_GID_T # pragma __extern_prefix __save # pragma __extern_prefix "__long_gid_" #endif int chmod (const char *__file_spec, __mode_t __mode); #if __USE_LONG_GID_T # pragma __extern_prefix __restore #endif __mode_t umask (__mode_t __old_mask); #ifdef _POSIX_C_SOURCE int mkdir (const char *__dir_spec, __mode_t __mode); #else int mkdir (const char *__dir_spec, __mode_t __mode, ...); #endif /* ** Restore the users pointer context */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size __restore #endif #ifdef __cplusplus } #endif #pragma __message __restore #pragma __member_alignment __restore #pragma __standard #endif /* __STAT_LOADED */