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