blob: b2095c810df364326c8d254e669c4da462226f13 [file] [log] [blame]
sewardj92ef1ed2006-10-17 01:04:15 +00001
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
27int 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_ISUID 0x%08x\n", S_ISUID);
65 printf("#define VKI_S_ISGID 0x%08x\n", S_ISGID);
66 printf("#define VKI_S_IFMT 0x%08x\n", S_IFMT);
67 printf("#define VKI_S_IFDIR 0x%08x\n", S_IFDIR);
68 printf("#define VKI_S_IFCHR 0x%08x\n", S_IFCHR);
69 printf("#define VKI_S_IFBLK 0x%08x\n", S_IFBLK);
70 printf("\n");
71 printf("#define VKI_F_DUPFD 0x%08x\n", F_DUPFD);
72 printf("#define VKI_F_SETFD 0x%08x\n", F_SETFD);
73 printf("#define VKI_FD_CLOEXEC 0x%08x\n", FD_CLOEXEC);
74 printf("\n");
75 printf("#define VKI_R_OK 0x%08x\n", R_OK);
76 printf("#define VKI_W_OK 0x%08x\n", W_OK);
77 printf("#define VKI_X_OK 0x%08x\n", X_OK);
78
79 /* info about struct stat */
80 struct stat st;
81 printf("\nsizeof(struct stat) = %d\n", (int)sizeof(struct stat));
82
83 printf(" st_size: off %2d sz %d\n",
84 offsetof(struct stat, st_size),
85 (int)sizeof(st.st_size));
86
87 printf(" st_mode: off %2d sz %d\n",
88 offsetof(struct stat, st_mode),
89 (int)sizeof(st.st_mode));
90
91 printf(" st_uid: off %2d sz %d\n",
92 offsetof(struct stat, st_uid),
93 (int)sizeof(st.st_uid));
94
95 printf(" st_gid: off %2d sz %d\n",
96 offsetof(struct stat, st_gid),
97 (int)sizeof(st.st_gid));
98
99 printf(" st_dev: off %2d sz %d\n",
100 offsetof(struct stat, st_dev),
101 (int)sizeof(st.st_dev));
102
103 printf(" st_ino: off %2d sz %d\n",
104 offsetof(struct stat, st_ino),
105 (int)sizeof(st.st_ino));
106
107 printf("\n");
108 printf("#define VKI_STX_NORMAL %d\n", (int)STX_NORMAL);
109 printf("\n");
110 printf("sizeof(size_t) = %d\n", (int)sizeof(size_t) );
111 printf("\n");
112 printf("#define VKI_SEEK_SET %d\n", SEEK_SET);
113 printf("#define VKI_PATH_MAX %d\n", PATH_MAX);
114
115 /* info about struct iovec */
116 struct iovec iov;
117 printf("\nsizeof(struct iovec) = %d\n", (int)sizeof(struct iovec));
118 printf(" iov_base: off %2d sz %d\n",
119 offsetof(struct iovec, iov_base),
120 (int)sizeof(iov.iov_base));
121 printf(" iov_len: off %2d sz %d\n",
122 offsetof(struct iovec, iov_len),
123 (int)sizeof(iov.iov_len));
124
125 printf("\n");
126 printf("#define _VKI_IOC_NONE %d\n", 3 & (IOC_VOID >> 30));
127 printf("#define _VKI_IOC_READ %d\n", 3 & (IOC_OUT >> 30));
128 printf("#define _VKI_IOC_WRITE %d\n", 3 & (IOC_IN >> 30));
129 printf("\n");
130 printf("/* ---------------- MMappery ---------------- */\n");
131 printf("\n");
132 printf("#define VKI_PAGE_SIZE %d\n", (int)sysconf(_SC_PAGESIZE));
133 printf("\n");
134 printf("#define VKI_PROT_NONE 0x%08x\n", PROT_NONE);
135 printf("#define VKI_PROT_READ 0x%08x\n", PROT_READ);
136 printf("#define VKI_PROT_WRITE 0x%08x\n", PROT_WRITE);
137 printf("#define VKI_PROT_EXEC 0x%08x\n", PROT_EXEC);
138 printf("\n");
139 printf("#define VKI_MAP_FIXED 0x%08x\n", MAP_FIXED);
140 printf("#define VKI_MAP_PRIVATE 0x%08x\n", MAP_PRIVATE);
141 printf("#define VKI_MAP_ANONYMOUS 0x%08x\n", MAP_ANONYMOUS);
142 printf("\n");
143 printf("/* ---------------- RLimitery ---------------- */\n");
144 printf("\n");
145 printf("#define VKI_RLIMIT_DATA 0x%08x\n", RLIMIT_DATA);
146 printf("#define VKI_RLIMIT_NOFILE 0x%08x\n", RLIMIT_NOFILE);
147 printf("#define VKI_RLIMIT_STACK 0x%08x\n", RLIMIT_STACK);
148 printf("#define VKI_RLIMIT_CORE 0x%08x\n", RLIMIT_CORE);
149
150 /* info about struct rlimit */
151 struct rlimit rl;
152 printf("\nsizeof(struct rlimit) = %d\n", (int)sizeof(struct rlimit));
153 printf(" rlim_cur: off %2d sz %d\n",
154 offsetof(struct rlimit, rlim_cur),
155 (int)sizeof(rl.rlim_cur));
156 printf(" rlim_max: off %2d sz %d\n",
157 offsetof(struct rlimit, rlim_max),
158 (int)sizeof(rl.rlim_max));
159 printf("\n");
160 printf("/* ---------------- Time ---------------- */\n");
161 printf("\n");
162
163 /* print info about struct timeval */
164 struct timeval tv;
165 printf("sizeof(struct timeval) = %d\n", (int)sizeof(struct timeval));
166 printf(" tv_sec: off %2d sz %d\n",
167 offsetof(struct timeval, tv_sec),
168 (int)sizeof(tv.tv_sec));
169 printf(" tv_usec: off %2d sz %d\n",
170 offsetof(struct timeval, tv_usec),
171 (int)sizeof(tv.tv_usec));
172
173 /* print info about struct timespec */
174 struct timespec ts;
175 printf("\nsizeof(struct timespec) = %d\n", (int)sizeof(struct timespec));
176 printf(" tv_sec: off %2d sz %d\n",
177 offsetof(struct timespec, tv_sec),
178 (int)sizeof(ts.tv_sec));
179 printf(" tv_nsec: off %2d sz %d\n",
180 offsetof(struct timespec, tv_nsec),
181 (int)sizeof(ts.tv_nsec));
182
183 printf("\n");
184 printf("/* ---------------- Signals ---------------- */\n");
185 printf("\n");
186 printf("#define _VKI_NSIG %ld\n", 8 * sizeof(sigset_t) );
187 printf("\n");
188 printf("#define VKI_SIGSEGV %d\n", SIGSEGV);
189 printf("#define VKI_SIGBUS %d\n", SIGBUS);
190 printf("#define VKI_SIGFPE %d\n", SIGFPE);
191 printf("#define VKI_SIGHUP %d\n", SIGHUP);
192 printf("#define VKI_SIGINT %d\n", SIGINT);
193 printf("#define VKI_SIGQUIT %d\n", SIGQUIT);
194 printf("#define VKI_SIGABRT %d\n", SIGABRT);
195 printf("#define VKI_SIGUSR1 %d\n", SIGUSR1);
196 printf("#define VKI_SIGUSR2 %d\n", SIGUSR2);
197 printf("#define VKI_SIGPIPE %d\n", SIGPIPE);
198 printf("#define VKI_SIGALRM %d\n", SIGALRM);
199 printf("#define VKI_SIGTERM %d\n", SIGTERM);
200 printf("/* VKI_SIGSTKFLT does not exist on AIX 5.2 */\n");
201 printf("#define VKI_SIGTTIN %d\n", SIGTTIN);
202 printf("#define VKI_SIGTTOU %d\n", SIGTTOU);
203 printf("#define VKI_SIGXCPU %d\n", SIGXCPU);
204 printf("#define VKI_SIGXFSZ %d\n", SIGXFSZ);
205 printf("#define VKI_SIGVTALRM %d\n", SIGVTALRM);
206 printf("#define VKI_SIGPROF %d\n", SIGPROF);
207 printf("#define VKI_SIGIO %d\n", SIGIO);
208 printf("#define VKI_SIGPWR %d\n", SIGPWR);
209 printf("/* VKI_SIGUNUSED does not exist on AIX 5.2 */\n");
210 printf("#define VKI_SIGRTMIN %d\n", SIGRTMIN);
211 printf("#define VKI_SIGRTMAX %d\n", SIGRTMAX);
212 printf("#define VKI_SIGTRAP %d\n", SIGTRAP);
213 printf("#define VKI_SIGCONT %d\n", SIGCONT);
214 printf("#define VKI_SIGCHLD %d\n", SIGCHLD);
215 printf("#define VKI_SIGWINCH %d\n", SIGWINCH);
216 printf("#define VKI_SIGURG %d\n", SIGURG);
217 printf("#define VKI_SIGILL %d\n", SIGILL);
218 printf("#define VKI_SIGSTOP %d\n", SIGSTOP);
219 printf("#define VKI_SIGKILL %d\n", SIGKILL);
220 printf("#define VKI_SIGTSTP %d\n", SIGTSTP);
221 printf("#define VKI_SIGSYS %d\n", SIGSYS);
222
223 /* print info about struct sigaction */
224 struct sigaction sa;
225 printf("\n");
226 printf("sizeof(struct sigaction) = %d\n", (int)sizeof(struct sigaction));
227 printf(" sa_handler: off %2d sz %d\n",
228 offsetof(struct sigaction, sa_handler),
229 (int)sizeof(sa.sa_handler));
230 printf(" sa_mask: off %2d sz %d\n",
231 offsetof(struct sigaction, sa_mask),
232 (int)sizeof(sa.sa_mask));
233 printf(" sa_flags: off %2d sz %d\n",
234 offsetof(struct sigaction, sa_flags),
235 (int)sizeof(sa.sa_flags));
236 printf("sa_sigaction: off %2d sz %d\n",
237 offsetof(struct sigaction, sa_sigaction),
238 (int)sizeof(sa.sa_sigaction));
239 printf("\n");
240 printf("#define VKI_SA_ONSTACK %d\n",SA_ONSTACK );
241 printf("#define VKI_SA_RESTART %d\n",SA_RESTART );
242 printf("#define VKI_SA_RESETHAND %d\n",SA_RESETHAND );
243 printf("#define VKI_SA_SIGINFO %d\n",SA_SIGINFO);
244 printf("#define VKI_SA_NODEFER %d\n",SA_NODEFER );
245 // printf("#define VKI_SA_NOMASK %d\n",SA_NOMASK ) ;
246 // printf("#define VKI_SA_ONESHOT %d\n",SA_ONESHOT );
247 printf("#define VKI_SA_NOCLDSTOP %d\n",SA_NOCLDSTOP );
248 printf("#define VKI_SA_NOCLDWAIT %d\n",SA_NOCLDWAIT );
249 // printf("#define VKI_SA_RESTORER %d\n",SA_RESTORER );
250 printf("\n");
251 printf("#define VKI_SS_ONSTACK %d\n",SS_ONSTACK );
252 printf("#define VKI_SS_DISABLE %d\n",SS_DISABLE );
253 printf("\n");
254 printf("#define VKI_MINSIGSTKSZ %ld\n",MINSIGSTKSZ );
255 printf("\n");
256 printf("#define VKI_SI_USER %d\n",SI_USER );
257 printf("\n");
258 printf("#define VKI_SIG_BLOCK %d\n",SIG_BLOCK );
259 printf("#define VKI_SIG_SETMASK %d\n",SIG_SETMASK );
260 printf("#define VKI_SIG_UNBLOCK %d\n",SIG_UNBLOCK );
261 printf("#define VKI_SIG_IGN (void*)%d\n",(int)SIG_IGN );
262 printf("#define VKI_SIG_DFL (void*)%d\n",(int)SIG_DFL );
263 printf("\n");
264 // printf("#define VKI_SI_TKILL %d\n",SI_TKILL );
265 printf("#define VKI_SI_USER %d\n",SI_USER );
266 printf("\n");
267 printf("#define VKI_SEGV_ACCERR %d\n", SEGV_ACCERR);
268 printf("#define VKI_SEGV_MAPERR %d\n", SEGV_MAPERR);
269 printf("\n");
270 printf("#define VKI_TRAP_TRACE %d\n", TRAP_TRACE);
sewardjc9d33832007-12-22 14:12:42 +0000271 printf("#define VKI_TRAP_BRKPT %d\n", TRAP_BRKPT);
sewardj92ef1ed2006-10-17 01:04:15 +0000272 printf("#define VKI_BUS_OBJERR %d\n", BUS_OBJERR);
273 printf("#define VKI_BUS_ADRERR %d\n", BUS_ADRERR);
274 printf("#define VKI_BUS_ADRALN %d\n", BUS_ADRALN);
275 printf("#define VKI_FPE_FLTSUB %d\n", FPE_FLTSUB);
276 printf("#define VKI_FPE_FLTINV %d\n", FPE_FLTINV);
277 printf("#define VKI_FPE_FLTRES %d\n", FPE_FLTRES);
278 printf("#define VKI_FPE_FLTUND %d\n", FPE_FLTUND);
279 printf("#define VKI_FPE_FLTOVF %d\n", FPE_FLTOVF);
280 printf("#define VKI_FPE_FLTDIV %d\n", FPE_FLTDIV);
281 printf("#define VKI_FPE_INTOVF %d\n", FPE_INTOVF);
282 printf("#define VKI_FPE_INTDIV %d\n", FPE_INTDIV);
283 printf("\n");
284 printf("#define VKI_ILL_BADSTK %d\n", ILL_BADSTK);
285 printf("#define VKI_ILL_COPROC %d\n", ILL_COPROC);
286 printf("#define VKI_ILL_PRVREG %d\n", ILL_PRVREG);
287 printf("#define VKI_ILL_PRVOPC %d\n", ILL_PRVOPC);
288 printf("#define VKI_ILL_ILLTRP %d\n", ILL_ILLTRP);
289 printf("#define VKI_ILL_ILLADR %d\n", ILL_ILLADR);
290 printf("#define VKI_ILL_ILLOPN %d\n", ILL_ILLOPN);
291 printf("#define VKI_ILL_ILLOPC %d\n", ILL_ILLOPC);
292
293 /* info about siginfo_t */
294 siginfo_t si;
295 printf("\nsizeof(siginfo_t) = %d\n", (int)sizeof(siginfo_t));
296 printf(" si_signo: off %2d sz %d\n",
297 offsetof(siginfo_t, si_signo),
298 (int)sizeof(si.si_signo));
299 printf(" si_code: off %2d sz %d\n",
300 offsetof(siginfo_t, si_code),
301 (int)sizeof(si.si_code));
302 printf(" si_pid: off %2d sz %d\n",
303 offsetof(siginfo_t, si_pid),
304 (int)sizeof(si.si_pid));
305 printf(" si_addr: off %2d sz %d\n",
306 offsetof(siginfo_t, si_addr),
307 (int)sizeof(si.si_addr));
308
309 /* info about sigaltstack */
310 stack_t ss;
311 printf("\nsizeof(stack_t) = %d\n", (int)sizeof(stack_t));
312 printf(" ss_sp: off %2d sz %d\n",
313 offsetof(stack_t, ss_sp),
314 (int)sizeof(ss.ss_sp));
315 printf(" ss_size: off %2d sz %d\n",
316 offsetof(stack_t, ss_size),
317 (int)sizeof(ss.ss_size));
318 printf(" ss_flags: off %2d sz %d\n",
319 offsetof(stack_t, ss_flags),
320 (int)sizeof(ss.ss_flags));
321
322 printf("\n");
323 printf("/* ---------------- Misc ---------------- */\n");
324 printf("\n");
325 printf("#define VKI_PTRACE_TRACEME %d\n", PT_TRACE_ME);
326 printf("#define VKI_PTRACE_DETACH %d\n", PT_DETACH);
327 printf("\n");
328
329#if 0
330 printf("#define VKI_ %d\n", );
331 printf("#define VKI_ %d\n", );
332 printf("#define VKI_ %d\n", );
333 printf("#define VKI_ %d\n", );
334
335 printf("#define VKI_ 0x%08x\n", );
336 printf("#define VKI_ 0x%08x\n", );
337 printf("#define VKI_ 0x%08x\n", );
338 printf("#define VKI_ 0x%08x\n", );
339#endif
340 return 0;
341}