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