Unbreak non-x86 builds
[sbcl.git] / tools-for-build / grovel-headers.c
blob3a546df5fcf4bce953891e261bee0ab1b96b746f
1 /*
2 * Rummage through the system header files using the C compiler itself
3 * as a parser, extracting stuff like preprocessor constants and the
4 * sizes and signedness of basic system types, and write it out as
5 * Lisp code.
6 */
8 /*
9 * This software is part of the SBCL system. See the README file for
10 * more information.
12 * While most of SBCL is derived from the CMU CL system, many
13 * utilities for the build process (like this one) were written from
14 * scratch after the fork from CMU CL.
16 * This software is in the public domain and is provided with
17 * absolutely no warranty. See the COPYING and CREDITS files for
18 * more information.
21 #include "genesis/config.h"
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <sys/types.h>
26 #ifdef _WIN32
27 /* KLUDGE: From src/runtime/runtime.h, avoid double definition of
28 boolean. We really should clean up our act on this one. */
29 #define boolean rpcndr_boolean
30 #define WIN32_LEAN_AND_MEAN
31 #include <windows.h>
32 #include <shlobj.h>
33 #include <wincrypt.h>
34 #include <winsock2.h>
35 #undef boolean
36 #else
37 #include <poll.h>
38 #include <sys/select.h>
39 #include <sys/times.h>
40 #include <sys/wait.h>
41 #include <sys/ioctl.h>
42 #ifdef LISP_FEATURE_ANDROID
43 #include <termios.h>
44 #else
45 #include <sys/termios.h>
46 #include <langinfo.h>
47 #endif
48 #include <sys/time.h>
49 #include <dlfcn.h>
50 #endif
52 #include <sys/stat.h>
53 #include <fcntl.h>
54 #include <unistd.h>
55 #include <signal.h>
56 #include <errno.h>
57 #include <time.h>
59 #ifdef LISP_FEATURE_HPUX
60 #include <sys/bsdtty.h> /* for TIOCGPGRP */
61 #endif
63 #ifdef LISP_FEATURE_BSD
64 #include <sys/param.h>
65 #include <sys/sysctl.h>
66 #endif
68 #ifdef _WIN32
69 #include "pthreads_win32.h"
70 #endif
72 #include "wrap.h"
73 #include "gc.h"
75 #define DEFTYPE(lispname,cname) { cname foo; \
76 printf("(define-alien-type " lispname " (%s %d))\n", (((foo=-1)<0) ? "signed" : "unsigned"), (8 * (sizeof foo))); }
78 #define DEFSTRUCT(lispname,cname,body) { cname bar; \
79 printf("(define-alien-type nil\n (struct %s", #lispname); \
80 body; \
81 printf("))\n"); }
82 #define DEFSLOT(lispname,cname) \
83 printf("\n (%s (%s %d))", \
84 #lispname, \
85 (((bar.cname=-1)<0) ? "signed" : "unsigned"), \
86 (8 * (sizeof bar.cname)))
88 void
89 defconstant(char* lisp_name, unsigned long unix_number)
91 printf("(defconstant %s %lu) ; #x%lx\n",
92 lisp_name, unix_number, unix_number);
95 void deferrno(char* lisp_name, unsigned long unix_number)
97 defconstant(lisp_name, unix_number);
100 void defsignal(char* lisp_name, unsigned long unix_number)
102 defconstant(lisp_name, unix_number);
106 main(int argc, char *argv[])
108 /* don't need no steenking command line arguments */
109 if (1 != argc) {
110 fprintf(stderr, "argh! command line argument(s)\n");
111 exit(1);
114 /* don't need no steenking hand-editing */
115 printf(
116 ";;;; This is an automatically generated file, please do not hand-edit it.\n\
117 ;;;; See the program \"grovel-headers.c\".\n\
120 #ifdef _WIN32
121 printf("(in-package \"SB!WIN32\")\n\n");
123 defconstant ("input-record-size", sizeof (INPUT_RECORD));
125 defconstant ("MAX_PATH", MAX_PATH);
127 printf(";;; CSIDL\n");
129 defconstant ("CSIDL_DESKTOP", CSIDL_DESKTOP);
130 defconstant ("CSIDL_INTERNET", CSIDL_INTERNET);
131 defconstant ("CSIDL_PROGRAMS", CSIDL_PROGRAMS);
132 defconstant ("CSIDL_CONTROLS", CSIDL_CONTROLS);
133 defconstant ("CSIDL_PRINTERS", CSIDL_PRINTERS);
134 defconstant ("CSIDL_PERSONAL", CSIDL_PERSONAL);
135 defconstant ("CSIDL_FAVORITES", CSIDL_FAVORITES);
136 defconstant ("CSIDL_STARTUP", CSIDL_STARTUP);
137 defconstant ("CSIDL_RECENT", CSIDL_RECENT);
138 defconstant ("CSIDL_SENDTO", CSIDL_SENDTO);
139 defconstant ("CSIDL_BITBUCKET", CSIDL_BITBUCKET);
140 defconstant ("CSIDL_STARTMENU", CSIDL_STARTMENU);
141 defconstant ("CSIDL_DESKTOPDIRECTORY", CSIDL_DESKTOPDIRECTORY);
142 defconstant ("CSIDL_DRIVES", CSIDL_DRIVES);
143 defconstant ("CSIDL_NETWORK", CSIDL_NETWORK);
144 defconstant ("CSIDL_NETHOOD", CSIDL_NETHOOD);
145 defconstant ("CSIDL_FONTS", CSIDL_FONTS);
146 defconstant ("CSIDL_TEMPLATES", CSIDL_TEMPLATES);
147 defconstant ("CSIDL_COMMON_STARTMENU", CSIDL_COMMON_STARTMENU);
148 defconstant ("CSIDL_COMMON_PROGRAMS", CSIDL_COMMON_PROGRAMS);
149 defconstant ("CSIDL_COMMON_STARTUP", CSIDL_COMMON_STARTUP);
150 defconstant ("CSIDL_COMMON_DESKTOPDIRECTORY", CSIDL_COMMON_DESKTOPDIRECTORY);
151 defconstant ("CSIDL_APPDATA", CSIDL_APPDATA);
152 defconstant ("CSIDL_PRINTHOOD", CSIDL_PRINTHOOD);
153 defconstant ("CSIDL_LOCAL_APPDATA", CSIDL_LOCAL_APPDATA);
154 defconstant ("CSIDL_ALTSTARTUP", CSIDL_ALTSTARTUP);
155 defconstant ("CSIDL_COMMON_ALTSTARTUP", CSIDL_COMMON_ALTSTARTUP);
156 defconstant ("CSIDL_COMMON_FAVORITES", CSIDL_COMMON_FAVORITES);
157 defconstant ("CSIDL_INTERNET_CACHE", CSIDL_INTERNET_CACHE);
158 defconstant ("CSIDL_COOKIES", CSIDL_COOKIES);
159 defconstant ("CSIDL_HISTORY", CSIDL_HISTORY);
160 defconstant ("CSIDL_COMMON_APPDATA", CSIDL_COMMON_APPDATA);
161 defconstant ("CSIDL_WINDOWS", CSIDL_WINDOWS);
162 defconstant ("CSIDL_SYSTEM", CSIDL_SYSTEM);
163 defconstant ("CSIDL_PROGRAM_FILES", CSIDL_PROGRAM_FILES);
164 defconstant ("CSIDL_MYPICTURES", CSIDL_MYPICTURES);
165 defconstant ("CSIDL_PROFILE", CSIDL_PROFILE);
166 defconstant ("CSIDL_SYSTEMX86", CSIDL_SYSTEMX86);
167 defconstant ("CSIDL_PROGRAM_FILESX86", CSIDL_PROGRAM_FILESX86);
168 defconstant ("CSIDL_PROGRAM_FILES_COMMON", CSIDL_PROGRAM_FILES_COMMON);
169 defconstant ("CSIDL_PROGRAM_FILES_COMMONX86", CSIDL_PROGRAM_FILES_COMMONX86);
170 defconstant ("CSIDL_COMMON_TEMPLATES", CSIDL_COMMON_TEMPLATES);
171 defconstant ("CSIDL_COMMON_DOCUMENTS", CSIDL_COMMON_DOCUMENTS);
172 defconstant ("CSIDL_COMMON_ADMINTOOLS", CSIDL_COMMON_ADMINTOOLS);
173 defconstant ("CSIDL_ADMINTOOLS", CSIDL_ADMINTOOLS);
174 defconstant ("CSIDL_CONNECTIONS", CSIDL_CONNECTIONS);
175 defconstant ("CSIDL_COMMON_MUSIC", CSIDL_COMMON_MUSIC);
176 defconstant ("CSIDL_COMMON_PICTURES", CSIDL_COMMON_PICTURES);
177 defconstant ("CSIDL_COMMON_VIDEO", CSIDL_COMMON_VIDEO);
178 defconstant ("CSIDL_RESOURCES", CSIDL_RESOURCES);
179 defconstant ("CSIDL_RESOURCES_LOCALIZED", CSIDL_RESOURCES_LOCALIZED);
180 defconstant ("CSIDL_COMMON_OEM_LINKS", CSIDL_COMMON_OEM_LINKS);
181 defconstant ("CSIDL_CDBURN_AREA", CSIDL_CDBURN_AREA);
182 defconstant ("CSIDL_COMPUTERSNEARME", CSIDL_COMPUTERSNEARME);
183 defconstant ("CSIDL_FLAG_DONT_VERIFY", CSIDL_FLAG_DONT_VERIFY);
184 defconstant ("CSIDL_FLAG_CREATE", CSIDL_FLAG_CREATE);
185 defconstant ("CSIDL_FLAG_MASK", CSIDL_FLAG_MASK);
187 printf(";;; Exceptions\n");
188 defconstant("+exception-access-violation+", EXCEPTION_ACCESS_VIOLATION);
189 defconstant("+exception-array-bounds-exceeded+", EXCEPTION_ARRAY_BOUNDS_EXCEEDED);
190 defconstant("+exception-breakpoint+", EXCEPTION_BREAKPOINT);
191 defconstant("+exception-datatype-misalignment+", EXCEPTION_DATATYPE_MISALIGNMENT);
192 defconstant("+exception-flt-denormal-operand+", EXCEPTION_FLT_DENORMAL_OPERAND);
193 defconstant("+exception-flt-divide-by-zero+", EXCEPTION_FLT_DIVIDE_BY_ZERO);
194 defconstant("+exception-flt-inexact-result+", EXCEPTION_FLT_INEXACT_RESULT);
195 defconstant("+exception-flt-invalid-operation+", EXCEPTION_FLT_INVALID_OPERATION);
196 defconstant("+exception-flt-overflow+", EXCEPTION_FLT_OVERFLOW);
197 defconstant("+exception-flt-stack-check+", EXCEPTION_FLT_STACK_CHECK);
198 defconstant("+exception-flt-underflow+", EXCEPTION_FLT_UNDERFLOW);
199 defconstant("+exception-illegal-instruction+", EXCEPTION_ILLEGAL_INSTRUCTION);
200 defconstant("+exception-in-page-error+", EXCEPTION_IN_PAGE_ERROR);
201 defconstant("+exception-int-divide-by-zero+", EXCEPTION_INT_DIVIDE_BY_ZERO);
202 defconstant("+exception-int-overflow+", EXCEPTION_INT_OVERFLOW);
203 defconstant("+exception-invalid-disposition+", EXCEPTION_INVALID_DISPOSITION);
204 defconstant("+exception-noncontinuable-exception+", EXCEPTION_NONCONTINUABLE_EXCEPTION);
205 defconstant("+exception-priv-instruction+", EXCEPTION_PRIV_INSTRUCTION);
206 defconstant("+exception-single-step+", EXCEPTION_SINGLE_STEP);
207 defconstant("+exception-stack-overflow+", EXCEPTION_STACK_OVERFLOW);
208 defconstant("+dbg-printexception-c+", DBG_PRINTEXCEPTION_C);
210 defconstant("+exception-maximum-parameters+", EXCEPTION_MAXIMUM_PARAMETERS);
212 printf(";;; FormatMessage\n");
214 defconstant("format-message-allocate-buffer", FORMAT_MESSAGE_ALLOCATE_BUFFER);
215 defconstant("format-message-from-system", FORMAT_MESSAGE_FROM_SYSTEM);
216 defconstant("format-message-max-width-mask", FORMAT_MESSAGE_MAX_WIDTH_MASK);
217 defconstant("format-message-ignore-inserts", FORMAT_MESSAGE_IGNORE_INSERTS);
219 printf(";;; Errors\n");
221 printf(";;; Errors\n");
223 defconstant("ERROR_ENVVAR_NOT_FOUND", ERROR_ENVVAR_NOT_FOUND);
224 defconstant("ERROR_ALREADY_EXISTS", ERROR_ALREADY_EXISTS);
225 defconstant("ERROR_FILE_EXISTS", ERROR_FILE_EXISTS);
226 defconstant("ERROR_FILE_NOT_FOUND", ERROR_FILE_NOT_FOUND);
227 defconstant("ERROR_ACCESS_DENIED", ERROR_ACCESS_DENIED);
229 printf(";;; GetComputerName\n");
231 defconstant ("MAX_COMPUTERNAME_LENGTH", MAX_COMPUTERNAME_LENGTH);
232 defconstant ("ERROR_BUFFER_OVERFLOW", ERROR_BUFFER_OVERFLOW);
234 printf(";;; Windows Types\n");
235 DEFTYPE("int-ptr", INT_PTR);
236 DEFTYPE("dword", DWORD);
237 DEFTYPE("bool", BOOL);
238 DEFTYPE("uint", UINT);
239 DEFTYPE("ulong", ULONG);
241 printf(";;; File Desired Access\n");
242 defconstant ("FILE_GENERIC_READ", FILE_GENERIC_READ);
243 defconstant ("FILE_GENERIC_WRITE", FILE_GENERIC_WRITE);
244 defconstant ("FILE_GENERIC_EXECUTE", FILE_GENERIC_EXECUTE);
245 defconstant ("FILE_SHARE_READ", FILE_SHARE_READ);
246 defconstant ("FILE_SHARE_WRITE", FILE_SHARE_WRITE);
247 defconstant ("FILE_SHARE_DELETE", FILE_SHARE_DELETE);
249 printf(";;; File Creation Dispositions\n");
250 defconstant("CREATE_NEW", CREATE_NEW);
251 defconstant("CREATE_ALWAYS", CREATE_ALWAYS);
252 defconstant("OPEN_EXISTING", OPEN_EXISTING);
253 defconstant("OPEN_ALWAYS", OPEN_ALWAYS);
254 defconstant("TRUNCATE_EXISTING", TRUNCATE_EXISTING);
256 printf(";;; Desired Access\n");
257 defconstant("ACCESS_GENERIC_READ", GENERIC_READ);
258 defconstant("ACCESS_GENERIC_WRITE", GENERIC_WRITE);
259 defconstant("ACCESS_GENERIC_EXECUTE", GENERIC_EXECUTE);
260 defconstant("ACCESS_GENERIC_ALL", GENERIC_ALL);
261 defconstant("ACCESS_FILE_APPEND_DATA", FILE_APPEND_DATA);
262 defconstant("ACCESS_DELETE", DELETE);
264 printf(";;; Handle Information Flags\n");
265 defconstant("HANDLE_FLAG_INHERIT", HANDLE_FLAG_INHERIT);
266 defconstant("HANDLE_FLAG_PROTECT_FROM_CLOSE", HANDLE_FLAG_PROTECT_FROM_CLOSE);
268 printf(";;; Standard Handle Keys\n");
269 defconstant("STD_INPUT_HANDLE", STD_INPUT_HANDLE);
270 defconstant("STD_OUTPUT_HANDLE", STD_OUTPUT_HANDLE);
271 defconstant("STD_ERROR_HANDLE", STD_ERROR_HANDLE);
273 printf(";;; WinCrypt\n");
274 defconstant("crypt-verifycontext", CRYPT_VERIFYCONTEXT);
275 defconstant("crypt-silent", CRYPT_SILENT);
276 defconstant("prov-rsa-full", PROV_RSA_FULL);
278 /* FIXME: SB-UNIX and SB-WIN32 really need to be untangled. */
279 printf("(in-package \"SB!UNIX\")\n\n");
280 printf(";;; Unix-like constants and types on Windows\n");
281 defconstant("o_rdonly", _O_RDONLY);
282 defconstant("o_wronly", _O_WRONLY);
283 defconstant("o_rdwr", _O_RDWR);
284 defconstant("o_creat", _O_CREAT);
285 defconstant("o_trunc", _O_TRUNC);
286 defconstant("o_append", _O_APPEND);
287 defconstant("o_excl", _O_EXCL);
288 defconstant("o_binary", _O_BINARY);
289 defconstant("o_noinherit", _O_NOINHERIT);
291 defconstant("enoent", ENOENT);
292 defconstant("eexist", EEXIST);
293 defconstant("eintr", EINTR);
294 defconstant("eagain", EAGAIN);
295 defconstant("ebadf", EBADF);
297 defconstant("s-ifmt", S_IFMT);
298 defconstant("s-ifdir", S_IFDIR);
299 defconstant("s-ifreg", S_IFREG);
301 DEFTYPE("ino-t", ino_t);
302 DEFTYPE("time-t", time_t);
303 DEFTYPE("off-t", off_t);
304 DEFTYPE("size-t", size_t);
305 DEFTYPE("mode-t", mode_t);
307 DEFTYPE("wst-dev-t", wst_dev_t);
308 DEFTYPE("wst-ino-t", wst_ino_t);
309 DEFTYPE("wst-off-t", wst_off_t);
310 DEFTYPE("wst-blksize-t", wst_blksize_t);
311 DEFTYPE("wst-blkcnt-t", wst_blkcnt_t);
312 DEFTYPE("wst-nlink-t", wst_nlink_t);
313 DEFTYPE("wst-uid-t", wst_uid_t);
314 DEFTYPE("wst-gid-t", wst_gid_t);
316 /* KLUDGE */
317 defconstant("fd-setsize", 1024);
318 printf("\n");
319 #else
320 printf("(in-package \"SB!ALIEN\")\n\n");
322 printf (";;;flags for dlopen()\n");
324 defconstant ("rtld-lazy", RTLD_LAZY);
325 defconstant ("rtld-now", RTLD_NOW);
326 defconstant ("rtld-global", RTLD_GLOBAL);
328 printf("(in-package \"SB!UNIX\")\n\n");
330 printf(";;; select()\n");
331 defconstant("fd-setsize", FD_SETSIZE);
333 printf(";;; poll()\n");
334 defconstant("pollin", POLLIN);
335 defconstant("pollout", POLLOUT);
336 defconstant("pollpri", POLLPRI);
337 defconstant("pollhup", POLLHUP);
338 defconstant("pollnval", POLLNVAL);
339 defconstant("pollerr", POLLERR);
340 DEFTYPE("nfds-t", nfds_t);
341 #ifndef LISP_FEATURE_ANDROID
342 printf(";;; langinfo\n");
343 defconstant("codeset", CODESET);
344 #endif
345 printf(";;; types, types, types\n");
346 DEFTYPE("clock-t", clock_t);
347 DEFTYPE("dev-t", dev_t);
348 DEFTYPE("gid-t", gid_t);
349 DEFTYPE("ino-t", ino_t);
350 DEFTYPE("mode-t", mode_t);
351 DEFTYPE("nlink-t", nlink_t);
352 DEFTYPE("off-t", off_t);
353 DEFTYPE("size-t", size_t);
354 DEFTYPE("time-t", time_t);
355 #if !defined(LISP_FEATURE_OS_PROVIDES_SUSECONDS_T)
356 /* Similar kludge in sb-posix. */
357 DEFTYPE("suseconds-t", long);
358 #else
359 DEFTYPE("suseconds-t", suseconds_t);
360 #endif
361 DEFTYPE("uid-t", uid_t);
362 printf(";; Types in src/runtime/wrap.h. See that file for explantion.\n");
363 printf(";; Don't use these types for anything other than the stat wrapper.\n");
364 DEFTYPE("wst-ino-t", wst_ino_t);
365 DEFTYPE("wst-dev-t", wst_dev_t);
366 DEFTYPE("wst-off-t", wst_off_t);
367 DEFTYPE("wst-blksize-t", wst_blksize_t);
368 DEFTYPE("wst-blkcnt-t", wst_blkcnt_t);
369 DEFTYPE("wst-nlink-t", wst_nlink_t);
370 DEFTYPE("wst-uid-t", wst_uid_t);
371 DEFTYPE("wst-gid-t", wst_gid_t);
372 printf("\n");
374 printf(";;; fcntl.h (or unistd.h on OpenBSD and NetBSD)\n");
375 defconstant("r_ok", R_OK);
376 defconstant("w_ok", W_OK);
377 defconstant("x_ok", X_OK);
378 defconstant("f_ok", F_OK);
379 printf("\n");
381 printf(";;; fcntlbits.h\n");
382 defconstant("o_rdonly", O_RDONLY);
383 defconstant("o_wronly", O_WRONLY);
384 defconstant("o_rdwr", O_RDWR);
385 defconstant("o_accmode", O_ACCMODE);
386 defconstant("o_creat", O_CREAT);
387 defconstant("o_excl", O_EXCL);
388 defconstant("o_noctty", O_NOCTTY);
389 defconstant("o_trunc", O_TRUNC);
390 defconstant("o_append", O_APPEND);
391 #ifdef LISP_FEATURE_LARGEFILE
392 defconstant("o_largefile", O_LARGEFILE);
393 #endif
395 printf(";;;\n");
396 defconstant("s-ifmt", S_IFMT);
397 defconstant("s-ififo", S_IFIFO);
398 defconstant("s-ifchr", S_IFCHR);
399 defconstant("s-ifdir", S_IFDIR);
400 defconstant("s-ifblk", S_IFBLK);
401 defconstant("s-ifreg", S_IFREG);
402 printf("\n");
404 defconstant("s-iflnk", S_IFLNK);
405 defconstant("s-ifsock", S_IFSOCK);
406 printf("\n");
408 printf(";;; error numbers\n");
409 deferrno("ebadf", EBADF);
410 deferrno("enoent", ENOENT);
411 deferrno("eintr", EINTR);
412 deferrno("eagain", EAGAIN);
413 deferrno("eio", EIO);
414 deferrno("eexist", EEXIST);
415 deferrno("eloop", ELOOP);
416 deferrno("espipe", ESPIPE);
417 deferrno("ewouldblock", EWOULDBLOCK);
418 printf("\n");
420 printf(";;; for wait3(2) in run-program.lisp\n");
421 defconstant("wnohang", WNOHANG);
422 defconstant("wuntraced", WUNTRACED);
423 printf("\n");
425 printf(";;; various ioctl(2) flags\n");
426 defconstant("tiocgpgrp", TIOCGPGRP);
427 defconstant("tiocspgrp", TIOCSPGRP);
428 defconstant("tiocgwinsz", TIOCGWINSZ);
429 defconstant("tiocswinsz", TIOCSWINSZ);
430 /* KLUDGE: These are referenced by old CMUCL-derived code, but
431 * Linux doesn't define them.
433 * I think these are the BSD names, but I don't know what the
434 * corresponding SysV/Linux names are. As a point of reference,
435 * CMUCL doesn't have these defined either (although the defining
436 * forms *do* exist in src/code/unix.lisp), so I don't feel nearly
437 * so bad about not hunting them down. Insight into renamed
438 * obscure ioctl(2) flags appreciated. --njf, 2002-08-26
440 * I note that the first one I grepped for, TIOCSIGSEND, is
441 * referenced in SBCL conditional on #+HPUX. Maybe the porters of
442 * Oxbridge know more about things like that? And even if they
443 * don't, one benefit of the Rhodes crusade to heal the worthy
444 * ports should be that afterwards, if we grep for something like
445 * this in CVS and it's not there, we can lightheartedly nuke it.
446 * -- WHN 2002-08-30 */
448 defconstant("tiocsigsend", TIOCSIGSEND);
449 defconstant("tiocflush", TIOCFLUSH);
450 defconstant("tiocgetp", TIOCGETP);
451 defconstant("tiocsetp", TIOCSETP);
452 defconstant("tiocgetc", TIOCGETC);
453 defconstant("tiocsetc", TIOCSETC);
454 defconstant("tiocgltc", TIOCGLTC);
455 defconstant("tiocsltc", TIOCSLTC);
457 printf("\n");
459 printf(";;; signals\n");
460 defconstant("sig-dfl", (unsigned long)SIG_DFL);
461 defconstant("sig-ign", (unsigned long)SIG_IGN);
463 defsignal("sigalrm", SIGALRM);
464 defsignal("sigbus", SIGBUS);
465 defsignal("sigchld", SIGCHLD);
466 defsignal("sigcont", SIGCONT);
467 #ifdef SIGEMT
468 defsignal("sigemt", SIGEMT);
469 #endif
470 defsignal("sigfpe", SIGFPE);
471 defsignal("sighup", SIGHUP);
472 defsignal("sigill", SIGILL);
473 defsignal("sigint", SIGINT);
474 defsignal("sigio", SIGIO);
475 defsignal("sigiot", SIGIOT);
476 defsignal("sigkill", SIGKILL);
477 defsignal("sigpipe", SIGPIPE);
478 defsignal("sigprof", SIGPROF);
479 defsignal("sigquit", SIGQUIT);
480 defsignal("sigsegv", SIGSEGV);
481 #ifdef SIGSTKFLT
482 defsignal("sigstkflt", SIGSTKFLT);
483 #endif
484 defsignal("sigstop", SIGSTOP);
485 #ifdef SIGSYS
486 defsignal("sigsys", SIGSYS);
487 #endif
488 defsignal("sigterm", SIGTERM);
489 defsignal("sigtrap", SIGTRAP);
490 defsignal("sigtstp", SIGTSTP);
491 defsignal("sigttin", SIGTTIN);
492 defsignal("sigttou", SIGTTOU);
493 defsignal("sigurg", SIGURG);
494 defsignal("sigusr1", SIGUSR1);
495 defsignal("sigusr2", SIGUSR2);
496 defsignal("sigvtalrm", SIGVTALRM);
497 #ifdef SIGWAITING
498 defsignal("sigwaiting", SIGWAITING);
499 #endif
500 defsignal("sigwinch", SIGWINCH);
501 #ifdef SIGXCPU
502 defsignal("sigxcpu", SIGXCPU);
503 #endif
504 #ifdef SIGXFSZ
505 defsignal("sigxfsz", SIGXFSZ);
506 #endif
508 /* Floating point exception codes. Some of these
509 * are missing on Darwin. */
510 #ifdef FPE_INTOVF
511 defconstant("fpe-intovf", FPE_INTOVF);
512 #else
513 defconstant("fpe-intovf", -1);
514 #endif
515 #ifdef FPE_INTDIV
516 defconstant("fpe-intdiv", FPE_INTDIV);
517 #else
518 defconstant("fpe-intdiv", -1);
519 #endif
520 defconstant("fpe-fltdiv", FPE_FLTDIV);
521 defconstant("fpe-fltovf", FPE_FLTOVF);
522 defconstant("fpe-fltund", FPE_FLTUND);
523 defconstant("fpe-fltres", FPE_FLTRES);
524 defconstant("fpe-fltinv", FPE_FLTINV);
525 #ifdef FPE_FLTSUB
526 defconstant("fpe-fltsub", FPE_FLTSUB);
527 #else
528 defconstant("fpe-fltsub", -1);
529 #endif
530 #endif // !WIN32
531 printf("\n");
533 printf(";;; structures\n");
534 DEFSTRUCT(timeval, struct timeval,
535 DEFSLOT(tv-sec, tv_sec);
536 DEFSLOT(tv-usec, tv_usec));
537 DEFSTRUCT(timespec, struct timespec,
538 DEFSLOT(tv-sec, tv_sec);
539 DEFSLOT(tv-nsec, tv_nsec));
540 printf("\n");
542 #ifdef LISP_FEATURE_ANDROID
543 defconstant("path-max", PATH_MAX);
544 printf("\n");
545 #endif
547 #ifdef LISP_FEATURE_BSD
548 printf(";;; sysctl(3) names\n");
549 printf("(in-package \"SB!IMPL\")\n");
550 defconstant("ctl-kern", CTL_KERN);
551 defconstant("ctl-hw", CTL_HW);
552 defconstant("ctl-maxname", CTL_MAXNAME);
553 defconstant("kern-ostype", KERN_OSTYPE);
554 defconstant("kern-osrelease", KERN_OSRELEASE);
555 defconstant("hw-model", HW_MODEL);
556 defconstant("hw-pagesize", HW_PAGESIZE);
558 defconstant("path-max", PATH_MAX);
559 printf("\n");
560 #endif
562 printf("(in-package \"SB!KERNEL\")\n\n");
563 #ifdef LISP_FEATURE_GENCGC
564 printf(";;; GENCGC related\n");
565 DEFTYPE("page-index-t", page_index_t);
566 DEFTYPE("generation-index-t", generation_index_t);
567 printf("\n");
568 #endif
570 printf(";;; Our runtime types\n");
571 DEFTYPE("os-vm-size-t", os_vm_size_t);
573 return 0;