home *** CD-ROM | disk | FTP | other *** search
/ ftp.uni-stuttgart.de/pub/systems/acorn/ / Acorn.tar / Acorn / acornet / dev / c / debug / mnemosyn.spk / !Mnemosyne / sys / H / Stat < prev    next >
Text File  |  1991-04-24  |  2KB  |  70 lines

  1. /* H.Stat: Header file for stat call */
  2.  
  3. #ifndef __sys_stat
  4. #define __sys_stat
  5.  
  6. #include <time.h>
  7.  
  8. #include <sys/time.h> /* For utimbuf */
  9.  
  10. /* ARM System time format */
  11.  
  12. #ifndef __TIME_h
  13. #define __TIME_h
  14. typedef struct
  15. {
  16.     unsigned char t[5];    /* Low byte first - ie. t[0] is low */
  17. }
  18. TIME;
  19. #endif
  20.  
  21. /* File length/offset type */
  22.  
  23. #ifndef __off_t_h
  24. #define __off_t_h
  25. typedef unsigned int off_t;
  26. #endif
  27.  
  28. struct stat
  29. {
  30.         /* Unix equivalent fields */
  31.         unsigned short  st_mode;        /* mode bits */
  32.         short           st_nlink;       /* number of links to file */
  33.         short           st_uid;         /* user id of owner ( = 0 ) */
  34.         short           st_gid;         /* group id of owner ( = 0 ) */
  35.         off_t           st_size;        /* file size in characters */
  36.         time_t          st_mtime;       /* time file last written or created */
  37.         unsigned int    st_ino;   /* Dunno if this is right -- f2c expected it */
  38.         /* Arm file attribute details */
  39.         unsigned char   st_stamp;       /* is the file timestamped? */
  40.         unsigned int    st_load;        /* load address */
  41.         unsigned int    st_exec;        /* execution address */
  42.         unsigned short  st_type;        /* file type */
  43.         unsigned char   st_attribs;     /* file attributes */
  44.         TIME            st_time;        /* time stamp (Arm format) */
  45.         time_t          st_atime;       /* Time last accessed? (if known?) */
  46. };
  47.  
  48. /* Parts of st_mode field */
  49.  
  50. #define S_IFMT          0170000         /* type of file */
  51. #define   S_IFDIR       0040000         /* directory */
  52. #define   S_IFREG       0100000         /* regular */
  53. #define S_IREAD         0000400         /* read permission, owner */
  54. #define S_IWRITE        0000200         /* write permission, owner */
  55. #define S_IEXEC         0000100         /* execute permission, owner */
  56.  
  57. /* Parts of st_attribs field */
  58.  
  59. #define S_AREAD         0x01            /* Read access for user */
  60. #define S_AWRITE        0x02            /* Write access for user */
  61. #define S_ALOCK         0x08            /* File is locked */
  62.  
  63. extern int stat (char *name, struct stat *buf);
  64. extern int set_stat (char *name, struct stat *buf);
  65. extern int fstat(int in_fd, struct stat *in_stat); /* < 0 if fails */
  66. extern int lstat(char *name, struct stat *buf);
  67. extern int utime(char *name, struct utimbuf *times);
  68. extern int access(char *name, int mode);
  69. #endif
  70.