fix alphanumericp (lp#1377712)
[sbcl.git] / tools-for-build / grovel-headers.c
blob5c8857adf1c2d3f055bea4d924d79031e3be7a44
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(";;; Exception codes\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);
209 printf(";;; FormatMessage\n");
211 defconstant("format-message-allocate-buffer", FORMAT_MESSAGE_ALLOCATE_BUFFER);
212 defconstant("format-message-from-system", FORMAT_MESSAGE_FROM_SYSTEM);
213 defconstant("format-message-max-width-mask", FORMAT_MESSAGE_MAX_WIDTH_MASK);
214 defconstant("format-message-ignore-inserts", FORMAT_MESSAGE_IGNORE_INSERTS);
216 printf(";;; Errors\n");
218 printf(";;; Errors\n");
220 defconstant("ERROR_ENVVAR_NOT_FOUND", ERROR_ENVVAR_NOT_FOUND);
221 defconstant("ERROR_ALREADY_EXISTS", ERROR_ALREADY_EXISTS);
222 defconstant("ERROR_FILE_EXISTS", ERROR_FILE_EXISTS);
223 defconstant("ERROR_FILE_NOT_FOUND", ERROR_FILE_NOT_FOUND);
224 defconstant("ERROR_ACCESS_DENIED", ERROR_ACCESS_DENIED);
226 printf(";;; GetComputerName\n");
228 defconstant ("MAX_COMPUTERNAME_LENGTH", MAX_COMPUTERNAME_LENGTH);
229 defconstant ("ERROR_BUFFER_OVERFLOW", ERROR_BUFFER_OVERFLOW);
231 printf(";;; Windows Types\n");
232 DEFTYPE("int-ptr", INT_PTR);
233 DEFTYPE("dword", DWORD);
234 DEFTYPE("bool", BOOL);
235 DEFTYPE("uint", UINT);
236 DEFTYPE("ulong", ULONG);
238 printf(";;; File Desired Access\n");
239 defconstant ("FILE_GENERIC_READ", FILE_GENERIC_READ);
240 defconstant ("FILE_GENERIC_WRITE", FILE_GENERIC_WRITE);
241 defconstant ("FILE_GENERIC_EXECUTE", FILE_GENERIC_EXECUTE);
242 defconstant ("FILE_SHARE_READ", FILE_SHARE_READ);
243 defconstant ("FILE_SHARE_WRITE", FILE_SHARE_WRITE);
244 defconstant ("FILE_SHARE_DELETE", FILE_SHARE_DELETE);
246 printf(";;; File Creation Dispositions\n");
247 defconstant("CREATE_NEW", CREATE_NEW);
248 defconstant("CREATE_ALWAYS", CREATE_ALWAYS);
249 defconstant("OPEN_EXISTING", OPEN_EXISTING);
250 defconstant("OPEN_ALWAYS", OPEN_ALWAYS);
251 defconstant("TRUNCATE_EXISTING", TRUNCATE_EXISTING);
253 printf(";;; Desired Access\n");
254 defconstant("ACCESS_GENERIC_READ", GENERIC_READ);
255 defconstant("ACCESS_GENERIC_WRITE", GENERIC_WRITE);
256 defconstant("ACCESS_GENERIC_EXECUTE", GENERIC_EXECUTE);
257 defconstant("ACCESS_GENERIC_ALL", GENERIC_ALL);
258 defconstant("ACCESS_FILE_APPEND_DATA", FILE_APPEND_DATA);
259 defconstant("ACCESS_DELETE", DELETE);
261 printf(";;; Handle Information Flags\n");
262 defconstant("HANDLE_FLAG_INHERIT", HANDLE_FLAG_INHERIT);
263 defconstant("HANDLE_FLAG_PROTECT_FROM_CLOSE", HANDLE_FLAG_PROTECT_FROM_CLOSE);
265 printf(";;; Standard Handle Keys\n");
266 defconstant("STD_INPUT_HANDLE", STD_INPUT_HANDLE);
267 defconstant("STD_OUTPUT_HANDLE", STD_OUTPUT_HANDLE);
268 defconstant("STD_ERROR_HANDLE", STD_ERROR_HANDLE);
270 printf(";;; WinCrypt\n");
271 defconstant("crypt-verifycontext", CRYPT_VERIFYCONTEXT);
272 defconstant("crypt-silent", CRYPT_SILENT);
273 defconstant("prov-rsa-full", PROV_RSA_FULL);
275 /* FIXME: SB-UNIX and SB-WIN32 really need to be untangled. */
276 printf("(in-package \"SB!UNIX\")\n\n");
277 printf(";;; Unix-like constants and types on Windows\n");
278 defconstant("o_rdonly", _O_RDONLY);
279 defconstant("o_wronly", _O_WRONLY);
280 defconstant("o_rdwr", _O_RDWR);
281 defconstant("o_creat", _O_CREAT);
282 defconstant("o_trunc", _O_TRUNC);
283 defconstant("o_append", _O_APPEND);
284 defconstant("o_excl", _O_EXCL);
285 defconstant("o_binary", _O_BINARY);
286 defconstant("o_noinherit", _O_NOINHERIT);
288 defconstant("enoent", ENOENT);
289 defconstant("eexist", EEXIST);
290 defconstant("eintr", EINTR);
291 defconstant("eagain", EAGAIN);
292 defconstant("ebadf", EBADF);
294 defconstant("s-ifmt", S_IFMT);
295 defconstant("s-ifdir", S_IFDIR);
296 defconstant("s-ifreg", S_IFREG);
298 DEFTYPE("ino-t", ino_t);
299 DEFTYPE("time-t", time_t);
300 DEFTYPE("off-t", off_t);
301 DEFTYPE("size-t", size_t);
302 DEFTYPE("mode-t", mode_t);
304 DEFTYPE("wst-dev-t", wst_dev_t);
305 DEFTYPE("wst-ino-t", wst_ino_t);
306 DEFTYPE("wst-off-t", wst_off_t);
307 DEFTYPE("wst-blksize-t", wst_blksize_t);
308 DEFTYPE("wst-blkcnt-t", wst_blkcnt_t);
309 DEFTYPE("wst-nlink-t", wst_nlink_t);
310 DEFTYPE("wst-uid-t", wst_uid_t);
311 DEFTYPE("wst-gid-t", wst_gid_t);
313 /* KLUDGE */
314 defconstant("fd-setsize", 1024);
315 printf("\n");
316 #else
317 printf("(in-package \"SB!ALIEN\")\n\n");
319 printf (";;;flags for dlopen()\n");
321 defconstant ("rtld-lazy", RTLD_LAZY);
322 defconstant ("rtld-now", RTLD_NOW);
323 defconstant ("rtld-global", RTLD_GLOBAL);
325 printf("(in-package \"SB!UNIX\")\n\n");
327 printf(";;; select()\n");
328 defconstant("fd-setsize", FD_SETSIZE);
330 printf(";;; poll()\n");
331 defconstant("pollin", POLLIN);
332 defconstant("pollout", POLLOUT);
333 defconstant("pollpri", POLLPRI);
334 defconstant("pollhup", POLLHUP);
335 DEFTYPE("nfds-t", nfds_t);
336 #ifndef LISP_FEATURE_ANDROID
337 printf(";;; langinfo\n");
338 defconstant("codeset", CODESET);
339 #endif
340 printf(";;; types, types, types\n");
341 DEFTYPE("clock-t", clock_t);
342 DEFTYPE("dev-t", dev_t);
343 DEFTYPE("gid-t", gid_t);
344 DEFTYPE("ino-t", ino_t);
345 DEFTYPE("mode-t", mode_t);
346 DEFTYPE("nlink-t", nlink_t);
347 DEFTYPE("off-t", off_t);
348 DEFTYPE("size-t", size_t);
349 DEFTYPE("time-t", time_t);
350 #if !defined(LISP_FEATURE_OS_PROVIDES_SUSECONDS_T)
351 /* Similar kludge in sb-posix. */
352 DEFTYPE("suseconds-t", long);
353 #else
354 DEFTYPE("suseconds-t", suseconds_t);
355 #endif
356 DEFTYPE("uid-t", uid_t);
357 printf(";; Types in src/runtime/wrap.h. See that file for explantion.\n");
358 printf(";; Don't use these types for anything other than the stat wrapper.\n");
359 DEFTYPE("wst-ino-t", wst_ino_t);
360 DEFTYPE("wst-dev-t", wst_dev_t);
361 DEFTYPE("wst-off-t", wst_off_t);
362 DEFTYPE("wst-blksize-t", wst_blksize_t);
363 DEFTYPE("wst-blkcnt-t", wst_blkcnt_t);
364 DEFTYPE("wst-nlink-t", wst_nlink_t);
365 DEFTYPE("wst-uid-t", wst_uid_t);
366 DEFTYPE("wst-gid-t", wst_gid_t);
367 printf("\n");
369 printf(";;; fcntl.h (or unistd.h on OpenBSD and NetBSD)\n");
370 defconstant("r_ok", R_OK);
371 defconstant("w_ok", W_OK);
372 defconstant("x_ok", X_OK);
373 defconstant("f_ok", F_OK);
374 printf("\n");
376 printf(";;; fcntlbits.h\n");
377 defconstant("o_rdonly", O_RDONLY);
378 defconstant("o_wronly", O_WRONLY);
379 defconstant("o_rdwr", O_RDWR);
380 defconstant("o_accmode", O_ACCMODE);
381 defconstant("o_creat", O_CREAT);
382 defconstant("o_excl", O_EXCL);
383 defconstant("o_noctty", O_NOCTTY);
384 defconstant("o_trunc", O_TRUNC);
385 defconstant("o_append", O_APPEND);
386 #ifdef LISP_FEATURE_LARGEFILE
387 defconstant("o_largefile", O_LARGEFILE);
388 #endif
390 printf(";;;\n");
391 defconstant("s-ifmt", S_IFMT);
392 defconstant("s-ififo", S_IFIFO);
393 defconstant("s-ifchr", S_IFCHR);
394 defconstant("s-ifdir", S_IFDIR);
395 defconstant("s-ifblk", S_IFBLK);
396 defconstant("s-ifreg", S_IFREG);
397 printf("\n");
399 defconstant("s-iflnk", S_IFLNK);
400 defconstant("s-ifsock", S_IFSOCK);
401 printf("\n");
403 printf(";;; error numbers\n");
404 deferrno("ebadf", EBADF);
405 deferrno("enoent", ENOENT);
406 deferrno("eintr", EINTR);
407 deferrno("eagain", EAGAIN);
408 deferrno("eio", EIO);
409 deferrno("eexist", EEXIST);
410 deferrno("eloop", ELOOP);
411 deferrno("espipe", ESPIPE);
412 deferrno("ewouldblock", EWOULDBLOCK);
413 printf("\n");
415 printf(";;; for wait3(2) in run-program.lisp\n");
416 defconstant("wnohang", WNOHANG);
417 defconstant("wuntraced", WUNTRACED);
418 printf("\n");
420 printf(";;; various ioctl(2) flags\n");
421 defconstant("tiocgpgrp", TIOCGPGRP);
422 defconstant("tiocspgrp", TIOCSPGRP);
423 defconstant("tiocgwinsz", TIOCGWINSZ);
424 defconstant("tiocswinsz", TIOCSWINSZ);
425 /* KLUDGE: These are referenced by old CMUCL-derived code, but
426 * Linux doesn't define them.
428 * I think these are the BSD names, but I don't know what the
429 * corresponding SysV/Linux names are. As a point of reference,
430 * CMUCL doesn't have these defined either (although the defining
431 * forms *do* exist in src/code/unix.lisp), so I don't feel nearly
432 * so bad about not hunting them down. Insight into renamed
433 * obscure ioctl(2) flags appreciated. --njf, 2002-08-26
435 * I note that the first one I grepped for, TIOCSIGSEND, is
436 * referenced in SBCL conditional on #+HPUX. Maybe the porters of
437 * Oxbridge know more about things like that? And even if they
438 * don't, one benefit of the Rhodes crusade to heal the worthy
439 * ports should be that afterwards, if we grep for something like
440 * this in CVS and it's not there, we can lightheartedly nuke it.
441 * -- WHN 2002-08-30 */
443 defconstant("tiocsigsend", TIOCSIGSEND);
444 defconstant("tiocflush", TIOCFLUSH);
445 defconstant("tiocgetp", TIOCGETP);
446 defconstant("tiocsetp", TIOCSETP);
447 defconstant("tiocgetc", TIOCGETC);
448 defconstant("tiocsetc", TIOCSETC);
449 defconstant("tiocgltc", TIOCGLTC);
450 defconstant("tiocsltc", TIOCSLTC);
452 printf("\n");
454 printf(";;; signals\n");
455 defconstant("sig-dfl", (unsigned long)SIG_DFL);
456 defconstant("sig-ign", (unsigned long)SIG_IGN);
458 defsignal("sigalrm", SIGALRM);
459 defsignal("sigbus", SIGBUS);
460 defsignal("sigchld", SIGCHLD);
461 defsignal("sigcont", SIGCONT);
462 #ifdef SIGEMT
463 defsignal("sigemt", SIGEMT);
464 #endif
465 defsignal("sigfpe", SIGFPE);
466 defsignal("sighup", SIGHUP);
467 defsignal("sigill", SIGILL);
468 defsignal("sigint", SIGINT);
469 defsignal("sigio", SIGIO);
470 defsignal("sigiot", SIGIOT);
471 defsignal("sigkill", SIGKILL);
472 defsignal("sigpipe", SIGPIPE);
473 defsignal("sigprof", SIGPROF);
474 defsignal("sigquit", SIGQUIT);
475 defsignal("sigsegv", SIGSEGV);
476 #ifdef SIGSTKFLT
477 defsignal("sigstkflt", SIGSTKFLT);
478 #endif
479 defsignal("sigstop", SIGSTOP);
480 #ifdef SIGSYS
481 defsignal("sigsys", SIGSYS);
482 #endif
483 defsignal("sigterm", SIGTERM);
484 defsignal("sigtrap", SIGTRAP);
485 defsignal("sigtstp", SIGTSTP);
486 defsignal("sigttin", SIGTTIN);
487 defsignal("sigttou", SIGTTOU);
488 defsignal("sigurg", SIGURG);
489 defsignal("sigusr1", SIGUSR1);
490 defsignal("sigusr2", SIGUSR2);
491 defsignal("sigvtalrm", SIGVTALRM);
492 #ifdef SIGWAITING
493 defsignal("sigwaiting", SIGWAITING);
494 #endif
495 defsignal("sigwinch", SIGWINCH);
496 #ifdef SIGXCPU
497 defsignal("sigxcpu", SIGXCPU);
498 #endif
499 #ifdef SIGXFSZ
500 defsignal("sigxfsz", SIGXFSZ);
501 #endif
503 /* Floating point exception codes. Some of these
504 * are missing on Darwin. */
505 #ifdef FPE_INTOVF
506 defconstant("fpe-intovf", FPE_INTOVF);
507 #else
508 defconstant("fpe-intovf", -1);
509 #endif
510 #ifdef FPE_INTDIV
511 defconstant("fpe-intdiv", FPE_INTDIV);
512 #else
513 defconstant("fpe-intdiv", -1);
514 #endif
515 defconstant("fpe-fltdiv", FPE_FLTDIV);
516 defconstant("fpe-fltovf", FPE_FLTOVF);
517 defconstant("fpe-fltund", FPE_FLTUND);
518 defconstant("fpe-fltres", FPE_FLTRES);
519 defconstant("fpe-fltinv", FPE_FLTINV);
520 #ifdef FPE_FLTSUB
521 defconstant("fpe-fltsub", FPE_FLTSUB);
522 #else
523 defconstant("fpe-fltsub", -1);
524 #endif
525 #endif // !WIN32
526 printf("\n");
528 printf(";;; structures\n");
529 DEFSTRUCT(timeval, struct timeval,
530 DEFSLOT(tv-sec, tv_sec);
531 DEFSLOT(tv-usec, tv_usec));
532 DEFSTRUCT(timespec, struct timespec,
533 DEFSLOT(tv-sec, tv_sec);
534 DEFSLOT(tv-nsec, tv_nsec));
535 printf("\n");
537 #ifdef LISP_FEATURE_ANDROID
538 defconstant("path-max", PATH_MAX);
539 printf("\n");
540 #endif
542 #ifdef LISP_FEATURE_BSD
543 printf(";;; sysctl(3) names\n");
544 printf("(in-package \"SB!IMPL\")\n");
545 defconstant("ctl-kern", CTL_KERN);
546 defconstant("ctl-hw", CTL_HW);
547 defconstant("ctl-maxname", CTL_MAXNAME);
548 defconstant("kern-ostype", KERN_OSTYPE);
549 defconstant("kern-osrelease", KERN_OSRELEASE);
550 defconstant("hw-model", HW_MODEL);
551 defconstant("hw-pagesize", HW_PAGESIZE);
553 defconstant("path-max", PATH_MAX);
554 printf("\n");
555 #endif
557 printf("(in-package \"SB!KERNEL\")\n\n");
558 #ifdef LISP_FEATURE_GENCGC
559 printf(";;; GENCGC related\n");
560 DEFTYPE("page-index-t", page_index_t);
561 DEFTYPE("generation-index-t", generation_index_t);
562 printf("\n");
563 #endif
565 printf(";;; Our runtime types\n");
566 DEFTYPE("os-vm-size-t", os_vm_size_t);
568 return 0;