libvxc_dat.h (4188B)
1 // Must keep in sync with ../libvxc/include 2 3 #include <sys/types.h> 4 #include <stdint.h> 5 6 #define VXC_MAXNAMLEN 255 7 8 // DO NOT USE "long" in this file - it needs to behave same on 32 and 64-bit. 9 #define long __no_long_here_thanks 10 11 typedef int32_t vxc_ssize_t; 12 13 typedef int32_t vxc_mode_t; 14 typedef int32_t vxc_off_t; 15 typedef uint32_t vxc_dev_t; 16 typedef uint32_t vxc_ino_t; 17 typedef int32_t vxc_nlink_t; 18 typedef int32_t vxc_blksize_t; 19 typedef int32_t vxc_blkcnt_t; 20 21 typedef int32_t vxc_id_t; 22 typedef int32_t vxc_pid_t; // XXX where else is this getting defined? 23 typedef int32_t vxc_uid_t; 24 typedef int32_t vxc_gid_t; 25 26 typedef int32_t vxc_time_t; 27 typedef int32_t vxc_clock_t; 28 typedef int32_t vxc_suseconds_t; 29 30 31 struct vxc_dirent { 32 uint32_t d_fileno; 33 uint16_t d_reclen; 34 uint8_t d_type; 35 uint8_t d_namlen; 36 char d_name[VXC_MAXNAMLEN + 1]; 37 }; 38 39 struct vxc_tm { 40 int tm_sec; 41 int tm_min; 42 int tm_hour; 43 int tm_mday; 44 int tm_mon; 45 int tm_year; 46 int tm_wday; 47 int tm_yday; 48 int tm_isdst; 49 }; 50 51 struct vxc_utimbuf { 52 vxc_time_t actime; 53 vxc_time_t modtime; 54 }; 55 56 struct vxc_timeval { 57 vxc_time_t tv_sec; // Seconds 58 vxc_suseconds_t tv_usec; // Microseconds 59 }; 60 61 struct vxc_itimerval { 62 struct vxc_timeval it_interval; // Timer interval 63 struct vxc_timeval it_value; // Current value 64 }; 65 66 struct vxc_stat 67 { 68 vxc_dev_t dev; // Device ID of device containing file. 69 vxc_ino_t ino; // File serial number. 70 vxc_mode_t mode; // Mode of file. 71 vxc_nlink_t nlink; // Number of hard links to the file. 72 vxc_uid_t uid; // User ID of file. 73 vxc_gid_t gid; // Group ID of file. 74 vxc_dev_t rdev; // Device ID for device special file. 75 vxc_blksize_t blksize; // Size of blocks in this file 76 vxc_blkcnt_t blocks; // Number of blocks allocated for this file 77 vxc_off_t size; // File size in bytes. 78 vxc_time_t atime; // Time of last access. 79 vxc_time_t mtime; // Time of last data modification. 80 vxc_time_t ctime; // Time of last status change. 81 }; 82 83 84 // File mode bits - matching vx/env.h 85 #define VXC_S_IFMT 070000 // File type bit mask 86 #define VXC_S_IFNULL 000000 // Unused inode 87 #define VXC_S_IFREG 010000 // Regular file 88 #define VXC_S_IFDIR 020000 // Directory 89 #define VXC_S_IFLNK 030000 // Symbolic link 90 #define VXC_S_IFSOCK 040000 // Socket 91 #define VXC_S_IFIFO 050000 // FIFO 92 #define VXC_S_IFBLK 060000 // Block device 93 #define VXC_S_IFCHR 070000 // Character device 94 95 #define VXC_S_ISREG(m) (((m) & VXC_S_IFMT) == VXC_S_IFREG) 96 #define VXC_S_ISDIR(m) (((m) & VXC_S_IFMT) == VXC_S_IFDIR) 97 #define VXC_S_ISLNK(m) (((m) & VXC_S_IFMT) == VXC_S_IFLNK) 98 #define VXC_S_ISSOCK(m) (((m) & VXC_S_IFMT) == VXC_S_IFSOCK) 99 #define VXC_S_ISFIFO(m) (((m) & VXC_S_IFMT) == VXC_S_IFIFO) 100 #define VXC_S_ISBLK(m) (((m) & VXC_S_IFMT) == VXC_S_IFBLK) 101 #define VXC_S_ISCHR(m) (((m) & VXC_S_IFMT) == VXC_S_IFCHR) 102 103 #define VXC_S_ISUID 004000 104 #define VXC_S_ISGID 002000 105 #define VXC_S_ISVTX 001000 106 107 #define VXC_S_IRWXU 000700 108 #define VXC_S_IRUSR 000400 109 #define VXC_S_IWUSR 000200 110 #define VXC_S_IXUSR 000100 111 112 #define VXC_S_IRWXG 000070 113 #define VXC_S_IRGRP 000040 114 #define VXC_S_IWGRP 000020 115 #define VXC_S_IXGRP 000010 116 117 #define VXC_S_IRWXO 000007 118 #define VXC_S_IROTH 000004 119 #define VXC_S_IWOTH 000002 120 #define VXC_S_IXOTH 000001 121 122 // File access modes 123 #define VXC_O_ACCMODE 0x03 // Mask for file access modes. 124 #define VXC_O_RDONLY 0x00 // Open for reading only. 125 #define VXC_O_WRONLY 0x01 // Open for writing only. 126 #define VXC_O_RDWR 0x02 // Open for reading and writing. 127 128 // File creation flags 129 #define VXC_O_CREAT 0x10 // Create file if it does not exist. 130 #define VXC_O_EXCL 0x20 // Exclusive use flag. 131 #define VXC_O_NOCTTY 0x40 // Do not assign controlling terminal. 132 #define VXC_O_TRUNC 0x80 // Truncate flag. 133 134 // File access flags 135 #define VXC_O_APPEND 0x100 // Set append mode. 136 #define VXC_O_NONBLOCK 0x200 // Non-blocking mode. 137 #define VXC_O_SYNC 0x400 // Synchronous I/O. 138 139 // Fcntl args 140 #define VXC_F_DUPFD 0 141 #define VXC_F_GETFD 1 142 #define VXC_F_SETFD 2 143 #define VXC_F_GETFL 3 144 #define VXC_F_SETFL 4 145 // #define VXC_F_GETLK 7 146 // #define VXC_F_SETLK 8 147 // #define VXC_F_SETLKW 9 148 149 #define VXC_FD_CLOEXEC 1 150