0.9.18.44:
[sbcl.git] / contrib / sb-posix / constants.lisp
1 ;;; -*- Lisp -*-
2
3 ;;; This isn't really lisp, but it's definitely a source file.
4
5 ;;; first, the headers necessary to find definitions of everything
6 (#||#
7  "sys/types.h"
8  "sys/stat.h"
9  #-win32 "utime.h"
10  #-win32 "sys/socket.h"
11  #-win32 "sys/un.h"
12  #-win32 "netinet/in.h"
13  #-win32 "netinet/in_systm.h"
14  #-win32 "netinet/ip.h"
15  #-win32 "net/if.h"
16  #-win32 "netinet/tcp.h"
17  #-win32 "sys/mman.h"
18  #-win32 "sys/wait.h"
19  "fcntl.h"
20  #-win32 "netdb.h"
21  "errno.h"
22  "dirent.h" "signal.h"
23  #-win32 "pwd.h"
24  "unistd.h"
25  #-win32 "termios.h")
26
27 ;;; then the stuff we're looking for
28 ((:integer af-inet "AF_INET" "IP Protocol family" t)
29
30  ;; KLUDGE: These types simply do not seem to exist on Windows,
31  ;; but we'll provide these anyways -- at least in a way that should
32  ;; match with stat.
33  (:type uid-t   #-win32 "uid_t"   #+win32 "short")
34  (:type gid-t   #-win32 "gid_t"   #+win32 "short")
35  (:type nlink-t #-win32 "nlink_t" #+win32 "short")
36
37  (:type pid-t "pid_t")
38  (:type ino-t "ino_t")
39
40  (:type time-t "time_t")
41  (:type dev-t "dev_t")
42
43  ;; signals
44  (:integer SIGHUP "SIGHUP" #+sb-doc "terminal line hangup." t)
45  (:integer SIGINT "SIGINT" #+sb-doc "interrupt program." t)
46  (:integer SIGQUIT "SIGQUIT" #+sb-doc "quit program." t)
47  (:integer SIGILL "SIGILL" #+sb-doc "illegal instruction." t)
48  (:integer SIGTRAP "SIGTRAP" #+sb-doc "trace trap." t)
49  (:integer SIGABRT "SIGABRT" #+sb-doc "abort program (formerly SIGIOT)." t)
50  (:integer SIGEMT "SIGEMT" #+sb-doc "emulate instruction executed." t)
51  (:integer SIGFPE "SIGFPE" #+sb-doc "floating-point exception." t)
52  (:integer SIGKILL "SIGKILL" #+sb-doc "kill program." t)
53  (:integer SIGBUS "SIGBUS" #+sb-doc "bus error." t)
54  (:integer SIGSEGV "SIGSEGV" #+sb-doc "segmentation violation." t)
55  (:integer SIGSYS "SIGSYS" #+sb-doc "non-existent system call invoked." t)
56  (:integer SIGPIPE "SIGPIPE" #+sb-doc "write on a pipe with no reader." t)
57  (:integer SIGALRM "SIGALRM" #+sb-doc "real-time timer expired." t)
58  (:integer SIGTERM "SIGTERM" #+sb-doc "software termination signal." t)
59  (:integer SIGURG "SIGURG" #+sb-doc "urgent condition present on socket." t)
60  (:integer SIGSTOP "SIGSTOP" #+sb-doc "stop (cannot be caught or ignored)." t)
61  (:integer SIGTSTP "SIGTSTP" #+sb-doc "stop signal generated from keyboard." t)
62  (:integer SIGCONT "SIGCONT" #+sb-doc "continue after stop." t)
63  (:integer SIGCHLD "SIGCHLD" #+sb-doc "child status has changed." t)
64  (:integer SIGTTIN "SIGTTIN"
65            #+sb-doc "background read attempted from control terminal." t)
66  (:integer SIGTTOU "SIGTTOU"
67            #+sb-doc "background write attempted to control terminal." t)
68  (:integer SIGIO "SIGIO"
69            #+sb-doc "I/O is possible on a descriptor (see fcntl(2))." t)
70  (:integer SIGXCPU "SIGXCPU"
71            #+sb-doc "cpu time limit exceeded (see setrlimit(2))." t)
72  (:integer SIGXFSZ "SIGXFSZ"
73            #+sb-doc "file size limit exceeded (see setrlimit(2))." t)
74  (:integer SIGVTALRM "SIGVTALRM"
75            #+sb-doc "virtual time alarm (see setitimer(2))." t)
76  (:integer SIGPROF "SIGPROF"
77            #+sb-doc "profiling timer alarm (see setitimer(2))." t)
78  (:integer SIGWINCH "SIGWINCH" #+sb-doc "Window size change." t)
79  (:integer SIGINFO "SIGINFO" #+sb-doc "status request from keyboard." t)
80  (:integer SIGUSR1 "SIGUSR1" #+sb-doc "User defined signal 1." t)
81  (:integer SIGUSR2 "SIGUSR2" #+sb-doc "User defined signal 2." t)
82  (:integer SIGRTMIN "SIGRTMIN" #+sb-doc "Smallest real-time signal number." t)
83  (:integer SIGRTMAX "SIGRTMAX" #+sb-doc "Largest real-time signal number." t)
84
85  ;; error numbers
86  (:integer eperm "EPERM" nil t)
87  (:integer enoent "ENOENT" nil t)
88  (:integer esrch "ESRCH" nil t)
89  (:integer eintr "EINTR" nil t)
90  (:integer eio "EIO" nil t)
91  (:integer enxio "ENXIO" nil t)
92  (:integer e2big "E2BIG" nil t)
93  (:integer enoexec "ENOEXEC" nil t)
94  (:integer ebadf "EBADF" nil t)
95  (:integer echild "ECHILD" nil t)
96  (:integer eagain "EAGAIN" nil t)
97  (:integer enomem "ENOMEM" nil t)
98  (:integer eacces "EACCES" nil t)
99  (:integer efault "EFAULT" nil t)
100  (:integer enotblk "ENOTBLK" nil t)
101  (:integer ebusy "EBUSY" nil t)
102  (:integer eexist "EEXIST" nil t)
103  (:integer exdev "EXDEV" nil t)
104  (:integer enodev "ENODEV" nil t)
105  (:integer enotdir "ENOTDIR" nil t)
106  (:integer eisdir "EISDIR" nil t)
107  (:integer einval "EINVAL" nil t)
108  (:integer enfile "ENFILE" nil t)
109  (:integer emfile "EMFILE" nil t)
110  (:integer enotty "ENOTTY" nil t)
111  (:integer etxtbsy "ETXTBSY" nil t)
112  (:integer efbig "EFBIG" nil t)
113  (:integer enospc "ENOSPC" nil t)
114  (:integer espipe "ESPIPE" nil t)
115  (:integer erofs "EROFS" nil t)
116  (:integer emlink "EMLINK" nil t)
117  (:integer epipe "EPIPE" nil t)
118  (:integer edom "EDOM" nil t)
119  (:integer erange "ERANGE" nil t)
120  (:integer edeadlk "EDEADLK" nil t)
121  (:integer enametoolong "ENAMETOOLONG" nil t)
122  (:integer enolck "ENOLCK" nil t)
123  (:integer enosys "ENOSYS" nil t)
124  (:integer enotempty "ENOTEMPTY" nil t)
125  (:integer eloop "ELOOP" nil t)
126  (:integer ewouldblock "EWOULDBLOCK" nil t)
127  (:integer enomsg "ENOMSG" nil t)
128  (:integer eidrm "EIDRM" nil t)
129  (:integer echrng "ECHRNG" nil t)
130  (:integer el2nsync "EL2NSYNC" nil t)
131  (:integer el3hlt "EL3HLT" nil t)
132  (:integer el3rst "EL3RST" nil t)
133  (:integer elnrng "ELNRNG" nil t)
134  (:integer eunatch "EUNATCH" nil t)
135  (:integer enocsi "ENOCSI" nil t)
136  (:integer el2hlt "EL2HLT" nil t)
137  (:integer ebade "EBADE" nil t)
138  (:integer ebadr "EBADR" nil t)
139  (:integer exfull "EXFULL" nil t)
140  (:integer enoano "ENOANO" nil t)
141  (:integer ebadrqc "EBADRQC" nil t)
142  (:integer ebadslt "EBADSLT" nil t)
143  (:integer edeadlock "EDEADLOCK" nil t)
144  (:integer ebfont "EBFONT" nil t)
145  (:integer enostr "ENOSTR" nil t)
146  (:integer enodata "ENODATA" nil t)
147  (:integer etime "ETIME" nil t)
148  (:integer enosr "ENOSR" nil t)
149  (:integer enonet "ENONET" nil t)
150  (:integer enopkg "ENOPKG" nil t)
151  (:integer eremote "EREMOTE" nil t)
152  (:integer enolink "ENOLINK" nil t)
153  (:integer eadv "EADV" nil t)
154  (:integer esrmnt "ESRMNT" nil t)
155  (:integer ecomm "ECOMM" nil t)
156  (:integer eproto "EPROTO" nil t)
157  (:integer emultihop "EMULTIHOP" nil t)
158  (:integer edotdot "EDOTDOT" nil t)
159  (:integer ebadmsg "EBADMSG" nil t)
160  (:integer eoverflow "EOVERFLOW" nil t)
161  (:integer enotuniq "ENOTUNIQ" nil t)
162  (:integer ebadfd "EBADFD" nil t)
163  (:integer eremchg "EREMCHG" nil t)
164  (:integer elibacc "ELIBACC" nil t)
165  (:integer elibbad "ELIBBAD" nil t)
166  (:integer elibscn "ELIBSCN" nil t)
167  (:integer elibmax "ELIBMAX" nil t)
168  (:integer elibexec "ELIBEXEC" nil t)
169  (:integer eilseq "EILSEQ" nil t)
170  (:integer erestart "ERESTART" nil t)
171  (:integer estrpipe "ESTRPIPE" nil t)
172  (:integer eusers "EUSERS" nil t)
173  (:integer enotsock "ENOTSOCK" nil t)
174  (:integer edestaddrreq "EDESTADDRREQ" nil t)
175  (:integer emsgsize "EMSGSIZE" nil t)
176  (:integer eprototype "EPROTOTYPE" nil t)
177  (:integer enoprotoopt "ENOPROTOOPT" nil t)
178  (:integer eprotonosupport "EPROTONOSUPPORT" nil t)
179  (:integer esocktnosupport "ESOCKTNOSUPPORT" nil t)
180  (:integer eopnotsupp "EOPNOTSUPP" nil t)
181  (:integer epfnosupport "EPFNOSUPPORT" nil t)
182  (:integer eafnosupport "EAFNOSUPPORT" nil t)
183  (:integer eaddrinuse "EADDRINUSE" nil t)
184  (:integer eaddrnotavail "EADDRNOTAVAIL" nil t)
185  (:integer enetdown "ENETDOWN" nil t)
186  (:integer enetunreach "ENETUNREACH" nil t)
187  (:integer enetreset "ENETRESET" nil t)
188  (:integer econnaborted "ECONNABORTED" nil t)
189  (:integer econnreset "ECONNRESET" nil t)
190  (:integer enobufs "ENOBUFS" nil t)
191  (:integer eisconn "EISCONN" nil t)
192  (:integer enotconn "ENOTCONN" nil t)
193  (:integer eshutdown "ESHUTDOWN" nil t)
194  (:integer etoomanyrefs "ETOOMANYREFS" nil t)
195  (:integer etimedout "ETIMEDOUT" nil t)
196  (:integer econnrefused "ECONNREFUSED" nil t)
197  (:integer ehostdown "EHOSTDOWN" nil t)
198  (:integer ehostunreach "EHOSTUNREACH" nil t)
199  (:integer ealready "EALREADY" nil t)
200  (:integer einprogress "EINPROGRESS" nil t)
201  (:integer estale "ESTALE" nil t)
202  (:integer euclean "EUCLEAN" nil t)
203  (:integer enotnam "ENOTNAM" nil t)
204  (:integer enavail "ENAVAIL" nil t)
205  (:integer eremoteio "EREMOTEIO" nil t)
206  (:integer edquot "EDQUOT" nil t)
207  (:integer enomedium "ENOMEDIUM" nil t)
208  (:integer emediumtype "EMEDIUMTYPE" nil t)
209
210  ;; wait
211  (:integer wnohang "WNOHANG")
212  (:integer wuntraced "WUNTRACED")
213
214  ;; mode_t
215  (:type mode-t "mode_t")
216  (:integer s-isuid "S_ISUID" nil t)
217  (:integer s-isgid "S_ISGID" nil t)
218  (:integer s-isvtx "S_ISVTX" nil t)
219  (:integer s-irusr "S_IRUSR" nil t)
220  (:integer s-iwusr "S_IWUSR" nil t)
221  (:integer s-ixusr "S_IXUSR" nil t)
222  (:integer s-iread "S_IRUSR" nil t)
223  (:integer s-iwrite "S_IWUSR" nil t)
224  (:integer s-iexec "S_IXUSR" nil t)
225  (:integer s-irgrp "S_IRGRP" nil t)
226  (:integer s-iwgrp "S_IWGRP" nil t)
227  (:integer s-ixgrp "S_IXGRP" nil t)
228  (:integer s-iroth "S_IROTH" nil t)
229  (:integer s-iwoth "S_IWOTH" nil t)
230  (:integer s-ixoth "S_IXOTH" nil t)
231
232  ;; access()
233  (:integer r-ok "R_OK" nil t)
234  (:integer w-ok "W_OK" nil t)
235  (:integer x-ok "X_OK" nil t)
236  (:integer f-ok "F_OK" nil t)
237
238  ;; mmap()
239  (:type off-t "off_t")
240  (:integer prot-none "PROT_NONE" #+sb-doc "mmap: no protection" t)
241  (:integer prot-read "PROT_READ" #+sb-doc "mmap: read protection" t)
242  (:integer prot-write "PROT_WRITE" #+sb-doc "mmap: write protection" t)
243  (:integer prot-exec "PROT_EXEC" #+sb-doc "mmap: execute protection" t)
244  (:integer map-shared "MAP_SHARED" #+sb-doc "mmap: shared memory" t)
245  (:integer map-private "MAP_PRIVATE" #+sb-doc "mmap: private mapping" t)
246  (:integer map-fixed "MAP_FIXED" #+sb-doc "mmap: map at given location" t)
247
248  ;; msync()
249  (:integer ms-async "MS_ASYNC" #+sb-doc "msync: return immediately" t)
250  (:integer ms-sync "MS_SYNC" #+sb-doc "msync: perform synchronous writes" t)
251  (:integer ms-invalidate "MS_INVALIDATE"
252            #+sb-doc "msync: invalidate all cached data" t)
253
254  ;; opendir()
255  (:structure dirent
256              ("struct dirent"
257               (:c-string name "char *" "d_name"
258                          :distrust-length #+sunos t #-sunos nil)) t)
259
260  ;; password database
261  #-win32
262  (:structure alien-passwd
263              ("struct passwd"
264               (c-string-pointer name "char *" "pw_name")
265               (c-string-pointer passwd "char *" "pw_passwd")
266               (uid-t uid "uid_t" "pw_uid")
267               (gid-t gid "gid_t" "pw_gid")
268               ;; 'change', 'class', and 'expire' are not supported on Linux
269               #+nil
270               (time-t change "time_t" "pw_change")
271               #+nil
272               (c-string-pointer class "char *" "pw_class")
273               (c-string-pointer gecos "char *" "pw_gecos")
274               (c-string-pointer dir "char *" "pw_dir")
275               (c-string-pointer shell "char *" "pw_shell")
276               #+nil
277               (time-t expire "time_t" "pw_expire")
278               ;; OS X manpages say this exists.  they lie!
279               #+nil
280               (:integer fields "int" "pw_fields")))
281
282  (:structure alien-stat
283              ("struct stat"
284               (mode-t mode "mode_t" "st_mode")
285               (ino-t ino "ino_t" "st_ino")
286               ;; Linux/MIPS uses unsigned long instead of dev_t here.
287               #-mips
288               (dev-t dev "dev_t" "st_dev")
289               #+mips
290               ((unsigned 32) dev "dev_t" "st_dev")
291               (nlink-t nlink "nlink_t" "st_nlink")
292               (uid-t uid "uid_t" "st_uid")
293               (gid-t gid "gid_t" "st_gid")
294               (off-t size "off_t" "st_size")
295               (time-t atime "time_t" "st_atime")
296               (time-t mtime "time_t" "st_mtime")
297               (time-t ctime "time_t" "st_ctime")))
298
299  ;; open()
300  (:integer o-rdonly "O_RDONLY" nil t)
301  (:integer o-wronly "O_WRONLY" nil t)
302  (:integer o-rdwr "O_RDWR" nil t)
303  (:integer o-creat "O_CREAT" nil t)
304  (:integer o-excl "O_EXCL" nil t)
305  (:integer o-noctty "O_NOCTTY" nil t)
306  (:integer o-trunc "O_TRUNC" nil t)
307  (:integer o-append "O_APPEND" nil t)
308  (:integer o-nonblock "O_NONBLOCK" nil t)
309  (:integer o-ndelay "O_NDELAY" nil t)
310  (:integer o-sync "O_SYNC" nil t)
311  (:integer o-nofollow "O_NOFOLLOW" nil t)
312  (:integer o-directory "O_DIRECTORY" nil t)
313  (:integer o-direct "O_DIRECT" nil t)
314  (:integer o-async "O_ASYNC" nil t)
315  (:integer o-largefile "O_LARGEFILE" nil t)     ; hmm...
316  (:integer o-dsync "O_DSYNC" nil t)
317  (:integer o-rsync "O_RSYNC" nil t)
318
319  ;; lseek()
320  (:integer seek-set "SEEK_SET" nil t)
321  (:integer seek-cur "SEEK_CUR" nil t)
322  (:integer seek-end "SEEK_END" nil t)
323
324  ;; fcntl()
325  (:integer f-dupfd "F_DUPFD" nil t)
326  (:integer f-getfd "F_GETFD" nil t)
327  (:integer f-setfd "F_SETFD" nil t)
328  (:integer f-getfl "F_GETFL" nil t)
329  (:integer f-setfl "F_SETFL" nil t)
330  (:integer f-getlk "F_GETLK" nil t)
331  (:integer f-setlk "F_SETLK" nil t)
332  (:integer f-setlkw "F_SETLKW" nil t)
333  (:integer f-getown "F_GETOWN" nil t)
334  (:integer f-setown "F_SETOWN" nil t)
335
336  ;; tcgetattr(), tcsetattr()
337  #-win32
338  (:type cc-t "cc_t")
339  #-win32
340  (:type speed-t "speed_t" nil t)
341  #-win32
342  (:type tcflag-t "tcflag_t" nil t)
343  (:integer nccs "NCCS" nil t)
344  #-win32
345  (:structure alien-termios
346              ("struct termios"
347               (tcflag-t iflag "tcflag_t" "c_iflag")
348               (tcflag-t oflag "tcflag_t" "c_oflag")
349               (tcflag-t cflag "tcflag_t" "c_cflag")
350               (tcflag-t lflag "tcflag_t" "c_lflag")
351               ((array cc-t) cc "cc_t" "c_cc")))
352
353  ;; utime(), utimes()
354  #-win32
355  (:structure alien-utimbuf
356              ("struct utimbuf"
357               (time-t actime "time_t" "actime")
358               (time-t modtime "time_t" "modtime")))
359  #-win32
360  (:structure alien-timeval
361              ("struct timeval"
362               (long sec "long" "tv_sec")
363               (long usec "long" "tv_usec")))
364
365  (:integer veof "VEOF" nil t)
366  (:integer veol "VEOL" nil t)
367  (:integer verase "VERASE" nil t)
368  (:integer vintr "VINTR" nil t)
369  (:integer vkill "VKILL" nil t)
370  (:integer vmin "VMIN" nil t)
371  (:integer vquit "VQUIT" nil t)
372  (:integer vstart "VSTART" nil t)
373  (:integer vstop "VSTOP" nil t)
374  (:integer vsusp "VSUSP" nil t)
375  (:integer vtime "VTIME" nil t)
376
377  (:integer brkint "BRKINT" nil t)
378  (:integer icrnl "ICRNL" nil t)
379  (:integer ignbrk "IGNBRK" nil t)
380  (:integer igncr "IGNCR" nil t)
381  (:integer ignpar "IGNPAR" nil t)
382  (:integer inlcr "INLCR" nil t)
383  (:integer inpck "INPCK" nil t)
384  (:integer istrip "ISTRIP" nil t)
385  #+xsi                               ; FIXME: an extension, apparently
386  (:integer ixany "IXANY" nil t)
387  (:integer ixoff "IXOFF" nil t)
388  (:integer ixon "IXON" nil t)
389  (:integer parmrk "PARMRK" nil t)
390
391  (:integer opost "OPOST" nil t)
392  #+xsi
393  (:integer onlcr "ONLCR" nil t)
394  (:integer ocrnl "OCRNL" nil t)
395  (:integer onlret "ONLRET" nil t)
396  (:integer ofill "OFILL" nil t)
397  (:integer nldly "NLDLY" nil t)
398  (:integer nl0 "NL0" nil t)
399  (:integer nl1 "NL1" nil t)
400  (:integer crdly "CRDLY" nil t)
401  (:integer cr0 "CR0" nil t)
402  (:integer cr1 "CR1" nil t)
403  (:integer cr2 "CR2" nil t)
404  (:integer cr3 "CR3" nil t)
405  (:integer tabdly "TABDLY" nil t)
406  (:integer tab0 "TAB0" nil t)
407  (:integer tab1 "TAB1" nil t)
408  (:integer tab2 "TAB2" nil t)
409  (:integer tab3 "TAB3" nil t)
410  (:integer bsdly "BSDLY" nil t)
411  (:integer bs0 "BS0" nil t)
412  (:integer bs1 "BS1" nil t)
413  (:integer vtdly "VTDLY" nil t)
414  (:integer vt0 "VT0" nil t)
415  (:integer vt1 "VT1" nil t)
416  (:integer ffdly "FFDLY" nil t)
417  (:integer ff0 "FF0" nil t)
418  (:integer ff1 "FF1" nil t)
419
420  (:integer b0 "B0" nil t)
421  (:integer b50 "B50" nil t)
422  (:integer b75 "B75" nil t)
423  (:integer b110 "B110" nil t)
424  (:integer b134 "B134" nil t)
425  (:integer b150 "B150" nil t)
426  (:integer b200 "B200" nil t)
427  (:integer b300 "B300" nil t)
428  (:integer b600 "B600" nil t)
429  (:integer b1200 "B1200" nil t)
430  (:integer b1800 "B1800" nil t)
431  (:integer b2400 "B2400" nil t)
432  (:integer b4800 "B4800" nil t)
433  (:integer b9600 "B9600" nil t)
434  (:integer b19200 "B19200" nil t)
435  (:integer b38400 "B38400" nil t)
436  (:integer b57600 "B57600" nil t)
437  (:integer b115200 "B115200" nil t)
438  (:integer b230400 "B230400" nil t)
439
440  (:integer csize "CSIZE" nil t)
441  (:integer cs5 "CS5" nil t)
442  (:integer cs6 "CS6" nil t)
443  (:integer cs7 "CS7" nil t)
444  (:integer cs8 "CS8" nil t)
445  (:integer cstopb "CSTOPB" nil t)
446  (:integer cread "CREAD" nil t)
447  (:integer parenb "PARENB" nil t)
448  (:integer parodd "PARODD" nil t)
449  (:integer hupcl "HUPCL" nil t)
450  (:integer clocal "CLOCAL" nil t)
451
452  (:integer echo "ECHO" nil t)
453  (:integer echoe "ECHOE" nil t)
454  (:integer echok "ECHOK" nil t)
455  (:integer echonl "ECHONL" nil t)
456  (:integer icanon "ICANON" nil t)
457  (:integer iexten "IEXTEN" nil t)
458  (:integer isig "ISIG" nil t)
459  (:integer noflsh "NOFLSH" nil t)
460  (:integer tostop "TOSTOP" nil t)
461
462  (:integer tcsanow "TCSANOW" nil t)
463  (:integer tcsadrain "TCSADRAIN" nil t)
464  (:integer tcsaflush "TCSAFLUSH" nil t)
465
466  (:integer tciflush "TCIFLUSH" nil t)
467  (:integer tcioflush "TCIOFLUSH" nil t)
468  (:integer tcoflush "TCOFLUSH" nil t)
469  (:integer tcioff "TCIOFF" nil t)
470  (:integer tcion "TCION" nil t)
471  (:integer tcooff "TCOOFF" nil t)
472  (:integer tcoon "TCOON" nil t)
473
474  )