Better %SYS-GETTID.
[iolib.git] / syscalls / ffi-types-unix.lisp
blobf48f5a8bcc6ddcbda7edca9653dae20c83387e11
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."))
288 ;; from sys/syscalls.h
290 #+linux (constant (sys-gettid "SYS_gettid"))
293 ;;; from unistd.h
295 (ctype useconds-t "useconds_t")
298 ;;; from time.h
300 (ctype time-t "time_t")
301 (ctype suseconds-t "suseconds_t")
303 #-darwin
304 (progn
305 (ctype clockid-t "clockid_t")
306 (constant (clock-monotonic "CLOCK_MONOTONIC"))
307 (constant (clock-realtime "CLOCK_REALTIME")))
309 (cstruct timespec "struct timespec"
310 "UNIX time specification in seconds and nanoseconds."
311 (sec "tv_sec" :type time-t)
312 (nsec "tv_nsec" :type :long))
315 ;;; from sys/select.h
317 (cstruct timeval "struct timeval"
318 "UNIX time specification in seconds and microseconds."
319 (sec "tv_sec" :type time-t)
320 (usec "tv_usec" :type suseconds-t))
322 (constant (fd-setsize "FD_SETSIZE"))
324 (cstruct fd-set "fd_set"
325 (bits "fds_bits" :type :uint8 :count :auto))
328 ;;; from sys/stat.h
330 (ctype dev-t "dev_t")
331 (ctype ino-t "ino_t")
333 (ctype nlink-t "nlink_t")
334 (ctype blksize-t "blksize_t")
335 (ctype blkcnt-t "blkcnt_t")
337 (cstruct stat "struct stat"
338 (dev "st_dev" :type #-mips dev-t #+mips :unsigned-long)
339 (ino "st_ino" :type ino-t)
340 (mode "st_mode" :type mode-t)
341 (nlink "st_nlink" :type nlink-t)
342 (uid "st_uid" :type uid-t)
343 (gid "st_gid" :type gid-t)
344 (rdev "st_rdev" :type #-mips dev-t #+mips :unsigned-long)
345 (size "st_size" :type off-t)
346 (blksize "st_blksize" :type blkcnt-t)
347 (blocks "st_blocks" :type blksize-t)
348 (atime "st_atime" :type time-t)
349 (mtime "st_mtime" :type time-t)
350 (ctime "st_ctime" :type time-t))
353 ;;;; fcntl()
355 (constant (f-dupfd "F_DUPFD"))
356 (constant (f-getfd "F_GETFD"))
357 (constant (f-setfd "F_SETFD"))
358 (constant (f-getfl "F_GETFL"))
359 (constant (f-setfl "F_SETFL"))
360 (constant (f-getlk "F_GETLK"))
361 (constant (f-setlk "F_SETLK"))
362 (constant (f-setlkw "F_SETLKW"))
363 (constant (f-getown "F_GETOWN"))
364 (constant (f-setown "F_SETOWN"))
365 (constant (f-rdlck "F_RDLCK"))
366 (constant (f-wrlck "F_WRLCK"))
367 (constant (f-unlck "F_UNLCK"))
369 #+linux
370 (progn
371 (constant (f-getsig "F_GETSIG"))
372 (constant (f-setsig "F_SETSIG"))
373 (constant (f-setlease "F_SETLEASE"))
374 (constant (f-getlease "F_GETLEASE")))
377 ;;; mmap()
379 (constant (prot-none "PROT_NONE") :documentation "mmap: no protection")
380 (constant (prot-read "PROT_READ") :documentation "mmap: read protection")
381 (constant (prot-write "PROT_WRITE") :documentation "mmap: write protection")
382 (constant (prot-exec "PROT_EXEC") :documentation "mmap: execute protection")
383 (constant (map-shared "MAP_SHARED") :documentation "mmap: shared memory")
384 (constant (map-private "MAP_PRIVATE") :documentation "mmap: private mapping")
385 (constant (map-fixed "MAP_FIXED") :documentation "mmap: map at location")
386 (constant (map-failed "MAP_FAILED") :documentation "mmap: failure")
389 ;;; from sys/poll.h
391 (ctype nfds-t "nfds_t")
393 (cstruct pollfd "struct pollfd"
394 "Poll file descriptor activity specification structure."
395 (fd "fd" :type :int)
396 (events "events" :type :short)
397 (revents "revents" :type :short))
399 (constant (pollin "POLLIN"))
400 (constant (pollrdnorm "POLLRDNORM"))
401 (constant (pollrdband "POLLRDBAND"))
402 (constant (pollpri "POLLPRI"))
403 (constant (pollout "POLLOUT"))
404 (constant (pollwrnorm "POLLWRNORM"))
405 (constant (pollwrband "POLLWRBAND"))
406 (constant (pollerr "POLLERR"))
407 #+linux (constant (pollrdhup "POLLRDHUP"))
408 (constant (pollhup "POLLHUP"))
409 (constant (pollnval "POLLNVAL"))
411 ;;;; from sys/epoll.h
413 #+linux
414 (progn
415 (cunion epoll-data "epoll_data_t"
416 (ptr "ptr" :type :pointer)
417 (fd "fd" :type :int)
418 (u32 "u32" :type :uint32)
419 (u64 "u64" :type :uint64))
421 (cstruct epoll-event "struct epoll_event"
422 (events "events" :type :uint32)
423 (data "data" :type epoll-data))
425 (constant (epoll-ctl-add "EPOLL_CTL_ADD"))
426 (constant (epoll-ctl-del "EPOLL_CTL_DEL"))
427 (constant (epoll-ctl-mod "EPOLL_CTL_MOD"))
429 (constant (epollin "EPOLLIN"))
430 (constant (epollrdnorm "EPOLLRDNORM"))
431 (constant (epollrdband "EPOLLRDBAND"))
432 (constant (epollpri "EPOLLPRI"))
433 (constant (epollout "EPOLLOUT"))
434 (constant (epollwrnorm "EPOLLWRNORM"))
435 (constant (epollwrband "EPOLLWRBAND"))
436 (constant (epollerr "EPOLLERR"))
437 (constant (epollhup "EPOLLHUP"))
438 (constant (epollmsg "EPOLLMSG"))
439 (constant (epolloneshot "EPOLLONESHOT"))
440 (constant (epollet "EPOLLET")))
442 ;;;; from sys/event.h
444 #+bsd
445 (progn
446 (ctype intptr-t "intptr_t")
447 (ctype uintptr-t "uintptr_t")
449 (cstruct kevent "struct kevent"
450 (ident "ident" :type uintptr-t)
451 (filter "filter" :type :short)
452 (flags "flags" :type :unsigned-short)
453 (fflags "fflags" :type :unsigned-int)
454 (data "data" :type intptr-t)
455 (udata "udata" :type :pointer))
457 ;; kevent() flags
458 (constant (ev-add "EV_ADD"))
459 (constant (ev-enable "EV_ENABLE"))
460 (constant (ev-disable "EV_DISABLE"))
461 (constant (ev-delete "EV_DELETE"))
462 (constant (ev-oneshot "EV_ONESHOT"))
463 (constant (ev-clear "EV_CLEAR"))
464 (constant (ev-eof "EV_EOF"))
465 (constant (ev-error "EV_ERROR"))
467 ;; kevent() filter flags
468 (constant (evfilt-read "EVFILT_READ"))
469 (constant (evfilt-write "EVFILT_WRITE"))
470 (constant (evfilt-aio "EVFILT_AIO"))
471 (constant (evfilt-vnode "EVFILT_VNODE"))
472 (constant (evfilt-proc "EVFILT_PROC"))
473 (constant (evfilt-signal "EVFILT_SIGNAL"))
474 (constant (evfilt-timer "EVFILT_TIMER"))
475 #-darwin (constant (evfilt-netdev "EVFILT_NETDEV"))
477 ;; EVFILT_VNODE options
478 (constant (note-delete "NOTE_DELETE"))
479 (constant (note-write "NOTE_WRITE"))
480 (constant (note-extend "NOTE_EXTEND"))
481 (constant (note-attrib "NOTE_ATTRIB"))
482 (constant (note-link "NOTE_LINK"))
483 (constant (note-rename "NOTE_RENAME"))
484 (constant (note-revoke "NOTE_REVOKE"))
486 ;; EVFILT_PROC options
487 (constant (note-exit "NOTE_EXIT"))
488 (constant (note-fork "NOTE_FORK"))
489 (constant (note-exec "NOTE_EXEC"))
490 (constant (note-track "NOTE_TRACK"))
491 (constant (note-trackerr "NOTE_TRACKERR"))
493 ;; EVFILT_NETDEV options
494 #-darwin
495 (progn
496 (constant (note-linkup "NOTE_LINKUP"))
497 (constant (note-linkdown "NOTE_LINKDOWN"))
498 (constant (note-linkinv "NOTE_LINKINV"))))
501 ;;; from dirent.h
503 ;; Apparently POSIX 1003.1-2001 (according to linux manpages) only
504 ;; requires d_name. Sigh. I guess we should assemble some decent
505 ;; wrapper functions. No, struct members can't be optional at this
506 ;; point.
507 (cstruct dirent "struct dirent"
508 ;; POSIX actually requires this to be d_ino
509 (fileno "d_fileno" :type #-freebsd ino-t #+freebsd :uint32)
510 (type "d_type" :type :uint8)
511 (name "d_name" :type :uint8 :count :auto))
513 ;;; filetypes set in d_type slot of struct dirent
514 (constant (dt-unknown "DT_UNKNOWN"))
515 (constant (dt-fifo "DT_FIFO"))
516 (constant (dt-chr "DT_CHR"))
517 (constant (dt-dir "DT_DIR"))
518 (constant (dt-blk "DT_BLK"))
519 (constant (dt-reg "DT_REG"))
520 (constant (dt-lnk "DT_LNK"))
521 (constant (dt-sock "DT_SOCK"))
522 (constant (dt-wht "DT_WHT"))
525 ;;; ioctl()
527 (constant (fionbio "FIONBIO"))
528 (constant (fionread "FIONREAD"))
531 ;;; from sys/resource.h
533 (ctype rlim-t "rlim_t")
534 (ctype id-t "id_t")
536 (cstruct rlimit "struct rlimit"
537 (cur "rlim_cur" :type rlim-t)
538 (max "rlim_max" :type rlim-t))
540 (cstruct rusage "struct rusage"
541 (utime "ru_utime" :type timeval)
542 (stime "ru_stime" :type timeval)
543 (maxrss "ru_maxrss" :type :long)
544 (ixrss "ru_ixrss" :type :long)
545 (idrss "ru_idrss" :type :long)
546 (isrss "ru_isrss" :type :long)
547 (minflt "ru_minflt" :type :long)
548 (majflt "ru_majflt" :type :long)
549 (nswap "ru_nswap" :type :long)
550 (inblock "ru_inblock" :type :long)
551 (oublock "ru_oublock" :type :long)
552 (msgsnd "ru_msgsnd" :type :long)
553 (msgrcv "ru_msgrcv" :type :long)
554 (nsignals "ru_nsignals" :type :long)
555 (nvcsw "ru_nvcsw" :type :long)
556 (nivcsw "ru_nivcsw" :type :long))
558 (constant (prio-process "PRIO_PROCESS"))
559 (constant (prio-pgrp "PRIO_PGRP"))
560 (constant (prio-user "PRIO_USER"))
561 (constant (rlim-infinity "RLIM_INFINITY"))
562 (constant (rusage-self "RUSAGE_SELF"))
563 (constant (rusage-children "RUSAGE_CHILDREN"))
564 (constant (rlimit-as "RLIMIT_AS"))
565 (constant (rlimit-core "RLIMIT_CORE"))
566 (constant (rlimit-cpu "RLIMIT_CPU"))
567 (constant (rlimit-data "RLIMIT_DATA"))
568 (constant (rlimit-fsize "RLIMIT_FSIZE"))
569 (constant (rlimit-memlock "RLIMIT_MEMLOCK"))
570 (constant (rlimit-nofile "RLIMIT_NOFILE"))
571 (constant (rlimit-nproc "RLIMIT_NPROC"))
572 (constant (rlimit-rss "RLIMIT_RSS"))
573 (constant (rlimit-stack "RLIMIT_STACK"))
575 #+linux
576 (progn
577 (constant (rlim-saved-max "RLIM_SAVED_MAX"))
578 (constant (rlim-saved-cur "RLIM_SAVED_CUR"))
579 (constant (rlimit-locks "RLIMIT_LOCKS"))
580 (constant (rlimit-msgqueue "RLIMIT_MSGQUEUE"))
581 (constant (rlimit-nlimits "RLIMIT_NLIMITS"))
582 (constant (rlimit-nice "RLIMIT_NICE"))
583 (constant (rlimit-rtprio "RLIMIT_RTPRIO"))
584 (constant (rlimit-sigpending "RLIMIT_SIGPENDING")))
586 #+freebsd
587 (constant (rlimit-sbsize "RLIMIT_SBSIZE"))
590 ;;;; from sys/utsname.h
592 (cstruct utsname "struct utsname"
593 (sysname "sysname" :type :char)
594 (nodename "nodename" :type :char)
595 (release "release" :type :char)
596 (version "version" :type :char)
597 (machine "machine" :type :char))
600 ;;; from pwd.h
602 (cstruct passwd-entry "struct passwd"
603 (name "pw_name" :type :string)
604 (passwd "pw_passwd" :type :string)
605 (uid "pw_uid" :type uid-t)
606 (gid "pw_gid" :type gid-t)
607 (gecos "pw_gecos" :type :string)
608 (dir "pw_dir" :type :string)
609 (shell "pw_shell" :type :string))
612 ;;; from grp.h
614 (cstruct group-entry "struct group"
615 (name "gr_name" :type :string)
616 (passwd "gr_passwd" :type :string)
617 (gid "gr_gid" :type gid-t)
618 (mem "gr_mem" :type :pointer))