home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / unix / unixtools / util / sys / h / stat < prev    next >
Text File  |  1992-07-21  |  2KB  |  63 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. /* ARM System time format */
  9.  
  10. #ifndef __TIME_h
  11. #define __TIME_h
  12. typedef struct
  13. {
  14.     unsigned char t[5];    /* Low byte first - ie. t[0] is low */
  15. }
  16. TIME;
  17. #endif
  18.  
  19. /* File length/offset type */
  20.  
  21. #ifndef __off_t_h
  22. #define __off_t_h
  23. typedef unsigned int off_t;
  24. #endif
  25.  
  26. struct stat
  27. {
  28.         /* Unix equivalent fields */
  29.         unsigned short  st_mode;        /* mode bits */
  30.         short           st_nlink;       /* number of links to file */
  31.         short           st_uid;         /* user id of owner ( = 0 ) */
  32.         short           st_gid;         /* group id of owner ( = 0 ) */
  33.         off_t           st_size;        /* file size in characters */
  34.         time_t          st_mtime;       /* time file last written or created */
  35.         /* Arm file attribute details */
  36.         unsigned char   st_stamp;       /* is the file timestamped? */
  37.         unsigned int    st_load;        /* load address */
  38.         unsigned int    st_exec;        /* execution address */
  39.         unsigned short  st_type;        /* file type */
  40.         unsigned char   st_attribs;     /* file attributes */
  41.         TIME            st_time;        /* time stamp (Arm format) */
  42. };
  43.  
  44. /* Parts of st_mode field */
  45.  
  46. #define S_IFMT          0170000         /* type of file */
  47. #define   S_IFDIR       0040000         /* directory */
  48. #define   S_IFREG       0100000         /* regular */
  49. #define S_IREAD         0000400         /* read permission, owner */
  50. #define S_IWRITE        0000200         /* write permission, owner */
  51. #define S_IEXEC         0000100         /* execute permission, owner */
  52.  
  53. /* Parts of st_attribs field */
  54.  
  55. #define S_AREAD         0x01            /* Read access for user */
  56. #define S_AWRITE        0x02            /* Write access for user */
  57. #define S_ALOCK         0x08            /* File is locked */
  58.  
  59. extern int stat (char *name, struct stat *buf);
  60. extern int set_stat (char *name, struct stat *buf);
  61.  
  62. #endif
  63.