1 2 /* Used to generate include/vki/vki-ppc{32,64}-aix5.h. */ 3 4 #include <stdio.h> 5 #include <stdlib.h> 6 #include <sys/types.h> 7 #include <sys/stat.h> 8 #include <sys/statfs.h> 9 #include <fcntl.h> 10 #include <unistd.h> 11 #include <sys/mman.h> 12 #include <errno.h> 13 #include <string.h> 14 #include <time.h> 15 #include <sys/ptrace.h> 16 #include <sys/uio.h> 17 #include <sys/ioctl.h> 18 19 #undef offsetof 20 21 /* This is so useful it should be visible absolutely everywhere. */ 22 #if !defined(offsetof) 23 # define offsetof(type,memb) ((int)&((type*)0)->memb) 24 #endif 25 26 27 int main ( void ) 28 { 29 printf ("aix5_VKI_info: sizeof(void*) = %d\n", (int)sizeof(void*)); 30 31 printf("/* ---------------- Errors ---------------- */\n"); 32 printf("\n"); 33 printf("#define VKI_EINVAL %d\n", EINVAL); 34 printf("#define VKI_EINTR %d\n", EINTR); 35 printf("#define VKI_ENOSYS %d\n", ENOSYS); 36 printf("#define VKI_EAGAIN %d\n", EAGAIN); 37 printf("#define VKI_ENOMEM %d\n", ENOMEM); 38 printf("#define VKI_EACCES %d\n", EACCES); 39 printf("#define VKI_EEXIST %d\n", EEXIST); 40 printf("#define VKI_EPERM %d\n", EPERM); 41 printf("#define VKI_ENOENT %d\n", ENOENT); 42 printf("#define VKI_ESRCH %d\n", ESRCH); 43 printf("#define VKI_EBADF %d\n", EBADF); 44 printf("#define VKI_EFAULT %d\n", EFAULT); 45 printf("#define VKI_EMFILE %d\n", EMFILE); 46 printf("#define VKI_ECHILD %d\n", ECHILD); 47 printf("#define VKI_EOVERFLOW %d\n", EOVERFLOW); 48 printf("\n"); 49 printf("/* ---------------- File I/O ---------------- */\n"); 50 printf("\n"); 51 printf("#define VKI_O_WRONLY 0x%08x\n", O_WRONLY); 52 printf("#define VKI_O_RDONLY 0x%08x\n", O_RDONLY); 53 printf("#define VKI_O_APPEND 0x%08x\n", O_APPEND); 54 printf("#define VKI_O_CREAT 0x%08x\n", O_CREAT); 55 printf("#define VKI_O_RDWR 0x%08x\n", O_RDWR); 56 printf("#define VKI_O_EXCL 0x%08x\n", O_EXCL); 57 printf("#define VKI_O_TRUNC 0x%08x\n", O_TRUNC); 58 printf("\n"); 59 printf("#define VKI_S_IRUSR 0x%08x\n", S_IRUSR); 60 printf("#define VKI_S_IXUSR 0x%08x\n", S_IXUSR); 61 printf("#define VKI_S_IXGRP 0x%08x\n", S_IXGRP); 62 printf("#define VKI_S_IXOTH 0x%08x\n", S_IXOTH); 63 printf("#define VKI_S_IWUSR 0x%08x\n", S_IWUSR); 64 printf("#define VKI_S_IWOTH 0x%08x\n", S_IWOTH); 65 printf("#define VKI_S_ISUID 0x%08x\n", S_ISUID); 66 printf("#define VKI_S_ISGID 0x%08x\n", S_ISGID); 67 printf("#define VKI_S_IFMT 0x%08x\n", S_IFMT); 68 printf("#define VKI_S_IFDIR 0x%08x\n", S_IFDIR); 69 printf("#define VKI_S_IFCHR 0x%08x\n", S_IFCHR); 70 printf("#define VKI_S_IFBLK 0x%08x\n", S_IFBLK); 71 printf("\n"); 72 printf("#define VKI_F_DUPFD 0x%08x\n", F_DUPFD); 73 printf("#define VKI_F_SETFD 0x%08x\n", F_SETFD); 74 printf("#define VKI_FD_CLOEXEC 0x%08x\n", FD_CLOEXEC); 75 printf("\n"); 76 printf("#define VKI_R_OK 0x%08x\n", R_OK); 77 printf("#define VKI_W_OK 0x%08x\n", W_OK); 78 printf("#define VKI_X_OK 0x%08x\n", X_OK); 79 80 /* info about struct stat */ 81 struct stat st; 82 printf("\nsizeof(struct stat) = %d\n", (int)sizeof(struct stat)); 83 84 printf(" st_size: off %2d sz %d\n", 85 offsetof(struct stat, st_size), 86 (int)sizeof(st.st_size)); 87 88 printf(" st_mode: off %2d sz %d\n", 89 offsetof(struct stat, st_mode), 90 (int)sizeof(st.st_mode)); 91 92 printf(" st_uid: off %2d sz %d\n", 93 offsetof(struct stat, st_uid), 94 (int)sizeof(st.st_uid)); 95 96 printf(" st_gid: off %2d sz %d\n", 97 offsetof(struct stat, st_gid), 98 (int)sizeof(st.st_gid)); 99 100 printf(" st_dev: off %2d sz %d\n", 101 offsetof(struct stat, st_dev), 102 (int)sizeof(st.st_dev)); 103 104 printf(" st_ino: off %2d sz %d\n", 105 offsetof(struct stat, st_ino), 106 (int)sizeof(st.st_ino)); 107 108 printf("\n"); 109 printf("#define VKI_STX_NORMAL %d\n", (int)STX_NORMAL); 110 printf("\n"); 111 printf("sizeof(size_t) = %d\n", (int)sizeof(size_t) ); 112 printf("\n"); 113 printf("#define VKI_SEEK_SET %d\n", SEEK_SET); 114 printf("#define VKI_PATH_MAX %d\n", PATH_MAX); 115 116 /* info about struct iovec */ 117 struct iovec iov; 118 printf("\nsizeof(struct iovec) = %d\n", (int)sizeof(struct iovec)); 119 printf(" iov_base: off %2d sz %d\n", 120 offsetof(struct iovec, iov_base), 121 (int)sizeof(iov.iov_base)); 122 printf(" iov_len: off %2d sz %d\n", 123 offsetof(struct iovec, iov_len), 124 (int)sizeof(iov.iov_len)); 125 126 printf("\n"); 127 printf("#define _VKI_IOC_NONE %d\n", 3 & (IOC_VOID >> 30)); 128 printf("#define _VKI_IOC_READ %d\n", 3 & (IOC_OUT >> 30)); 129 printf("#define _VKI_IOC_WRITE %d\n", 3 & (IOC_IN >> 30)); 130 printf("\n"); 131 printf("/* ---------------- MMappery ---------------- */\n"); 132 printf("\n"); 133 printf("#define VKI_PAGE_SIZE %d\n", (int)sysconf(_SC_PAGESIZE)); 134 printf("\n"); 135 printf("#define VKI_PROT_NONE 0x%08x\n", PROT_NONE); 136 printf("#define VKI_PROT_READ 0x%08x\n", PROT_READ); 137 printf("#define VKI_PROT_WRITE 0x%08x\n", PROT_WRITE); 138 printf("#define VKI_PROT_EXEC 0x%08x\n", PROT_EXEC); 139 printf("\n"); 140 printf("#define VKI_MAP_FIXED 0x%08x\n", MAP_FIXED); 141 printf("#define VKI_MAP_PRIVATE 0x%08x\n", MAP_PRIVATE); 142 printf("#define VKI_MAP_ANONYMOUS 0x%08x\n", MAP_ANONYMOUS); 143 printf("\n"); 144 printf("/* ---------------- RLimitery ---------------- */\n"); 145 printf("\n"); 146 printf("#define VKI_RLIMIT_DATA 0x%08x\n", RLIMIT_DATA); 147 printf("#define VKI_RLIMIT_NOFILE 0x%08x\n", RLIMIT_NOFILE); 148 printf("#define VKI_RLIMIT_STACK 0x%08x\n", RLIMIT_STACK); 149 printf("#define VKI_RLIMIT_CORE 0x%08x\n", RLIMIT_CORE); 150 151 /* info about struct rlimit */ 152 struct rlimit rl; 153 printf("\nsizeof(struct rlimit) = %d\n", (int)sizeof(struct rlimit)); 154 printf(" rlim_cur: off %2d sz %d\n", 155 offsetof(struct rlimit, rlim_cur), 156 (int)sizeof(rl.rlim_cur)); 157 printf(" rlim_max: off %2d sz %d\n", 158 offsetof(struct rlimit, rlim_max), 159 (int)sizeof(rl.rlim_max)); 160 printf("\n"); 161 printf("/* ---------------- Time ---------------- */\n"); 162 printf("\n"); 163 164 /* print info about struct timeval */ 165 struct timeval tv; 166 printf("sizeof(struct timeval) = %d\n", (int)sizeof(struct timeval)); 167 printf(" tv_sec: off %2d sz %d\n", 168 offsetof(struct timeval, tv_sec), 169 (int)sizeof(tv.tv_sec)); 170 printf(" tv_usec: off %2d sz %d\n", 171 offsetof(struct timeval, tv_usec), 172 (int)sizeof(tv.tv_usec)); 173 174 /* print info about struct timespec */ 175 struct timespec ts; 176 printf("\nsizeof(struct timespec) = %d\n", (int)sizeof(struct timespec)); 177 printf(" tv_sec: off %2d sz %d\n", 178 offsetof(struct timespec, tv_sec), 179 (int)sizeof(ts.tv_sec)); 180 printf(" tv_nsec: off %2d sz %d\n", 181 offsetof(struct timespec, tv_nsec), 182 (int)sizeof(ts.tv_nsec)); 183 184 printf("\n"); 185 printf("/* ---------------- Signals ---------------- */\n"); 186 printf("\n"); 187 printf("#define _VKI_NSIG %ld\n", 8 * sizeof(sigset_t) ); 188 printf("\n"); 189 printf("#define VKI_SIGSEGV %d\n", SIGSEGV); 190 printf("#define VKI_SIGBUS %d\n", SIGBUS); 191 printf("#define VKI_SIGFPE %d\n", SIGFPE); 192 printf("#define VKI_SIGHUP %d\n", SIGHUP); 193 printf("#define VKI_SIGINT %d\n", SIGINT); 194 printf("#define VKI_SIGQUIT %d\n", SIGQUIT); 195 printf("#define VKI_SIGABRT %d\n", SIGABRT); 196 printf("#define VKI_SIGUSR1 %d\n", SIGUSR1); 197 printf("#define VKI_SIGUSR2 %d\n", SIGUSR2); 198 printf("#define VKI_SIGPIPE %d\n", SIGPIPE); 199 printf("#define VKI_SIGALRM %d\n", SIGALRM); 200 printf("#define VKI_SIGTERM %d\n", SIGTERM); 201 printf("/* VKI_SIGSTKFLT does not exist on AIX 5.2 */\n"); 202 printf("#define VKI_SIGTTIN %d\n", SIGTTIN); 203 printf("#define VKI_SIGTTOU %d\n", SIGTTOU); 204 printf("#define VKI_SIGXCPU %d\n", SIGXCPU); 205 printf("#define VKI_SIGXFSZ %d\n", SIGXFSZ); 206 printf("#define VKI_SIGVTALRM %d\n", SIGVTALRM); 207 printf("#define VKI_SIGPROF %d\n", SIGPROF); 208 printf("#define VKI_SIGIO %d\n", SIGIO); 209 printf("#define VKI_SIGPWR %d\n", SIGPWR); 210 printf("/* VKI_SIGUNUSED does not exist on AIX 5.2 */\n"); 211 printf("#define VKI_SIGRTMIN %d\n", SIGRTMIN); 212 printf("#define VKI_SIGRTMAX %d\n", SIGRTMAX); 213 printf("#define VKI_SIGTRAP %d\n", SIGTRAP); 214 printf("#define VKI_SIGCONT %d\n", SIGCONT); 215 printf("#define VKI_SIGCHLD %d\n", SIGCHLD); 216 printf("#define VKI_SIGWINCH %d\n", SIGWINCH); 217 printf("#define VKI_SIGURG %d\n", SIGURG); 218 printf("#define VKI_SIGILL %d\n", SIGILL); 219 printf("#define VKI_SIGSTOP %d\n", SIGSTOP); 220 printf("#define VKI_SIGKILL %d\n", SIGKILL); 221 printf("#define VKI_SIGTSTP %d\n", SIGTSTP); 222 printf("#define VKI_SIGSYS %d\n", SIGSYS); 223 224 /* print info about struct sigaction */ 225 struct sigaction sa; 226 printf("\n"); 227 printf("sizeof(struct sigaction) = %d\n", (int)sizeof(struct sigaction)); 228 printf(" sa_handler: off %2d sz %d\n", 229 offsetof(struct sigaction, sa_handler), 230 (int)sizeof(sa.sa_handler)); 231 printf(" sa_mask: off %2d sz %d\n", 232 offsetof(struct sigaction, sa_mask), 233 (int)sizeof(sa.sa_mask)); 234 printf(" sa_flags: off %2d sz %d\n", 235 offsetof(struct sigaction, sa_flags), 236 (int)sizeof(sa.sa_flags)); 237 printf("sa_sigaction: off %2d sz %d\n", 238 offsetof(struct sigaction, sa_sigaction), 239 (int)sizeof(sa.sa_sigaction)); 240 printf("\n"); 241 printf("#define VKI_SA_ONSTACK %d\n",SA_ONSTACK ); 242 printf("#define VKI_SA_RESTART %d\n",SA_RESTART ); 243 printf("#define VKI_SA_RESETHAND %d\n",SA_RESETHAND ); 244 printf("#define VKI_SA_SIGINFO %d\n",SA_SIGINFO); 245 printf("#define VKI_SA_NODEFER %d\n",SA_NODEFER ); 246 // printf("#define VKI_SA_NOMASK %d\n",SA_NOMASK ) ; 247 // printf("#define VKI_SA_ONESHOT %d\n",SA_ONESHOT ); 248 printf("#define VKI_SA_NOCLDSTOP %d\n",SA_NOCLDSTOP ); 249 printf("#define VKI_SA_NOCLDWAIT %d\n",SA_NOCLDWAIT ); 250 // printf("#define VKI_SA_RESTORER %d\n",SA_RESTORER ); 251 printf("\n"); 252 printf("#define VKI_SS_ONSTACK %d\n",SS_ONSTACK ); 253 printf("#define VKI_SS_DISABLE %d\n",SS_DISABLE ); 254 printf("\n"); 255 printf("#define VKI_MINSIGSTKSZ %ld\n",MINSIGSTKSZ ); 256 printf("\n"); 257 printf("#define VKI_SI_USER %d\n",SI_USER ); 258 printf("\n"); 259 printf("#define VKI_SIG_BLOCK %d\n",SIG_BLOCK ); 260 printf("#define VKI_SIG_SETMASK %d\n",SIG_SETMASK ); 261 printf("#define VKI_SIG_UNBLOCK %d\n",SIG_UNBLOCK ); 262 printf("#define VKI_SIG_IGN (void*)%d\n",(int)SIG_IGN ); 263 printf("#define VKI_SIG_DFL (void*)%d\n",(int)SIG_DFL ); 264 printf("\n"); 265 // printf("#define VKI_SI_TKILL %d\n",SI_TKILL ); 266 printf("#define VKI_SI_USER %d\n",SI_USER ); 267 printf("\n"); 268 printf("#define VKI_SEGV_ACCERR %d\n", SEGV_ACCERR); 269 printf("#define VKI_SEGV_MAPERR %d\n", SEGV_MAPERR); 270 printf("\n"); 271 printf("#define VKI_TRAP_TRACE %d\n", TRAP_TRACE); 272 printf("#define VKI_TRAP_BRKPT %d\n", TRAP_BRKPT); 273 printf("#define VKI_BUS_OBJERR %d\n", BUS_OBJERR); 274 printf("#define VKI_BUS_ADRERR %d\n", BUS_ADRERR); 275 printf("#define VKI_BUS_ADRALN %d\n", BUS_ADRALN); 276 printf("#define VKI_FPE_FLTSUB %d\n", FPE_FLTSUB); 277 printf("#define VKI_FPE_FLTINV %d\n", FPE_FLTINV); 278 printf("#define VKI_FPE_FLTRES %d\n", FPE_FLTRES); 279 printf("#define VKI_FPE_FLTUND %d\n", FPE_FLTUND); 280 printf("#define VKI_FPE_FLTOVF %d\n", FPE_FLTOVF); 281 printf("#define VKI_FPE_FLTDIV %d\n", FPE_FLTDIV); 282 printf("#define VKI_FPE_INTOVF %d\n", FPE_INTOVF); 283 printf("#define VKI_FPE_INTDIV %d\n", FPE_INTDIV); 284 printf("\n"); 285 printf("#define VKI_ILL_BADSTK %d\n", ILL_BADSTK); 286 printf("#define VKI_ILL_COPROC %d\n", ILL_COPROC); 287 printf("#define VKI_ILL_PRVREG %d\n", ILL_PRVREG); 288 printf("#define VKI_ILL_PRVOPC %d\n", ILL_PRVOPC); 289 printf("#define VKI_ILL_ILLTRP %d\n", ILL_ILLTRP); 290 printf("#define VKI_ILL_ILLADR %d\n", ILL_ILLADR); 291 printf("#define VKI_ILL_ILLOPN %d\n", ILL_ILLOPN); 292 printf("#define VKI_ILL_ILLOPC %d\n", ILL_ILLOPC); 293 294 /* info about siginfo_t */ 295 siginfo_t si; 296 printf("\nsizeof(siginfo_t) = %d\n", (int)sizeof(siginfo_t)); 297 printf(" si_signo: off %2d sz %d\n", 298 offsetof(siginfo_t, si_signo), 299 (int)sizeof(si.si_signo)); 300 printf(" si_code: off %2d sz %d\n", 301 offsetof(siginfo_t, si_code), 302 (int)sizeof(si.si_code)); 303 printf(" si_pid: off %2d sz %d\n", 304 offsetof(siginfo_t, si_pid), 305 (int)sizeof(si.si_pid)); 306 printf(" si_addr: off %2d sz %d\n", 307 offsetof(siginfo_t, si_addr), 308 (int)sizeof(si.si_addr)); 309 310 /* info about sigaltstack */ 311 stack_t ss; 312 printf("\nsizeof(stack_t) = %d\n", (int)sizeof(stack_t)); 313 printf(" ss_sp: off %2d sz %d\n", 314 offsetof(stack_t, ss_sp), 315 (int)sizeof(ss.ss_sp)); 316 printf(" ss_size: off %2d sz %d\n", 317 offsetof(stack_t, ss_size), 318 (int)sizeof(ss.ss_size)); 319 printf(" ss_flags: off %2d sz %d\n", 320 offsetof(stack_t, ss_flags), 321 (int)sizeof(ss.ss_flags)); 322 323 printf("\n"); 324 printf("/* ---------------- Misc ---------------- */\n"); 325 printf("\n"); 326 printf("#define VKI_PTRACE_TRACEME %d\n", PT_TRACE_ME); 327 printf("#define VKI_PTRACE_DETACH %d\n", PT_DETACH); 328 printf("\n"); 329 330 #if 0 331 printf("#define VKI_ %d\n", ); 332 printf("#define VKI_ %d\n", ); 333 printf("#define VKI_ %d\n", ); 334 printf("#define VKI_ %d\n", ); 335 336 printf("#define VKI_ 0x%08x\n", ); 337 printf("#define VKI_ 0x%08x\n", ); 338 printf("#define VKI_ 0x%08x\n", ); 339 printf("#define VKI_ 0x%08x\n", ); 340 #endif 341 return 0; 342 } 343