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
9 * This software is part of the SBCL system. See the README file for
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
22 #include <sys/types.h>
23 #include <sys/times.h>
26 #include <sys/ioctl.h>
27 #include <sys/termios.h>
33 #include "../src/runtime/ppc-darwin-dlshim.h"
34 #include "../src/runtime/ppc-darwin-langinfo.h"
40 #include "genesis/config.h"
42 #define DEFTYPE(lispname,cname) { cname foo; \
43 printf("(define-alien-type " lispname " (%s %d))\n", (((foo=-1)<0) ? "sb!alien:signed" : "unsigned"), (8 * (sizeof foo))); }
46 defconstant(char* lisp_name, long unix_number)
48 printf("(defconstant %s %ld) ; #x%lx\n",
49 lisp_name, unix_number, unix_number);
52 #define DEFERRNO(name) defconstant(#name, name)
53 #define DEFSIGNAL(name) defconstant(#name, name)
56 main(int argc, char *argv[])
58 /* don't need no steenking command line arguments */
60 fprintf(stderr, "argh! command line argument(s)\n");
64 /* don't need no steenking hand-editing */
66 ";;;; This is an automatically generated file, please do not hand-edit it.\n\
67 ;;;; See the program \"grovel-headers.c\".\n\
71 printf("(in-package \"SB!ALIEN\")\n\n");
73 printf (";;;flags for dlopen()\n");
75 defconstant ("rtld-lazy", RTLD_LAZY);
76 defconstant ("rtld-now", RTLD_NOW);
77 defconstant ("rtld-global", RTLD_GLOBAL);
79 printf("(in-package \"SB!UNIX\")\n\n");
81 printf(";;; langinfo\n");
82 defconstant("codeset", CODESET);
84 printf(";;; types, types, types\n");
85 DEFTYPE("clock-t", clock_t);
86 DEFTYPE("dev-t", dev_t);
87 DEFTYPE("gid-t", gid_t);
88 DEFTYPE("ino-t", ino_t);
89 DEFTYPE("mode-t", mode_t);
90 DEFTYPE("nlink-t", nlink_t);
91 DEFTYPE("off-t", off_t);
92 DEFTYPE("size-t", size_t);
93 DEFTYPE("time-t", time_t);
94 DEFTYPE("uid-t", uid_t);
97 printf(";;; fcntl.h (or unistd.h on OpenBSD and NetBSD)\n");
98 defconstant("r_ok", R_OK);
99 defconstant("w_ok", W_OK);
100 defconstant("x_ok", X_OK);
101 defconstant("f_ok", F_OK);
104 printf(";;; fcntlbits.h\n");
105 defconstant("o_rdonly", O_RDONLY);
106 defconstant("o_wronly", O_WRONLY);
107 defconstant("o_rdwr", O_RDWR);
108 defconstant("o_accmode", O_ACCMODE);
109 defconstant("o_creat", O_CREAT);
110 defconstant("o_excl", O_EXCL);
111 defconstant("o_noctty", O_NOCTTY);
112 defconstant("o_trunc", O_TRUNC);
113 defconstant("o_append", O_APPEND);
115 defconstant("s-ifmt", S_IFMT);
116 defconstant("s-ififo", S_IFIFO);
117 defconstant("s-ifchr", S_IFCHR);
118 defconstant("s-ifdir", S_IFDIR);
119 defconstant("s-ifblk", S_IFBLK);
120 defconstant("s-ifreg", S_IFREG);
123 defconstant("s-iflnk", S_IFLNK);
124 defconstant("s-ifsock", S_IFSOCK);
127 printf(";;; error numbers\n");
133 DEFERRNO(EWOULDBLOCK);
136 printf(";;; for wait3(2) in run-program.lisp\n");
137 defconstant("wnohang", WNOHANG);
138 defconstant("wuntraced", WUNTRACED);
141 printf(";;; various ioctl(2) flags\n");
142 defconstant("tiocnotty", TIOCNOTTY);
143 defconstant("tiocgwinsz", TIOCGWINSZ);
144 defconstant("tiocswinsz", TIOCSWINSZ);
145 defconstant("tiocgpgrp", TIOCGPGRP);
146 defconstant("tiocspgrp", TIOCSPGRP);
147 /* KLUDGE: These are referenced by old CMUCL-derived code, but
148 * Linux doesn't define them.
150 * I think these are the BSD names, but I don't know what the
151 * corresponding SysV/Linux names are. As a point of reference,
152 * CMUCL doesn't have these defined either (although the defining
153 * forms *do* exist in src/code/unix.lisp), so I don't feel nearly
154 * so bad about not hunting them down. Insight into renamed
155 * obscure ioctl(2) flags appreciated. --njf, 2002-08-26
157 * I note that the first one I grepped for, TIOCSIGSEND, is
158 * referenced in SBCL conditional on #+HPUX. Maybe the porters of
159 * Oxbridge know more about things like that? And even if they
160 * don't, one benefit of the Rhodes crusade to heal the worthy
161 * ports should be that afterwards, if we grep for something like
162 * this in CVS and it's not there, we can lightheartedly nuke it.
163 * -- WHN 2002-08-30 */
165 defconstant("tiocsigsend", TIOCSIGSEND);
166 defconstant("tiocflush", TIOCFLUSH);
167 defconstant("tiocgetp", TIOCGETP);
168 defconstant("tiocsetp", TIOCSETP);
169 defconstant("tiocgetc", TIOCGETC);
170 defconstant("tiocsetc", TIOCSETC);
171 defconstant("tiocgltc", TIOCGLTC);
172 defconstant("tiocsltc", TIOCSLTC);
176 printf(";;; signals\n");
195 #if ((defined LISP_FEATURE_LINUX) && (defined LISP_FEATURE_X86))
196 DEFSIGNAL(SIGSTKFLT);
199 #if (!((defined LISP_FEATURE_LINUX) && (defined LISP_FEATURE_X86)))
210 DEFSIGNAL(SIGVTALRM);
211 #ifdef LISP_FEATURE_SUNOS
212 DEFSIGNAL(SIGWAITING);
215 #ifndef LISP_FEATURE_HPUX