Add checks for LibFixPOSIX version
[iolib.git] / src / syscalls / ffi-types-unix.lisp
blob922f7e858fd209f2ce3fe5b06fa0d6cb22ef8dbb
1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
2 ;;;
3 ;;; --- Foreign type definitions for *NIX systems.
4 ;;;
6 (in-package :iolib/syscalls)
8 ;;; FIXME: Find a way to use pkg-config to get these flags
9 ;;; instead of hard-coding them
10 #+linux
11 (progn
12 (c "#if !defined(_GNU_SOURCE)")
13 (define "_GNU_SOURCE")
14 (c "#endif // _GNU_SOURCE")
15 (define "_LARGEFILE_SOURCE")
16 (define "_LARGEFILE64_SOURCE")
17 (define "_FILE_OFFSET_BITS" 64))
19 (include "lfp.h")
21 (include "sys/poll.h" ;; FIXME: add poll() to LFP
22 "sys/ioctl.h" "sys/utsname.h"
23 "pwd.h" "grp.h")
25 #+linux
26 (include "sys/epoll.h" "sys/syscall.h")
28 #+bsd
29 (include "sys/event.h" "sys/time.h") ; for kqueue
32 ;;;-------------------------------------------------------------------------
33 ;;; LibFixPOSIX build info
34 ;;;-------------------------------------------------------------------------
36 (cstruct lfp-buildinfo "struct lfp_buildinfo"
37 (release "release" :type :uint64)
38 (vcsid "vcsid" :type :string))
42 ;;;-------------------------------------------------------------------------
43 ;;; Simple POSIX types
44 ;;;-------------------------------------------------------------------------
46 (ctype bool "bool")
47 (ctype size-t "size_t")
48 (ctype ssize-t "ssize_t")
49 (ctype intptr-t "intptr_t")
50 (ctype uintptr-t "uintptr_t")
51 (ctype pid-t "pid_t")
52 (ctype uid-t "uid_t")
53 (ctype gid-t "gid_t")
54 (ctype off-t "off_t")
55 (ctype mode-t "mode_t")
56 (ctype time-t "time_t")
57 (ctype useconds-t "useconds_t")
58 (ctype suseconds-t "suseconds_t")
59 (ctype dev-t "dev_t")
60 (ctype ino-t "ino_t")
61 (ctype nlink-t "nlink_t")
62 (ctype blksize-t "blksize_t")
63 (ctype blkcnt-t "blkcnt_t")
64 (ctype nfds-t "nfds_t")
65 (ctype rlim-t "rlim_t")
66 (ctype id-t "id_t")
67 (ctype clockid-t "clockid_t")
70 ;;;-------------------------------------------------------------------------
71 ;;; Structs, slots and C constants
72 ;;;-------------------------------------------------------------------------
74 ;;; errno.h
76 (constantenum (errno-values :define-constants t)
77 (:e2big "E2BIG")
78 (:eacces "EACCES")
79 (:eaddrinuse "EADDRINUSE")
80 (:eaddrnotavail "EADDRNOTAVAIL")
81 (:eadv "EADV" :optional t)
82 (:eafnosupport "EAFNOSUPPORT")
83 (:ealready "EALREADY")
84 (:ebade "EBADE" :optional t)
85 (:ebadf "EBADF")
86 (:ebadfd "EBADFD" :optional t)
87 (:ebadmsg "EBADMSG")
88 (:ebadr "EBADR" :optional t)
89 (:ebadrqc "EBADRQC" :optional t)
90 (:ebadslt "EBADSLT" :optional t)
91 (:ebfont "EBFONT" :optional t)
92 (:ebusy "EBUSY")
93 (:ecanceled "ECANCELED")
94 (:echild "ECHILD")
95 (:echrng "ECHRNG" :optional t)
96 (:ecomm "ECOMM" :optional t)
97 (:econnaborted "ECONNABORTED")
98 (:econnrefused "ECONNREFUSED")
99 (:econnreset "ECONNRESET")
100 (:edeadlk "EDEADLK")
101 (:edestaddrreq "EDESTADDRREQ")
102 (:edom "EDOM")
103 (:edotdot "EDOTDOT" :optional t)
104 (:edquot "EDQUOT")
105 (:eexist "EEXIST")
106 (:efault "EFAULT")
107 (:efbig "EFBIG")
108 (:ehostdown "EHOSTDOWN")
109 (:ehostunreach "EHOSTUNREACH")
110 (:ehwpoison "EHWPOISON" :optional t)
111 (:eidrm "EIDRM")
112 (:eilseq "EILSEQ")
113 (:einprogress "EINPROGRESS")
114 (:eintr "EINTR")
115 (:einval "EINVAL")
116 (:eio "EIO")
117 (:eisconn "EISCONN")
118 (:eisdir "EISDIR")
119 (:eisnam "EISNAM" :optional t)
120 (:ekeyexpired "EKEYEXPIRED" :optional t)
121 (:ekeyrejected "EKEYREJECTED" :optional t)
122 (:ekeyrevoked "EKEYREVOKED" :optional t)
123 (:el2hlt "EL2HLT" :optional t)
124 (:el2nsync "EL2NSYNC" :optional t)
125 (:el3hlt "EL3HLT" :optional t)
126 (:el3rst "EL3RST" :optional t)
127 (:elibacc "ELIBACC" :optional t)
128 (:elibbad "ELIBBAD" :optional t)
129 (:elibexec "ELIBEXEC" :optional t)
130 (:elibmax "ELIBMAX" :optional t)
131 (:elibscn "ELIBSCN" :optional t)
132 (:elnrng "ELNRNG" :optional t)
133 (:eloop "ELOOP")
134 (:emediumtype "EMEDIUMTYPE" :optional t)
135 (:emfile "EMFILE")
136 (:emlink "EMLINK")
137 (:emsgsize "EMSGSIZE")
138 (:emultihop "EMULTIHOP")
139 (:enametoolong "ENAMETOOLONG")
140 (:enavail "ENAVAIL" :optional t)
141 (:enetdown "ENETDOWN")
142 (:enetreset "ENETRESET")
143 (:enetunreach "ENETUNREACH")
144 (:enfile "ENFILE")
145 (:enoano "ENOANO" :optional t)
146 (:enobufs "ENOBUFS")
147 (:enocsi "ENOCSI" :optional t)
148 (:enodata "ENODATA" :optional t)
149 (:enodev "ENODEV")
150 (:enoent "ENOENT")
151 (:enoexec "ENOEXEC")
152 (:enokey "ENOKEY" :optional t)
153 (:enolck "ENOLCK")
154 (:enolink "ENOLINK")
155 (:enomedium "ENOMEDIUM" :optional t)
156 (:enomem "ENOMEM")
157 (:enomsg "ENOMSG")
158 (:enonet "ENONET" :optional t)
159 (:enopkg "ENOPKG" :optional t)
160 (:enoprotoopt "ENOPROTOOPT")
161 (:enospc "ENOSPC")
162 (:enosr "ENOSR" :optional t)
163 (:enostr "ENOSTR" :optional t)
164 (:enosys "ENOSYS")
165 (:enotblk "ENOTBLK" :optional t)
166 (:enotconn "ENOTCONN")
167 (:enotdir "ENOTDIR")
168 (:enotempty "ENOTEMPTY")
169 (:enotnam "ENOTNAM" :optional t)
170 (:enotrecoverable "ENOTRECOVERABLE" :optional t)
171 (:enotsock "ENOTSOCK")
172 (:enotsup "ENOTSUP")
173 (:enotty "ENOTTY")
174 (:enotuniq "ENOTUNIQ" :optional t)
175 (:enxio "ENXIO")
176 (:eopnotsupp "EOPNOTSUPP")
177 (:eoverflow "EOVERFLOW")
178 (:eownerdead "EOWNERDEAD" :optional t)
179 (:eperm "EPERM")
180 (:epfnosupport "EPFNOSUPPORT" :optional t)
181 (:epipe "EPIPE")
182 (:eproto "EPROTO")
183 (:eprotonosupport "EPROTONOSUPPORT")
184 (:eprototype "EPROTOTYPE")
185 (:erange "ERANGE")
186 (:eremchg "EREMCHG" :optional t)
187 (:eremote "EREMOTE" :optional t)
188 (:eremoteio "EREMOTEIO" :optional t)
189 (:erestart "ERESTART" :optional t)
190 (:erfkill "ERFKILL" :optional t)
191 (:erofs "EROFS")
192 (:eshutdown "ESHUTDOWN")
193 (:esocktnosupport "ESOCKTNOSUPPORT" :optional t)
194 (:espipe "ESPIPE")
195 (:esrch "ESRCH")
196 (:esrmnt "ESRMNT" :optional t)
197 (:estale "ESTALE")
198 (:estrpipe "ESTRPIPE" :optional t)
199 (:etime "ETIME" :optional t)
200 (:etimedout "ETIMEDOUT")
201 (:etoomanyrefs "ETOOMANYREFS" :optional t)
202 (:etxtbsy "ETXTBSY")
203 (:euclean "EUCLEAN" :optional t)
204 (:eunatch "EUNATCH" :optional t)
205 (:eusers "EUSERS" :optional t)
206 (:ewouldblock "EWOULDBLOCK")
207 (:exdev "EXDEV")
208 (:exfull "EXFULL" :optional t)
209 (:ebug "EBUG"))
212 ;;; fcntl.h
214 ;; Open()
216 (constant (o-rdonly "O_RDONLY"))
217 (constant (o-wronly "O_WRONLY"))
218 (constant (o-rdwr "O_RDWR"))
219 (constant (o-creat "O_CREAT"))
220 (constant (o-excl "O_EXCL"))
221 (constant (o-trunc "O_TRUNC"))
222 (constant (o-append "O_APPEND"))
224 (constant (o-noctty "O_NOCTTY"))
225 (constant (o-nonblock "O_NONBLOCK"))
226 (constant (o-ndelay "O_NDELAY"))
227 (constant (o-sync "O_SYNC"))
228 (constant (o-nofollow "O_NOFOLLOW"))
229 (constant (o-async "O_ASYNC"))
230 (constant (o-cloexec "O_CLOEXEC"))
232 ;;; Fcntl()
234 (constant (f-dupfd "F_DUPFD"))
235 (constant (f-getfd "F_GETFD"))
236 (constant (f-setfd "F_SETFD"))
237 (constant (f-getfl "F_GETFL"))
238 (constant (f-setfl "F_SETFL"))
239 (constant (f-getlk "F_GETLK"))
240 (constant (f-setlk "F_SETLK"))
241 (constant (f-setlkw "F_SETLKW"))
242 (constant (f-getown "F_GETOWN"))
243 (constant (f-setown "F_SETOWN"))
244 (constant (f-rdlck "F_RDLCK"))
245 (constant (f-wrlck "F_WRLCK"))
246 (constant (f-unlck "F_UNLCK"))
247 #+linux
248 (progn
249 (constant (f-getsig "F_GETSIG"))
250 (constant (f-setsig "F_SETSIG"))
251 (constant (f-setlease "F_SETLEASE"))
252 (constant (f-getlease "F_GETLEASE")))
255 ;;; unistd.h
257 ;; Lseek()
259 (constant (seek-set "SEEK_SET"))
260 (constant (seek-cur "SEEK_CUR"))
261 (constant (seek-end "SEEK_END"))
263 ;; Access()
265 (constant (r-ok "R_OK"))
266 (constant (w-ok "W_OK"))
267 (constant (x-ok "X_OK"))
268 (constant (f-ok "F_OK"))
271 ;;; time.h
273 (constant (clock-realtime "CLOCK_REALTIME"))
274 (constant (clock-monotonic "CLOCK_MONOTONIC"))
276 (cstruct timespec "struct timespec"
277 "UNIX time specification in seconds and nanoseconds."
278 (sec "tv_sec" :type time-t)
279 (nsec "tv_nsec" :type :long))
282 ;;; sys/stat.h
284 (constant (path-max "PATH_MAX" "MAXPATHLEN"))
286 (cstruct stat "struct stat"
287 (dev "st_dev" :type dev-t)
288 (ino "st_ino" :type ino-t)
289 (mode "st_mode" :type mode-t)
290 (nlink "st_nlink" :type nlink-t)
291 (uid "st_uid" :type uid-t)
292 (gid "st_gid" :type gid-t)
293 (rdev "st_rdev" :type dev-t)
294 (size "st_size" :type off-t)
295 (blksize "st_blksize" :type blkcnt-t)
296 (blocks "st_blocks" :type blksize-t)
297 (atime "st_atime" :type time-t)
298 (mtime "st_mtime" :type time-t)
299 (ctime "st_ctime" :type time-t))
301 (constant (s-irwxu "S_IRWXU"))
302 (constant (s-irusr "S_IRUSR"))
303 (constant (s-iwusr "S_IWUSR"))
304 (constant (s-ixusr "S_IXUSR"))
305 (constant (s-ifmt "S_IFMT"))
306 (constant (s-ififo "S_IFIFO"))
307 (constant (s-ifchr "S_IFCHR"))
308 (constant (s-ifdir "S_IFDIR"))
309 (constant (s-ifblk "S_IFBLK"))
310 (constant (s-ifreg "S_IFREG"))
311 (constant (s-ifwht "S_IFWHT") :optional t)
312 (constant (s-iread "S_IREAD"))
313 (constant (s-iwrite "S_IWRITE"))
314 (constant (s-iexec "S_IEXEC"))
316 (constant (s-irwxg "S_IRWXG"))
317 (constant (s-irgrp "S_IRGRP"))
318 (constant (s-iwgrp "S_IWGRP"))
319 (constant (s-ixgrp "S_IXGRP"))
320 (constant (s-irwxo "S_IRWXO"))
321 (constant (s-iroth "S_IROTH"))
322 (constant (s-iwoth "S_IWOTH"))
323 (constant (s-ixoth "S_IXOTH"))
324 (constant (s-isuid "S_ISUID"))
325 (constant (s-isgid "S_ISGID"))
326 (constant (s-isvtx "S_ISVTX"))
327 (constant (s-iflnk "S_IFLNK"))
328 (constant (s-ifsock "S_IFSOCK"))
331 ;;; sys/ioctl.h
333 ;; Ioctl()
335 (constant (fionbio "FIONBIO"))
336 (constant (fionread "FIONREAD"))
339 ;;; sys/wait.h
341 (constant (wnohang "WNOHANG"))
342 (constant (wuntraced "WUNTRACED"))
343 (constant (wcontinued "WCONTINUED"))
346 ;;;-------------------------------------------------------------------------
347 ;;; signal.h
348 ;;;-------------------------------------------------------------------------
350 ;; POSIX.1-1990
351 (constantenum (signal :define-constants t)
352 (:sighup "SIGHUP")
353 (:sigint "SIGINT")
354 (:sigquit "SIGQUIT")
355 (:sigill "SIGILL")
356 (:sigabrt "SIGABRT")
357 (:sigfpe "SIGFPE")
358 (:sigkill "SIGKILL")
359 (:sigsegv "SIGSEGV")
360 (:sigpipe "SIGPIPE")
361 (:sigalrm "SIGALRM")
362 (:sigterm "SIGTERM")
363 (:sigusr1 "SIGUSR1")
364 (:sigusr2 "SIGUSR2")
365 (:sigchld "SIGCHLD")
366 (:sigcont "SIGCONT")
367 (:sigstop "SIGSTOP")
368 (:sigtstp "SIGTSTP")
369 (:sigttin "SIGTTIN")
370 (:sigttou "SIGTTOU")
371 ;; POSIX.1-2001
372 (:sigbus "SIGBUS")
373 (:sigpoll "SIGPOLL" :optional t)
374 (:sigprof "SIGPROF")
375 (:sigsys "SIGSYS")
376 (:sigtrap "SIGTRAP")
377 (:sigurg "SIGURG")
378 (:sigvtalrm "SIGVTALRM")
379 (:sigxcpu "SIGXCPU")
380 (:sigxfsz "SIGXFSZ")
381 ;; Other signals
382 (:sigemt "SIGEMT" :optional t)
383 (:sigio "SIGIO")
384 (:sigcld "SIGCLD" :optional t)
385 (:sigpwr "SIGPWR" :optional t)
386 (:siginfo "SIGINFO" :optional t)
387 (:siglost "SIGLOST" :optional t)
388 (:sigwinch "SIGWINCH"))
390 (constant (sig-ign "SIG_IGN"))
391 (constant (sig-dfl "SIG_DFL"))
393 (cstruct sigaction "struct sigaction"
394 (handler "sa_handler" :type :pointer)
395 (sigaction "sa_sigaction" :type :pointer)
396 ;; actual type can be structure or array...
397 (mask "sa_mask" :type :unsigned-long)
398 (flags "sa_flags" :type :int))
400 (constant (sa-nocldstop "SA_NOCLDSTOP"))
401 (constant (sa-nocldwait "SA_NOCLDWAIT"))
402 (constant (sa-nodefer "SA_NODEFER"))
403 (constant (sa-onstack "SA_ONSTACK"))
404 (constant (sa-resethand "SA_RESETHAND"))
405 (constant (sa-restart "SA_RESTART"))
406 (constant (sa-siginfo "SA_SIGINFO"))
409 ;;; sys/mman.h
411 ;; Mmap()
413 (constant (prot-none "PROT_NONE"))
414 (constant (prot-read "PROT_READ"))
415 (constant (prot-write "PROT_WRITE"))
416 (constant (prot-exec "PROT_EXEC"))
417 (constant (map-shared "MAP_SHARED"))
418 (constant (map-private "MAP_PRIVATE"))
419 (constant (map-fixed "MAP_FIXED"))
420 (constant (map-failed "MAP_FAILED"))
423 ;;; sys/select.h
425 (cstruct fd-set "fd_set")
426 (constant (fd-setsize "FD_SETSIZE"))
428 (cstruct timeval "struct timeval"
429 "UNIX time specification in seconds and microseconds."
430 (sec "tv_sec" :type time-t)
431 (usec "tv_usec" :type suseconds-t))
434 ;;; sys/poll.h
436 ;; Poll()
438 (cstruct pollfd "struct pollfd"
439 "Poll file descriptor activity specification structure."
440 (fd "fd" :type :int)
441 (events "events" :type :short)
442 (revents "revents" :type :short))
444 (constant (pollin "POLLIN"))
445 (constant (pollrdnorm "POLLRDNORM"))
446 (constant (pollrdband "POLLRDBAND"))
447 (constant (pollpri "POLLPRI"))
448 (constant (pollout "POLLOUT"))
449 (constant (pollwrnorm "POLLWRNORM"))
450 (constant (pollwrband "POLLWRBAND"))
451 (constant (pollerr "POLLERR"))
452 #+linux (constant (pollrdhup "POLLRDHUP"))
453 (constant (pollhup "POLLHUP"))
454 (constant (pollnval "POLLNVAL"))
457 ;;; dirent.h
459 ;; Apparently POSIX 1003.1-2001 (according to linux manpages) only
460 ;; requires d_name. Sigh. I guess we should assemble some decent
461 ;; wrapper functions. No, struct members can't be optional at this
462 ;; point.
463 (cstruct dirent "struct dirent"
464 ;; POSIX actually requires this to be d_ino
465 (fileno "d_fileno" :type #-freebsd ino-t #+freebsd :uint32)
466 (type "d_type" :type :uint8)
467 (name "d_name" :type :uint8 :count :auto))
469 ;;; filetypes set in d_type slot of struct dirent
470 (constant (dt-unknown "DT_UNKNOWN"))
471 (constant (dt-fifo "DT_FIFO"))
472 (constant (dt-chr "DT_CHR"))
473 (constant (dt-dir "DT_DIR"))
474 (constant (dt-blk "DT_BLK"))
475 (constant (dt-reg "DT_REG"))
476 (constant (dt-lnk "DT_LNK"))
477 (constant (dt-sock "DT_SOCK"))
478 (constant (dt-wht "DT_WHT"))
481 ;;;-------------------------------------------------------------------------
482 ;;; sys/resource.h
483 ;;;-------------------------------------------------------------------------
485 (cstruct rlimit "struct rlimit"
486 (cur "rlim_cur" :type rlim-t)
487 (max "rlim_max" :type rlim-t))
489 (cstruct rusage "struct rusage"
490 (utime "ru_utime" :type timeval)
491 (stime "ru_stime" :type timeval)
492 (maxrss "ru_maxrss" :type :long)
493 (ixrss "ru_ixrss" :type :long)
494 (idrss "ru_idrss" :type :long)
495 (isrss "ru_isrss" :type :long)
496 (minflt "ru_minflt" :type :long)
497 (majflt "ru_majflt" :type :long)
498 (nswap "ru_nswap" :type :long)
499 (inblock "ru_inblock" :type :long)
500 (oublock "ru_oublock" :type :long)
501 (msgsnd "ru_msgsnd" :type :long)
502 (msgrcv "ru_msgrcv" :type :long)
503 (nsignals "ru_nsignals" :type :long)
504 (nvcsw "ru_nvcsw" :type :long)
505 (nivcsw "ru_nivcsw" :type :long))
507 (constant (prio-process "PRIO_PROCESS"))
508 (constant (prio-pgrp "PRIO_PGRP"))
509 (constant (prio-user "PRIO_USER"))
510 (constant (rlim-infinity "RLIM_INFINITY"))
511 (constant (rusage-self "RUSAGE_SELF"))
512 (constant (rusage-children "RUSAGE_CHILDREN"))
513 (constant (rlimit-as "RLIMIT_AS"))
514 (constant (rlimit-core "RLIMIT_CORE"))
515 (constant (rlimit-cpu "RLIMIT_CPU"))
516 (constant (rlimit-data "RLIMIT_DATA"))
517 (constant (rlimit-fsize "RLIMIT_FSIZE"))
518 (constant (rlimit-memlock "RLIMIT_MEMLOCK"))
519 (constant (rlimit-nofile "RLIMIT_NOFILE"))
520 (constant (rlimit-nproc "RLIMIT_NPROC"))
521 (constant (rlimit-rss "RLIMIT_RSS"))
522 (constant (rlimit-stack "RLIMIT_STACK"))
524 #+linux
525 (progn
526 (constant (rlim-saved-max "RLIM_SAVED_MAX"))
527 (constant (rlim-saved-cur "RLIM_SAVED_CUR"))
528 (constant (rlimit-locks "RLIMIT_LOCKS"))
529 (constant (rlimit-msgqueue "RLIMIT_MSGQUEUE"))
530 (constant (rlimit-nlimits "RLIMIT_NLIMITS"))
531 (constant (rlimit-nice "RLIMIT_NICE"))
532 (constant (rlimit-rtprio "RLIMIT_RTPRIO"))
533 (constant (rlimit-sigpending "RLIMIT_SIGPENDING")))
535 #+(or dragonfly freebsd)
536 (constant (rlimit-sbsize "RLIMIT_SBSIZE"))
539 ;;;-------------------------------------------------------------------------
540 ;;; sys/utsname.h
541 ;;;-------------------------------------------------------------------------
543 (cstruct utsname "struct utsname"
544 (sysname "sysname" :type :char)
545 (nodename "nodename" :type :char)
546 (release "release" :type :char)
547 (version "version" :type :char)
548 (machine "machine" :type :char))
551 ;;;-------------------------------------------------------------------------
552 ;;; pwd.h
553 ;;;-------------------------------------------------------------------------
555 (cstruct passwd "struct passwd"
556 (name "pw_name" :type :string)
557 (passwd "pw_passwd" :type :string)
558 (uid "pw_uid" :type uid-t)
559 (gid "pw_gid" :type gid-t)
560 (gecos "pw_gecos" :type :string)
561 (dir "pw_dir" :type :string)
562 (shell "pw_shell" :type :string))
565 ;;;-------------------------------------------------------------------------
566 ;;; grp.h
567 ;;;-------------------------------------------------------------------------
569 (cstruct group "struct group"
570 (name "gr_name" :type :string)
571 (passwd "gr_passwd" :type :string)
572 (gid "gr_gid" :type gid-t)
573 (mem "gr_mem" :type :pointer))
576 ;;;-------------------------------------------------------------------------
577 ;;; sys/syscall.h
578 ;;;-------------------------------------------------------------------------
580 #+linux (constant (sys-gettid "SYS_gettid"))
583 ;;;-------------------------------------------------------------------------
584 ;;; sys/epoll.h
585 ;;;-------------------------------------------------------------------------
587 #+linux
588 (progn
589 (cunion epoll-data "epoll_data_t"
590 (ptr "ptr" :type :pointer)
591 (fd "fd" :type :int)
592 (u32 "u32" :type :uint32)
593 (u64 "u64" :type :uint64))
595 (cstruct epoll-event "struct epoll_event"
596 (events "events" :type :uint32)
597 (data "data" :type epoll-data))
599 (constant (epoll-ctl-add "EPOLL_CTL_ADD"))
600 (constant (epoll-ctl-del "EPOLL_CTL_DEL"))
601 (constant (epoll-ctl-mod "EPOLL_CTL_MOD"))
603 (constant (epollin "EPOLLIN"))
604 (constant (epollrdnorm "EPOLLRDNORM"))
605 (constant (epollrdband "EPOLLRDBAND"))
606 (constant (epollpri "EPOLLPRI"))
607 (constant (epollout "EPOLLOUT"))
608 (constant (epollwrnorm "EPOLLWRNORM"))
609 (constant (epollwrband "EPOLLWRBAND"))
610 (constant (epollerr "EPOLLERR"))
611 (constant (epollhup "EPOLLHUP"))
612 (constant (epollmsg "EPOLLMSG"))
613 (constant (epolloneshot "EPOLLONESHOT"))
614 (constant (epollet "EPOLLET")))
617 ;;;-------------------------------------------------------------------------
618 ;;; sys/event.h
619 ;;;-------------------------------------------------------------------------
621 #+bsd
622 (progn
623 (cstruct kevent "struct kevent"
624 (ident "ident" :type uintptr-t)
625 (filter "filter" :type #-netbsd :short
626 #+netbsd :uint32)
627 (flags "flags" :type #-netbsd :unsigned-short
628 #+netbsd :uint32)
629 (fflags "fflags" :type #-netbsd :unsigned-int
630 #+netbsd :uint32)
631 (data "data" :type #-netbsd intptr-t
632 #+netbsd :int64)
633 (udata "udata" :type :pointer))
635 ;; kevent() flags
636 (constant (ev-add "EV_ADD"))
637 (constant (ev-enable "EV_ENABLE"))
638 (constant (ev-disable "EV_DISABLE"))
639 (constant (ev-delete "EV_DELETE"))
640 (constant (ev-oneshot "EV_ONESHOT"))
641 (constant (ev-clear "EV_CLEAR"))
642 (constant (ev-eof "EV_EOF"))
643 (constant (ev-error "EV_ERROR"))
645 ;; kevent() filter flags
646 (constant (evfilt-read "EVFILT_READ"))
647 (constant (evfilt-write "EVFILT_WRITE"))
648 (constant (evfilt-aio "EVFILT_AIO"))
649 (constant (evfilt-vnode "EVFILT_VNODE"))
650 (constant (evfilt-proc "EVFILT_PROC"))
651 (constant (evfilt-signal "EVFILT_SIGNAL"))
652 (constant (evfilt-timer "EVFILT_TIMER"))
653 #-darwin (constant (evfilt-netdev "EVFILT_NETDEV"))
655 ;; EVFILT_VNODE options
656 (constant (note-delete "NOTE_DELETE"))
657 (constant (note-write "NOTE_WRITE"))
658 (constant (note-extend "NOTE_EXTEND"))
659 (constant (note-attrib "NOTE_ATTRIB"))
660 (constant (note-link "NOTE_LINK"))
661 (constant (note-rename "NOTE_RENAME"))
662 (constant (note-revoke "NOTE_REVOKE"))
664 ;; EVFILT_PROC options
665 (constant (note-exit "NOTE_EXIT"))
666 (constant (note-fork "NOTE_FORK"))
667 (constant (note-exec "NOTE_EXEC"))
668 (constant (note-track "NOTE_TRACK"))
669 (constant (note-trackerr "NOTE_TRACKERR"))
671 ;; EVFILT_NETDEV options
672 #-darwin
673 (progn
674 (constant (note-linkup "NOTE_LINKUP"))
675 (constant (note-linkdown "NOTE_LINKDOWN"))
676 (constant (note-linkinv "NOTE_LINKINV"))))
679 ;;;-------------------------------------------------------------------------
680 ;;; syslog.h
681 ;;;-------------------------------------------------------------------------
683 ;; Option flags for openlog.
684 (constant (log-pid "LOG_PID")
685 :documentation "log the pid with each message")
686 (constant (log-cons "LOG_CONS")
687 :documentation "log on the console if errors in sending")
688 (constant (log-odelay "LOG_ODELAY")
689 :documentation "delay open until first syslog() (default)")
690 (constant (log-ndelay "LOG_NDELAY")
691 :documentation "don't delay open")
692 (constant (log-nowait "LOG_NOWAIT")
693 :documentation "don't wait for console forks: DEPRECATED")
694 (constant (log-perror "LOG_PERROR")
695 :documentation "log to stderr as well")
697 ;; facility codes
698 (constant (log-kern "LOG_KERN")
699 :documentation "kernel messages")
700 (constant (log-user "LOG_USER")
701 :documentation "random user-level messages")
702 (constant (log-mail "LOG_MAIL")
703 :documentation "mail system")
704 (constant (log-daemon "LOG_DAEMON")
705 :documentation "system daemons")
706 (constant (log-auth "LOG_AUTH")
707 :documentation "security/authorization messages")
708 (constant (log-syslog "LOG_SYSLOG")
709 :documentation "messages generated internally by syslogd")
710 (constant (log-lpr "LOG_LPR")
711 :documentation "line printer subsystem")
712 (constant (log-news "LOG_NEWS")
713 :documentation "network news subsystem")
714 (constant (log-uucp "LOG_UUCP")
715 :documentation "UUCP subsystem")
716 (constant (log-cron "LOG_CRON")
717 :documentation "clock daemon")
718 (constant (log-authpriv "LOG_AUTHPRIV")
719 :documentation "security/authorization messages (private")
720 (constant (log-ftp "LOG_FTP")
721 :documentation "ftp daemon")
722 #+bsd
723 (constant (log-security "LOG_SECURITY")
724 :documentation "security subsystems")
726 ;; other codes through 15 reserved for system use
727 (constant (log-local0 "LOG_LOCAL0"))
728 (constant (log-local1 "LOG_LOCAL1"))
729 (constant (log-local2 "LOG_LOCAL2"))
730 (constant (log-local3 "LOG_LOCAL3"))
731 (constant (log-local4 "LOG_LOCAL4"))
732 (constant (log-local5 "LOG_LOCAL5"))
733 (constant (log-local6 "LOG_LOCAL6"))
734 (constant (log-local7 "LOG_LOCAL7"))
736 ;; priorities (these are ordered)
737 (constant (log-emerg "LOG_EMERG")
738 :documentation "system is unusable")
739 (constant (log-alert "LOG_ALERT")
740 :documentation "action must be taken immediately")
741 (constant (log-crit "LOG_CRIT")
742 :documentation "critical conditions")
743 (constant (log-err "LOG_ERR")
744 :documentation "error conditions")
745 (constant (log-warning "LOG_WARNING")
746 :documentation "warning conditions")
747 (constant (log-notice "LOG_NOTICE")
748 :documentation "normal but significant condition")
749 (constant (log-info "LOG_INFO")
750 :documentation "informational")
751 (constant (log-debug "LOG_DEBUG")
752 :documentation "debug-level messages")