Fix dependency of types.lisp
[iolib.git] / src / syscalls / ffi-types-unix.lisp
blob1c4ac4b431a28089089411416e62e06b6adab70f
1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; indent-tabs-mode: nil -*-
2 ;;;
3 ;;; --- Grovel definitions for *NIX systems.
4 ;;;
6 #+linux
7 (define "_GNU_SOURCE")
9 ;;; largefile support on linux
10 ;;; TODO: check if these flags are required on solaris too
11 #+linux
12 (progn
13 (define "_LARGEFILE_SOURCE")
14 (define "_LARGEFILE64_SOURCE")
15 (define "_FILE_OFFSET_BITS" 64))
17 (include "stdlib.h" "errno.h" "sys/types.h" "sys/stat.h" "sys/mman.h"
18 "fcntl.h" "signal.h" "unistd.h" "limits.h" "time.h" "sys/select.h"
19 "sys/poll.h" "sys/ioctl.h" "sys/resource.h" "pwd.h" "grp.h"
20 "dirent.h" "sys/utsname.h")
22 #+linux
23 (include "sys/epoll.h" "sys/syscall.h")
25 #+bsd
26 (include "sys/event.h" "sys/time.h") ; for kqueue
29 (in-package :iolib.syscalls)
31 (ctype size-t "size_t")
32 (ctype ssize-t "ssize_t")
33 (ctype pid-t "pid_t")
34 (ctype uid-t "uid_t")
35 (ctype gid-t "gid_t")
36 (ctype off-t "off_t")
37 (ctype mode-t "mode_t")
39 (constantenum (errno-values :define-constants t)
40 ((:eperm "EPERM"))
41 ((:enoent "ENOENT"))
42 ((:esrch "ESRCH"))
43 ((:eintr "EINTR"))
44 ((:eio "EIO"))
45 ((:enxio "ENXIO"))
46 ((:e2big "E2BIG"))
47 ((:enoexec "ENOEXEC"))
48 ((:ebadf "EBADF"))
49 ((:echild "ECHILD"))
50 ((:eagain "EAGAIN"))
51 ((:enomem "ENOMEM"))
52 ((:eacces "EACCES"))
53 ((:efault "EFAULT"))
54 ((:ebusy "EBUSY"))
55 ((:eexist "EEXIST"))
56 ((:exdev "EXDEV"))
57 ((:enodev "ENODEV"))
58 ((:enotdir "ENOTDIR"))
59 ((:eisdir "EISDIR"))
60 ((:einval "EINVAL"))
61 ((:enfile "ENFILE"))
62 ((:emfile "EMFILE"))
63 ((:enotty "ENOTTY"))
64 ((:efbig "EFBIG"))
65 ((:enospc "ENOSPC"))
66 ((:espipe "ESPIPE"))
67 ((:erofs "EROFS"))
68 ((:emlink "EMLINK"))
69 ((:epipe "EPIPE"))
70 ((:edom "EDOM"))
71 ((:erange "ERANGE"))
72 ((:edeadlk "EDEADLK"))
73 ((:enametoolong "ENAMETOOLONG"))
74 ((:enolck "ENOLCK"))
75 ((:enosys "ENOSYS"))
76 ((:enotempty "ENOTEMPTY"))
77 ((:echrng "ECHRNG") :optional t)
78 ((:el2nsync "EL2NSYNC") :optional t)
79 ((:el3hlt "EL3HLT") :optional t)
80 ((:el3rst "EL3RST") :optional t)
81 ((:elnrng "ELNRNG") :optional t)
82 ((:eunatch "EUNATCH") :optional t)
83 ((:enocsi "ENOCSI") :optional t)
84 ((:el2hlt "EL2HLT") :optional t)
85 ((:ebade "EBADE") :optional t)
86 ((:ebadr "EBADR") :optional t)
87 ((:exfull "EXFULL") :optional t)
88 ((:enoano "ENOANO") :optional t)
89 ((:ebadrqc "EBADRQC") :optional t)
90 ((:ebadslt "EBADSLT") :optional t)
91 ((:edeadlock "EDEADLOCK") :optional t)
92 ((:ebfont "EBFONT") :optional t)
93 ((:enostr "ENOSTR") :optional t)
94 ((:enodata "ENODATA") :optional t)
95 ((:etime "ETIME") :optional t)
96 ((:enosr "ENOSR") :optional t)
97 ((:enopkg "ENOPKG") :optional t)
98 ((:eadv "EADV") :optional t)
99 ((:esrmnt "ESRMNT") :optional t)
100 ((:ecomm "ECOMM") :optional t)
101 ((:edotdot "EDOTDOT") :optional t)
102 ((:enotuniq "ENOTUNIQ") :optional t)
103 ((:ebadfd "EBADFD") :optional t)
104 ((:eremchg "EREMCHG") :optional t)
105 ((:elibacc "ELIBACC") :optional t)
106 ((:elibbad "ELIBBAD") :optional t)
107 ((:elibscn "ELIBSCN") :optional t)
108 ((:elibmax "ELIBMAX") :optional t)
109 ((:elibexec "ELIBEXEC") :optional t)
110 ((:eilseq "EILSEQ"))
111 ((:erestart "ERESTART") :optional t)
112 ((:estrpipe "ESTRPIPE") :optional t)
113 ((:euclean "EUCLEAN") :optional t)
114 ((:enotnam "ENOTNAM") :optional t)
115 ((:enavail "ENAVAIL") :optional t)
116 ((:eremoteio "EREMOTEIO") :optional t)
117 ((:enomedium "ENOMEDIUM") :optional t)
118 ((:emediumtype "EMEDIUMTYPE") :optional t)
119 ((:estale "ESTALE"))
120 ((:enotblk "ENOTBLK"))
121 ((:etxtbsy "ETXTBSY"))
122 ((:eusers "EUSERS"))
123 ((:eloop "ELOOP"))
124 ((:ewouldblock "EWOULDBLOCK"))
125 ((:enomsg "ENOMSG"))
126 ((:eidrm "EIDRM"))
127 ((:eproto "EPROTO"))
128 ((:emultihop "EMULTIHOP"))
129 ((:ebadmsg "EBADMSG"))
130 ((:eoverflow "EOVERFLOW"))
131 ((:edquot "EDQUOT"))
132 ((:einprogress "EINPROGRESS"))
133 ((:ealready "EALREADY"))
134 ;; TODO: These errors are related to sockets. However they
135 ;; might not be unique to them. Remove those that are unique
136 ;; and keep those that might be set elsewhere.
137 ((:eprotonosupport "EPROTONOSUPPORT"))
138 ((:esocktnosupport "ESOCKTNOSUPPORT"))
139 ((:enotsock "ENOTSOCK"))
140 ((:edestaddrreq "EDESTADDRREQ"))
141 ((:emsgsize "EMSGSIZE"))
142 ((:eprototype "EPROTOTYPE"))
143 ((:enoprotoopt "ENOPROTOOPT"))
144 ((:eremote "EREMOTE"))
145 ((:enolink "ENOLINK"))
146 ((:epfnosupport "EPFNOSUPPORT"))
147 ((:eafnosupport "EAFNOSUPPORT"))
148 ((:eaddrinuse "EADDRINUSE"))
149 ((:eaddrnotavail "EADDRNOTAVAIL"))
150 ((:enetdown "ENETDOWN"))
151 ((:enetunreach "ENETUNREACH"))
152 ((:enetreset "ENETRESET"))
153 ((:econnaborted "ECONNABORTED"))
154 ((:econnreset "ECONNRESET"))
155 ((:eisconn "EISCONN"))
156 ((:enotconn "ENOTCONN"))
157 ((:eshutdown "ESHUTDOWN"))
158 ((:etoomanyrefs "ETOOMANYREFS"))
159 ((:etimedout "ETIMEDOUT"))
160 ((:econnrefused "ECONNREFUSED"))
161 ((:ehostdown "EHOSTDOWN"))
162 ((:ehostunreach "EHOSTUNREACH"))
163 ((:enonet "ENONET") :optional t)
164 ((:enobufs "ENOBUFS"))
165 ((:eopnotsupp "EOPNOTSUPP")))
168 ;;; open()
170 (constant (o-rdonly "O_RDONLY"))
171 (constant (o-wronly "O_WRONLY"))
172 (constant (o-rdwr "O_RDWR"))
173 (constant (o-creat "O_CREAT"))
174 (constant (o-excl "O_EXCL"))
175 (constant (o-trunc "O_TRUNC"))
176 (constant (o-append "O_APPEND"))
178 (constant (o-noctty "O_NOCTTY"))
179 (constant (o-nonblock "O_NONBLOCK"))
180 (constant (o-ndelay "O_NDELAY"))
181 (constant (o-sync "O_SYNC"))
182 (constant (o-nofollow "O_NOFOLLOW"))
183 (constant (o-async "O_ASYNC"))
186 ;;; lseek()
188 (constant (seek-set "SEEK_SET"))
189 (constant (seek-cur "SEEK_CUR"))
190 (constant (seek-end "SEEK_END"))
193 ;;; access()
195 (constant (r-ok "R_OK"))
196 (constant (w-ok "W_OK"))
197 (constant (x-ok "X_OK"))
198 (constant (f-ok "F_OK"))
201 ;;;; stat()
203 (constant (s-irwxu "S_IRWXU")
204 :documentation "read, write, execute/search by owner")
205 (constant (s-irusr "S_IRUSR") :documentation "read permission, owner")
206 (constant (s-iwusr "S_IWUSR") :documentation "write permission, owner")
207 (constant (s-ixusr "S_IXUSR") :documentation "execute/search permission, owner")
208 (constant (s-ifmt "S_IFMT") :documentation "bitmask for type of entry")
209 (constant (s-ififo "S_IFIFO") :documentation "named pipe, aka fifo")
210 (constant (s-ifchr "S_IFCHR") :documentation "special character-device")
211 (constant (s-ifdir "S_IFDIR") :documentation "directory")
212 (constant (s-ifblk "S_IFBLK") :documentation "special block-device")
213 (constant (s-ifreg "S_IFREG") :documentation "regular file")
214 (constant (s-ifwht "S_IFWHT") :documentation "whiteout" :optional t)
215 (constant (s-iread "S_IREAD"))
216 (constant (s-iwrite "S_IWRITE"))
217 (constant (s-iexec "S_IEXEC"))
219 (constant (s-irwxg "S_IRWXG")
220 :documentation "read, write, execute/search by group")
221 (constant (s-irgrp "S_IRGRP") :documentation "read permission, group")
222 (constant (s-iwgrp "S_IWGRP") :documentation "write permission, group")
223 (constant (s-ixgrp "S_IXGRP")
224 :documentation "execute/search permission, group")
225 (constant (s-irwxo "S_IRWXO")
226 :documentation "read, write, execute/search by others")
227 (constant (s-iroth "S_IROTH") :documentation "read permission, others")
228 (constant (s-iwoth "S_IWOTH") :documentation "write permission, others")
229 (constant (s-ixoth "S_IXOTH")
230 :documentation "execute/search permission, others")
231 (constant (s-isuid "S_ISUID") :documentation "set-user-ID on execution")
232 (constant (s-isgid "S_ISGID") :documentation "set-group-ID on execution")
233 (constant (s-isvtx "S_ISVTX")
234 :documentation "'sticky' bit, many meanings, nonportable")
235 (constant (s-iflnk "S_IFLNK") :documentation "symbolic link")
236 (constant (s-ifsock "S_IFSOCK") :documentation "socket")
238 (constant (path-max "PATH_MAX" "MAXPATHLEN"))
241 ;;; from signal.h
243 (constant (sighup "SIGHUP") :documentation "terminal line hangup.")
244 (constant (sigquit "SIGQUIT") :documentation "quit program.")
245 (constant (sigtrap "SIGTRAP") :documentation "trace trap.")
246 #-linux
247 (constant (sigemt "SIGEMT") :documentation "emulate instruction executed.")
248 (constant (sigkill "SIGKILL") :documentation "kill program.")
249 (constant (sigbus "SIGBUS") :documentation "bus error.")
250 (constant (sigsys "SIGSYS") :documentation "non-existent system call invoked.")
251 (constant (sigpipe "SIGPIPE") :documentation "write on a pipe with no reader.")
252 (constant (sigalrm "SIGALRM") :documentation "real-timeimer expired.")
253 (constant (sigurg "SIGURG")
254 :documentation "urgent condition present on socket.")
255 (constant (sigstop "SIGSTOP")
256 :documentation "stop (cannot be caught or ignored).")
257 (constant (sigtstp "SIGTSTP")
258 :documentation "stop signal generated from keyboard.")
259 (constant (sigcont "SIGCONT") :documentation "continue after stop.")
260 (constant (sigchld "SIGCHLD") :documentation "child status has changed.")
261 (constant (sigttin "SIGTTIN")
262 :documentation "background read attempted from control terminal.")
263 (constant (sigttou "SIGTTOU")
264 :documentation "background write attempted from control terminal.")
265 (constant (sigio "SIGIO")
266 :documentation "I/O is possible on a descriptor (see fcntl(2)).")
267 (constant (sigxcpu "SIGXCPU")
268 :documentation "cpuime limit exceeded (see setrlimit(2)).")
269 (constant (sigxfsz "SIGXFSZ")
270 :documentation "file size limit exceeded (see setrlimit(2)).")
271 (constant (sigvtalrm "SIGVTALRM")
272 :documentation "virtualime alarm (see setitimer(2)).")
273 (constant (sigprof "SIGPROF")
274 :documentation "profilingimer alarm (see setitimer(2)).")
275 (constant (sigwinch "SIGWINCH") :documentation "Window size change.")
276 #-linux
277 (constant (siginfo "SIGINFO") :documentation "status request from keyboard.")
278 (constant (sigusr1 "SIGUSR1") :documentation "User defined signal 1.")
279 (constant (sigusr2 "SIGUSR2") :documentation "User defined signal 2.")
280 #+linux
281 (progn
282 (constant (sigrtmin "SIGRTMIN")
283 :documentation "Smallest real-time signal number.")
284 (constant (sigrtmax "SIGRTMAX")
285 :documentation "Largest real-time signal number."))
287 (constant (sig-ign "SIG_IGN"))
288 (constant (sig-dfl "SIG_DFL"))
290 (cstruct sigaction "struct sigaction"
291 (handler "sa_handler" :type :long))
294 ;; from sys/syscalls.h
296 #+linux (constant (sys-gettid "SYS_gettid"))
299 ;;; from unistd.h
301 (ctype useconds-t "useconds_t")
304 ;;; from time.h
306 (ctype time-t "time_t")
307 (ctype suseconds-t "suseconds_t")
309 #-darwin
310 (progn
311 (ctype clockid-t "clockid_t")
312 (constant (clock-monotonic "CLOCK_MONOTONIC"))
313 (constant (clock-realtime "CLOCK_REALTIME")))
315 (cstruct timespec "struct timespec"
316 "UNIX time specification in seconds and nanoseconds."
317 (sec "tv_sec" :type time-t)
318 (nsec "tv_nsec" :type :long))
321 ;;; from sys/select.h
323 (cstruct timeval "struct timeval"
324 "UNIX time specification in seconds and microseconds."
325 (sec "tv_sec" :type time-t)
326 (usec "tv_usec" :type suseconds-t))
328 (constant (fd-setsize "FD_SETSIZE"))
330 (cstruct fd-set "fd_set"
331 (bits "fds_bits" :type :uint8 :count :auto))
334 ;;; from sys/stat.h
336 (ctype dev-t "dev_t")
337 (ctype ino-t "ino_t")
339 (ctype nlink-t "nlink_t")
340 (ctype blksize-t "blksize_t")
341 (ctype blkcnt-t "blkcnt_t")
343 (cstruct stat "struct stat"
344 (dev "st_dev" :type dev-t)
345 (ino "st_ino" :type ino-t)
346 (mode "st_mode" :type mode-t)
347 (nlink "st_nlink" :type nlink-t)
348 (uid "st_uid" :type uid-t)
349 (gid "st_gid" :type gid-t)
350 (rdev "st_rdev" :type dev-t)
351 (size "st_size" :type off-t)
352 (blksize "st_blksize" :type blkcnt-t)
353 (blocks "st_blocks" :type blksize-t)
354 (atime "st_atime" :type time-t)
355 (mtime "st_mtime" :type time-t)
356 (ctime "st_ctime" :type time-t))
359 ;;;; fcntl()
361 (constant (f-dupfd "F_DUPFD"))
362 (constant (f-getfd "F_GETFD"))
363 (constant (f-setfd "F_SETFD"))
364 (constant (f-getfl "F_GETFL"))
365 (constant (f-setfl "F_SETFL"))
366 (constant (f-getlk "F_GETLK"))
367 (constant (f-setlk "F_SETLK"))
368 (constant (f-setlkw "F_SETLKW"))
369 (constant (f-getown "F_GETOWN"))
370 (constant (f-setown "F_SETOWN"))
371 (constant (f-rdlck "F_RDLCK"))
372 (constant (f-wrlck "F_WRLCK"))
373 (constant (f-unlck "F_UNLCK"))
375 #+linux
376 (progn
377 (constant (f-getsig "F_GETSIG"))
378 (constant (f-setsig "F_SETSIG"))
379 (constant (f-setlease "F_SETLEASE"))
380 (constant (f-getlease "F_GETLEASE")))
383 ;;; mmap()
385 (constant (prot-none "PROT_NONE") :documentation "mmap: no protection")
386 (constant (prot-read "PROT_READ") :documentation "mmap: read protection")
387 (constant (prot-write "PROT_WRITE") :documentation "mmap: write protection")
388 (constant (prot-exec "PROT_EXEC") :documentation "mmap: execute protection")
389 (constant (map-shared "MAP_SHARED") :documentation "mmap: shared memory")
390 (constant (map-private "MAP_PRIVATE") :documentation "mmap: private mapping")
391 (constant (map-fixed "MAP_FIXED") :documentation "mmap: map at location")
392 (constant (map-failed "MAP_FAILED") :documentation "mmap: failure")
395 ;;; from sys/poll.h
397 (ctype nfds-t "nfds_t")
399 (cstruct pollfd "struct pollfd"
400 "Poll file descriptor activity specification structure."
401 (fd "fd" :type :int)
402 (events "events" :type :short)
403 (revents "revents" :type :short))
405 (constant (pollin "POLLIN"))
406 (constant (pollrdnorm "POLLRDNORM"))
407 (constant (pollrdband "POLLRDBAND"))
408 (constant (pollpri "POLLPRI"))
409 (constant (pollout "POLLOUT"))
410 (constant (pollwrnorm "POLLWRNORM"))
411 (constant (pollwrband "POLLWRBAND"))
412 (constant (pollerr "POLLERR"))
413 #+linux (constant (pollrdhup "POLLRDHUP"))
414 (constant (pollhup "POLLHUP"))
415 (constant (pollnval "POLLNVAL"))
417 ;;;; from sys/epoll.h
419 #+linux
420 (progn
421 (cunion epoll-data "epoll_data_t"
422 (ptr "ptr" :type :pointer)
423 (fd "fd" :type :int)
424 (u32 "u32" :type :uint32)
425 (u64 "u64" :type :uint64))
427 (cstruct epoll-event "struct epoll_event"
428 (events "events" :type :uint32)
429 (data "data" :type epoll-data))
431 (constant (epoll-ctl-add "EPOLL_CTL_ADD"))
432 (constant (epoll-ctl-del "EPOLL_CTL_DEL"))
433 (constant (epoll-ctl-mod "EPOLL_CTL_MOD"))
435 (constant (epollin "EPOLLIN"))
436 (constant (epollrdnorm "EPOLLRDNORM"))
437 (constant (epollrdband "EPOLLRDBAND"))
438 (constant (epollpri "EPOLLPRI"))
439 (constant (epollout "EPOLLOUT"))
440 (constant (epollwrnorm "EPOLLWRNORM"))
441 (constant (epollwrband "EPOLLWRBAND"))
442 (constant (epollerr "EPOLLERR"))
443 (constant (epollhup "EPOLLHUP"))
444 (constant (epollmsg "EPOLLMSG"))
445 (constant (epolloneshot "EPOLLONESHOT"))
446 (constant (epollet "EPOLLET")))
448 ;;;; from sys/event.h
450 #+bsd
451 (progn
452 (ctype intptr-t "intptr_t")
453 (ctype uintptr-t "uintptr_t")
455 (cstruct kevent "struct kevent"
456 (ident "ident" :type uintptr-t)
457 (filter "filter" :type #-netbsd :short
458 #+netbsd :uint32)
459 (flags "flags" :type #-netbsd :unsigned-short
460 #+netbsd :uint32)
461 (fflags "fflags" :type #-netbsd :unsigned-int
462 #+netbsd :uint32)
463 (data "data" :type #-netbsd intptr-t
464 #+netbsd :int64)
465 (udata "udata" :type :pointer))
467 ;; kevent() flags
468 (constant (ev-add "EV_ADD"))
469 (constant (ev-enable "EV_ENABLE"))
470 (constant (ev-disable "EV_DISABLE"))
471 (constant (ev-delete "EV_DELETE"))
472 (constant (ev-oneshot "EV_ONESHOT"))
473 (constant (ev-clear "EV_CLEAR"))
474 (constant (ev-eof "EV_EOF"))
475 (constant (ev-error "EV_ERROR"))
477 ;; kevent() filter flags
478 (constant (evfilt-read "EVFILT_READ"))
479 (constant (evfilt-write "EVFILT_WRITE"))
480 (constant (evfilt-aio "EVFILT_AIO"))
481 (constant (evfilt-vnode "EVFILT_VNODE"))
482 (constant (evfilt-proc "EVFILT_PROC"))
483 (constant (evfilt-signal "EVFILT_SIGNAL"))
484 (constant (evfilt-timer "EVFILT_TIMER"))
485 #-darwin (constant (evfilt-netdev "EVFILT_NETDEV"))
487 ;; EVFILT_VNODE options
488 (constant (note-delete "NOTE_DELETE"))
489 (constant (note-write "NOTE_WRITE"))
490 (constant (note-extend "NOTE_EXTEND"))
491 (constant (note-attrib "NOTE_ATTRIB"))
492 (constant (note-link "NOTE_LINK"))
493 (constant (note-rename "NOTE_RENAME"))
494 (constant (note-revoke "NOTE_REVOKE"))
496 ;; EVFILT_PROC options
497 (constant (note-exit "NOTE_EXIT"))
498 (constant (note-fork "NOTE_FORK"))
499 (constant (note-exec "NOTE_EXEC"))
500 (constant (note-track "NOTE_TRACK"))
501 (constant (note-trackerr "NOTE_TRACKERR"))
503 ;; EVFILT_NETDEV options
504 #-darwin
505 (progn
506 (constant (note-linkup "NOTE_LINKUP"))
507 (constant (note-linkdown "NOTE_LINKDOWN"))
508 (constant (note-linkinv "NOTE_LINKINV"))))
511 ;;; from dirent.h
513 ;; Apparently POSIX 1003.1-2001 (according to linux manpages) only
514 ;; requires d_name. Sigh. I guess we should assemble some decent
515 ;; wrapper functions. No, struct members can't be optional at this
516 ;; point.
517 (cstruct dirent "struct dirent"
518 ;; POSIX actually requires this to be d_ino
519 (fileno "d_fileno" :type #-freebsd ino-t #+freebsd :uint32)
520 (type "d_type" :type :uint8)
521 (name "d_name" :type :uint8 :count :auto))
523 ;;; filetypes set in d_type slot of struct dirent
524 (constant (dt-unknown "DT_UNKNOWN"))
525 (constant (dt-fifo "DT_FIFO"))
526 (constant (dt-chr "DT_CHR"))
527 (constant (dt-dir "DT_DIR"))
528 (constant (dt-blk "DT_BLK"))
529 (constant (dt-reg "DT_REG"))
530 (constant (dt-lnk "DT_LNK"))
531 (constant (dt-sock "DT_SOCK"))
532 (constant (dt-wht "DT_WHT"))
535 ;;; ioctl()
537 (constant (fionbio "FIONBIO"))
538 (constant (fionread "FIONREAD"))
541 ;;; from sys/resource.h
543 (ctype rlim-t "rlim_t")
544 (ctype id-t "id_t")
546 (cstruct rlimit "struct rlimit"
547 (cur "rlim_cur" :type rlim-t)
548 (max "rlim_max" :type rlim-t))
550 (cstruct rusage "struct rusage"
551 (utime "ru_utime" :type timeval)
552 (stime "ru_stime" :type timeval)
553 (maxrss "ru_maxrss" :type :long)
554 (ixrss "ru_ixrss" :type :long)
555 (idrss "ru_idrss" :type :long)
556 (isrss "ru_isrss" :type :long)
557 (minflt "ru_minflt" :type :long)
558 (majflt "ru_majflt" :type :long)
559 (nswap "ru_nswap" :type :long)
560 (inblock "ru_inblock" :type :long)
561 (oublock "ru_oublock" :type :long)
562 (msgsnd "ru_msgsnd" :type :long)
563 (msgrcv "ru_msgrcv" :type :long)
564 (nsignals "ru_nsignals" :type :long)
565 (nvcsw "ru_nvcsw" :type :long)
566 (nivcsw "ru_nivcsw" :type :long))
568 (constant (prio-process "PRIO_PROCESS"))
569 (constant (prio-pgrp "PRIO_PGRP"))
570 (constant (prio-user "PRIO_USER"))
571 (constant (rlim-infinity "RLIM_INFINITY"))
572 (constant (rusage-self "RUSAGE_SELF"))
573 (constant (rusage-children "RUSAGE_CHILDREN"))
574 (constant (rlimit-as "RLIMIT_AS"))
575 (constant (rlimit-core "RLIMIT_CORE"))
576 (constant (rlimit-cpu "RLIMIT_CPU"))
577 (constant (rlimit-data "RLIMIT_DATA"))
578 (constant (rlimit-fsize "RLIMIT_FSIZE"))
579 (constant (rlimit-memlock "RLIMIT_MEMLOCK"))
580 (constant (rlimit-nofile "RLIMIT_NOFILE"))
581 (constant (rlimit-nproc "RLIMIT_NPROC"))
582 (constant (rlimit-rss "RLIMIT_RSS"))
583 (constant (rlimit-stack "RLIMIT_STACK"))
585 #+linux
586 (progn
587 (constant (rlim-saved-max "RLIM_SAVED_MAX"))
588 (constant (rlim-saved-cur "RLIM_SAVED_CUR"))
589 (constant (rlimit-locks "RLIMIT_LOCKS"))
590 (constant (rlimit-msgqueue "RLIMIT_MSGQUEUE"))
591 (constant (rlimit-nlimits "RLIMIT_NLIMITS"))
592 (constant (rlimit-nice "RLIMIT_NICE"))
593 (constant (rlimit-rtprio "RLIMIT_RTPRIO"))
594 (constant (rlimit-sigpending "RLIMIT_SIGPENDING")))
596 #+freebsd
597 (constant (rlimit-sbsize "RLIMIT_SBSIZE"))
600 ;;;; from sys/utsname.h
602 (cstruct utsname "struct utsname"
603 (sysname "sysname" :type :char)
604 (nodename "nodename" :type :char)
605 (release "release" :type :char)
606 (version "version" :type :char)
607 (machine "machine" :type :char))
610 ;;; from pwd.h
612 (cstruct passwd-entry "struct passwd"
613 (name "pw_name" :type :string)
614 (passwd "pw_passwd" :type :string)
615 (uid "pw_uid" :type uid-t)
616 (gid "pw_gid" :type gid-t)
617 (gecos "pw_gecos" :type :string)
618 (dir "pw_dir" :type :string)
619 (shell "pw_shell" :type :string))
622 ;;; from grp.h
624 (cstruct group-entry "struct group"
625 (name "gr_name" :type :string)
626 (passwd "gr_passwd" :type :string)
627 (gid "gr_gid" :type gid-t)
628 (mem "gr_mem" :type :pointer))