Remove «Syntax:» from file headers
[iolib.git] / src / syscalls / pkgdcl.lisp
blob1ee3bd74ab01abe34fd59572d778ea446f617786
1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
2 ;;;
3 ;;; --- Package definition.
4 ;;;
6 (in-package :common-lisp-user)
8 (defpackage :iolib.syscalls
9 (:nicknames #:isys)
10 (:use :iolib.base :cffi)
11 (:shadow #:open #:close #:read #:write #:listen #:truncate #:ftruncate #:time)
12 (:export
14 ;;;--------------------------------------------------------------------------
15 ;;; C Types
16 ;;;--------------------------------------------------------------------------
18 ;; Primitive type sizes
19 #:size-of-char
20 #:size-of-short
21 #:size-of-int
22 #:size-of-long
23 #:size-of-long-long
24 #:size-of-pointer
26 ;; POSIX Types
27 #:size-t #:size-of-size-t
28 #:ssize-t #:size-of-ssize-t
29 #:pid-t #:size-of-pid-t
30 #:gid-t #:size-of-gid-t
31 #:uid-t #:size-of-uid-t
32 #:off-t #:size-of-off-t
33 #:mode-t #:size-of-mode-t
34 #:time-t #:size-of-time-t
35 #:useconds-t #:size-of-useconds-t
36 #:suseconds-t #:size-of-suseconds-t
37 #:dev-t #:size-of-dev-t
38 #:ino-t #:size-of-ino-t
39 #:nlink-t #:size-of-nlink-t
40 #:blksize-t #:size-of-blksize-t
41 #:blkcnt-t #:size-of-blkcnt-t
42 #:nfds-t #:size-of-nfds-t
45 ;;;--------------------------------------------------------------------------
46 ;;; C Constants
47 ;;;--------------------------------------------------------------------------
49 ;; Open()
50 #:o-rdonly
51 #:o-wronly
52 #:o-rdwr
53 #:o-creat
54 #:o-excl
55 #:o-trunc
56 #:o-append
57 #:o-noctty
58 #:o-nonblock
59 #:o-ndelay
60 #:o-sync
61 #:o-nofollow
62 #:o-async
63 #:o-cloexec
65 ;; Lseek()
66 #:seek-set
67 #:seek-cur
68 #:seek-end
70 ;; Access()
71 #:r-ok
72 #:w-ok
73 #:x-ok
74 #:f-ok
76 ;; Stat()
77 #:s-irwxu
78 #:s-irusr
79 #:s-iwusr
80 #:s-ixusr
81 #:s-ifmt
82 #:s-ififo
83 #:s-ifchr
84 #:s-ifdir
85 #:s-ifblk
86 #:s-ifreg
87 #:s-ifwht
88 #:s-iread
89 #:s-iwrite
90 #:s-iexec
91 #:s-irwxg
92 #:s-irgrp
93 #:s-iwgrp
94 #:s-ixgrp
95 #:s-irwxo
96 #:s-iroth
97 #:s-iwoth
98 #:s-ixoth
99 #:s-isuid
100 #:s-isgid
101 #:s-isvtx
102 #:s-iflnk
103 #:s-ifsock
104 #:path-max
106 ;; Readdir()
107 #:dt-unknown
108 #:dt-fifo
109 #:dt-chr
110 #:dt-dir
111 #:dt-blk
112 #:dt-reg
113 #:dt-lnk
114 #:dt-sock
115 #:dt-wht
117 ;; Kill()
118 #:sighup
119 #:sigquit
120 #:sigtrap
121 #-linux #:sigemt
122 #:sigkill
123 #:sigbus
124 #:sigsys
125 #:sigpipe
126 #:sigalrm
127 #:sigurg
128 #:sigstop
129 #:sigtstp
130 #:sigcont
131 #:sigchld
132 #:sigcld
133 #:sigttin
134 #:sigttou
135 #:sigio
136 #:sigxcpu
137 #:sigxfsz
138 #:sigvtalrm
139 #:sigprof
140 #:sigwinch
141 #-linux #:siginfo
142 #:sigusr1
143 #:sigusr2
144 #+linux #:sigrtmin
145 #+linux #:sigrtmax
147 ;; waitpid()
148 #:wnohang
149 #:wuntraced
150 #:wcontinued
152 ;; Sigaction()
153 #:sig-ign
154 #:sig-dfl
155 #:sa-nocldstop
156 #:sa-nocldwait
157 #:sa-nodefer
158 #:sa-onstack
159 #:sa-resethand
160 #:sa-restart
161 #:sa-siginfo
163 ;; Fcntl()
164 #:f-dupfd
165 #:f-getfd
166 #:f-setfd
167 #:f-getfl
168 #:f-setfl
169 #:f-getlk
170 #:f-setlk
171 #:f-setlkw
172 #:f-getown
173 #:f-setown
174 #:f-rdlck
175 #:f-wrlck
176 #:f-unlck
177 #+linux #:f-getsig
178 #+linux #:f-setsig
179 #+linux #:f-setlease
180 #+linux #:f-getlease
182 ;; Mmap()
183 #:prot-none
184 #:prot-read
185 #:prot-write
186 #:prot-exec
187 #:map-shared
188 #:map-private
189 #:map-fixed
190 #:map-failed
192 ;; Select()
193 #:fd-setsize
195 ;; Poll()
196 #:pollin
197 #:pollrdnorm
198 #:pollrdband
199 #:pollpri
200 #:pollout
201 #:pollwrnorm
202 #:pollwrband
203 #:pollerr
204 #:pollrdhup
205 #:pollhup
206 #:pollnval
208 ;; Epoll
209 #+linux #:epoll-ctl-add
210 #+linux #:epoll-ctl-del
211 #+linux #:epoll-ctl-mod
212 #+linux #:epollin
213 #+linux #:epollrdnorm
214 #+linux #:epollrdband
215 #+linux #:epollpri
216 #+linux #:epollout
217 #+linux #:epollwrnorm
218 #+linux #:epollwrband
219 #+linux #:epollerr
220 #+linux #:epollhup
221 #+linux #:epollmsg
222 #+linux #:epolloneshot
223 #+linux #:epollet
225 ;; Kevent
226 #+bsd #:ev-add
227 #+bsd #:ev-enable
228 #+bsd #:ev-disable
229 #+bsd #:ev-delete
230 #+bsd #:ev-oneshot
231 #+bsd #:ev-clear
232 #+bsd #:ev-eof
233 #+bsd #:ev-error
234 #+bsd #:evfilt-read
235 #+bsd #:evfilt-write
236 #+bsd #:evfilt-aio
237 #+bsd #:evfilt-vnode
238 #+bsd #:evfilt-proc
239 #+bsd #:evfilt-signal
240 #+bsd #:evfilt-timer
241 #+(and bsd (not darwin)) #:evfilt-netdev
242 #+bsd #:note-delete
243 #+bsd #:note-write
244 #+bsd #:note-extend
245 #+bsd #:note-attrib
246 #+bsd #:note-link
247 #+bsd #:note-rename
248 #+bsd #:note-revoke
249 #+bsd #:note-exit
250 #+bsd #:note-fork
251 #+bsd #:note-exec
252 #+bsd #:note-track
253 #+bsd #:note-trackerr
254 #+(and bsd (not darwin)) #:note-linkup
255 #+(and bsd (not darwin)) #:note-linkdown
256 #+(and bsd (not darwin)) #:note-linkinv
258 ;; Ioctl()
259 #:fionbio
260 #:fionread
262 ;; Getrlimit()
263 #:prio-process
264 #:prio-pgrp
265 #:prio-user
266 #:rlim-infinity
267 #:rusage-self
268 #:rusage-children
269 #:rlimit-as
270 #:rlimit-core
271 #:rlimit-cpu
272 #:rlimit-data
273 #:rlimit-fsize
274 #:rlimit-memlock
275 #:rlimit-nofile
276 #:rlimit-nproc
277 #:rlimit-rss
278 #:rlimit-stack
279 #+linux #:rlim-saved-max
280 #+linux #:rlim-saved-cur
281 #+linux #:rlimit-locks
282 #+linux #:rlimit-msgqueue
283 #+linux #:rlimit-nlimits
284 #+linux #:rlimit-nice
285 #+linux #:rlimit-rtprio
286 #+linux #:rlimit-sigpending
287 #+bsd #:rlimit-sbsize
289 ;; Syscall error codes
290 #:errno-values
291 #:eperm #:enoent #:esrch #:eintr #:eio #:enxio #:e2big #:enoexec
292 #:ebadf #:echild #:eagain #:enomem #:eacces #:efault #:ebusy #:eexist
293 #:exdev #:enodev #:enotdir #:eisdir #:einval #:enfile #:emfile
294 #:enotty #:efbig #:enospc #:espipe #:erofs #:emlink #:epipe #:edom
295 #:erange #:edeadlk #:enametoolong #:enolck #:enosys #:enotempty
296 #:echrng #:el2nsync #:el3hlt #:el3rst #:elnrng #:eunatch #:enocsi
297 #:el2hlt #:ebade #:ebadr #:exfull #:enoano #:ebadrqc #:ebadslt
298 #:edeadlock #:ebfont #:enostr #:enodata #:etime #:enosr #:enopkg
299 #:eadv #:esrmnt #:ecomm #:edotdot #:enotuniq #:ebadfd #:elibscn
300 #:elibmax #:elibexec #:eilseq #:erestart #:estrpipe #:euclean
301 #:enotnam #:enavail #:eremoteio #:enomedium #:emediumtype #:estale
302 #:enotblk #:etxtbsy #:eusers #:eloop #:ewouldblock #:enomsg #:eidrm
303 #:eproto #:emultihop #:ebadmsg #:eoverflow #:edquot #:einprogress
304 #:ealready #:eprotonosupport #:esocktnosupport #:enotsock
305 #:edestaddrreq #:emsgsize #:eprototype #:enoprotoopt #:eremote
306 #:enolink #:epfnosupport #:eafnosupport #:eaddrinuse #:eaddrnotavail
307 #:enetdown #:enetunreach #:enetreset #:econnaborted #:econnreset
308 #:eisconn #:enotconn #:eshutdown #:etoomanyrefs #:etimedout
309 #:econnrefused #:ehostdown #:ehostunreach #:enonet #:enobufs
310 #:eopnotsupp
313 ;;;--------------------------------------------------------------------------
314 ;;; Syscalls
315 ;;;--------------------------------------------------------------------------
317 ;; Specials
318 #:*default-open-mode*
319 #:*environ*
321 ;; Errno-related functions
322 #:strerror
323 #:errno
325 ;; Memory manipulation functions
326 #:memset
327 #:bzero
328 #:memcpy
329 #:memmove
331 ;; Files
332 #:read
333 #:write
334 #:readv
335 #:writev
336 #:pread
337 #:pwrite
338 #:open
339 #:creat
340 #:pipe
341 #:mkfifo
342 #:umask
343 #:lseek
344 #:access
345 #:truncate
346 #:ftruncate
347 #:rename
348 #:link
349 #:symlink
350 #:readlink
351 #:realpath
352 #:unlink
353 #:chown
354 #:fchown
355 #:lchown
356 #:chmod
357 #:fchmod
358 #:stat
359 #:fstat
360 #:lstat
361 #:sync
362 #:fsync
363 #:mkstemp
365 ;; Directories
366 #:mkdir
367 #:rmdir
368 #:chdir
369 #:fchdir
370 #:getcwd
371 #:mkdtemp
373 ;; File descriptors
374 #:close
375 #:dup
376 #:dup2
377 #:fcntl
378 #:fd-nonblock
379 #:ioctl
380 #:fd-open-p
382 ;; TTYs
383 #:posix-openpt
384 #:grantpt
385 #:unlockpt
386 #:ptsname
388 ;; I/O Polling
389 #:select
390 #:fd-zero
391 #:copy-fd-set
392 #:fd-isset
393 #:fd-clr
394 #:fd-set
395 #:poll
396 #+linux #:epoll-create
397 #+linux #:epoll-ctl
398 #+linux #:epoll-wait
399 #+bsd #:kqueue
400 #+bsd #:kevent
401 #+bsd #:ev-set
403 ;; Directory walking
404 #:opendir
405 #-bsd #:fdopendir
406 #:dirfd
407 #:closedir
408 #:readdir
409 #:rewinddir
410 #:seekdir
411 #:telldir
413 ;; Memory mapping
414 #:mmap
415 #:munmap
417 ;; Process creation and info
418 #:fork
419 #:execv
420 #:execvp
421 #:waitpid
422 #:getpid
423 #:getppid
424 #:gettid
425 #:getuid
426 #:setuid
427 #:geteuid
428 #:seteuid
429 #:getgid
430 #:setgid
431 #:getegid
432 #:setegid
433 #:setreuid
434 #:setregid
435 #:getpgid
436 #:setpgid
437 #:getpgrp
438 #:setpgrp
439 #:setsid
440 #:getrlimit
441 #:setrlimit
442 #:getrusage
443 #:getpriority
444 #:setpriority
445 #:nice
447 ;; Signals
448 #:kill
449 #:sigaction
450 #:wifexited
451 #:wexitstatus
452 #:wtermsig
453 #:wcoredump
454 #:wifstopped
455 #:wstopsig
456 #:wifcontinued
458 ;; Time
459 #:usleep
460 #:time
461 #:gettimeofday
462 #:get-monotonic-time
464 ;; Environment
465 #:getenv
466 #:setenv
467 #:unsetenv
468 #:clearenv
470 ;; Local info
471 #:gethostname
472 #:getdomainname
473 #:uname
475 ;; User info
476 #:getpwnam
477 #:getpwuid
479 ;; Group info
480 #:getgrnam
481 #:getgrgid
483 ;; CMSG readers
484 #:cmsg.space
485 #:cmsg.len
486 #:cmsg.firsthdr
487 #:cmsg.data
490 ;;;--------------------------------------------------------------------------
491 ;;; Error conditions, wrappers and definers
492 ;;;--------------------------------------------------------------------------
494 #:iolib-condition #:iolib-error
495 #:syscall-error #:code-of #:identifier-of #:message-of #:handle-of #:handle2-of
496 #:make-syscall-error #:get-syscall-error-condition
497 #:signal-syscall-error #:signal-syscall-error/restart
498 #:poll-error #:event-type-of #:poll-timeout
500 ;; Syscall return wrapper
501 #:syscall-wrapper
502 #:error-predicate-of
503 #:error-location-of
504 #:return-filter-of
505 #:error-generator-of
506 #:syscall-restart-p
507 #:base-type-of
508 #:never-fails
509 #:signal-syscall-error
510 #:signal-syscall-error-kw
511 #:signal-syscall-error/restart
513 ;; Syscall definers
514 #:defentrypoint
515 #:defcfun*
516 #:defsyscall
518 ;; CFFI Type Designators
519 #:pointer-or-nil
520 #:pointer-or-nil-designator
521 #:bool
522 #:bool-designator
524 ;; SSTRING <-> CSTRING
525 #:+cstring-path-max+
526 #:cstring-to-sstring
527 #:sstring-to-cstring
528 #:with-cstring-to-sstring
529 #:with-sstring-to-cstring
531 ;; Misc
532 #:repeat-upon-condition
533 #:repeat-upon-eintr
534 #:repeat-decreasing-timeout
535 #:repeat-upon-condition-decreasing-timeout
538 ;;;--------------------------------------------------------------------------
539 ;;; Struct definitions, slots and accessors
540 ;;;--------------------------------------------------------------------------
542 ;; timespec
543 #:timespec #:size-of-timespec
544 #:sec
545 #:nsec
547 ;; timeval
548 #:timeval #:size-of-timeval
549 #:sec
550 #:usec
552 ;; sigaction
553 #:sigaction #:size-of-sigaction
554 #:handler
556 ;; stat
557 #:stat #:size-of-stat
558 #:dev #:stat-dev
559 #:ino #:stat-ino
560 #:mode #:stat-mode
561 #:nlink #:stat-nlink
562 #:uid #:stat-uid
563 #:gid #:stat-gid
564 #:rdev #:stat-rdev
565 #:size #:stat-size
566 #:blksize #:stat-blksize
567 #:blocks #:stat-blocks
568 #:atime #:stat-atime
569 #:mtime #:stat-mtime
570 #:ctime #:stat-ctime
572 ;; fd_set
573 #:fd-set #:size-of-fd-set
575 ;; pollfd
576 #:pollfd #:size-of-pollfd
577 #:fd
578 #:events
579 #:revents
581 ;; epoll_data
582 #+linux #:epoll-data #+linux #:size-of-epoll-data
583 #+linux #:ptr
584 #+linux #:fd
585 #+linux #:u32
586 #+linux #:u64
588 ;; epoll_event
589 #+linux #:epoll-event #+linux #:size-of-epoll-event
590 #+linux #:events
591 #+linux #:data
593 ;; kevent
594 #+bsd #:kevent #+bsd #:size-of-kevent
595 #+bsd #:ident
596 #+bsd #:filter
597 #+bsd #:flags
598 #+bsd #:fflags
599 #+bsd #:data
600 #+bsd #:udata