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