1.0.15.2: Add binding to fcntl's struct flock in SB-POSIX.
[sbcl.git] / contrib / sb-posix / constants.lisp
index fc99cb8..271baf6 100644 (file)
@@ -6,6 +6,7 @@
 (#||#
  "sys/types.h"
  "sys/stat.h"
+ #-win32 "utime.h"
  #-win32 "sys/socket.h"
  #-win32 "sys/un.h"
  #-win32 "netinet/in.h"
  "errno.h"
  "dirent.h" "signal.h"
  #-win32 "pwd.h"
+ #-win32 "grp.h"
  "unistd.h"
- #-win32 "termios.h")
+ #-win32 "termios.h"
+ #-win32 "syslog.h")
 
 ;;; then the stuff we're looking for
 ((:integer af-inet "AF_INET" "IP Protocol family" t)
  (:integer SIGPROF "SIGPROF"
            #+sb-doc "profiling timer alarm (see setitimer(2))." t)
  (:integer SIGWINCH "SIGWINCH" #+sb-doc "Window size change." t)
- (:integer SIGINFO "SIGINFO" #+sb-doc "status request from keyboard." t)
+ (:integer SIGPWR "SIGPWR" #+sb-doc "Power failure." t)
  (:integer SIGUSR1 "SIGUSR1" #+sb-doc "User defined signal 1." t)
  (:integer SIGUSR2 "SIGUSR2" #+sb-doc "User defined signal 2." t)
  (:integer SIGRTMIN "SIGRTMIN" #+sb-doc "Smallest real-time signal number." t)
  (:integer SIGRTMAX "SIGRTMAX" #+sb-doc "Largest real-time signal number." t)
 
  ;; error numbers
- (:integer eperm "EPERM" nil t)
- (:integer enoent "ENOENT" nil t)
- (:integer esrch "ESRCH" nil t)
- (:integer eintr "EINTR" nil t)
- (:integer eio "EIO" nil t)
- (:integer enxio "ENXIO" nil t)
- (:integer e2big "E2BIG" nil t)
- (:integer enoexec "ENOEXEC" nil t)
- (:integer ebadf "EBADF" nil t)
- (:integer echild "ECHILD" nil t)
- (:integer eagain "EAGAIN" nil t)
- (:integer enomem "ENOMEM" nil t)
- (:integer eacces "EACCES" nil t)
- (:integer efault "EFAULT" nil t)
- (:integer enotblk "ENOTBLK" nil t)
- (:integer ebusy "EBUSY" nil t)
- (:integer eexist "EEXIST" nil t)
- (:integer exdev "EXDEV" nil t)
- (:integer enodev "ENODEV" nil t)
- (:integer enotdir "ENOTDIR" nil t)
- (:integer eisdir "EISDIR" nil t)
- (:integer einval "EINVAL" nil t)
- (:integer enfile "ENFILE" nil t)
- (:integer emfile "EMFILE" nil t)
- (:integer enotty "ENOTTY" nil t)
- (:integer etxtbsy "ETXTBSY" nil t)
- (:integer efbig "EFBIG" nil t)
- (:integer enospc "ENOSPC" nil t)
- (:integer espipe "ESPIPE" nil t)
- (:integer erofs "EROFS" nil t)
- (:integer emlink "EMLINK" nil t)
- (:integer epipe "EPIPE" nil t)
- (:integer edom "EDOM" nil t)
- (:integer erange "ERANGE" nil t)
- (:integer edeadlk "EDEADLK" nil t)
- (:integer enametoolong "ENAMETOOLONG" nil t)
- (:integer enolck "ENOLCK" nil t)
- (:integer enosys "ENOSYS" nil t)
- (:integer enotempty "ENOTEMPTY" nil t)
- (:integer eloop "ELOOP" nil t)
- (:integer ewouldblock "EWOULDBLOCK" nil t)
- (:integer enomsg "ENOMSG" nil t)
- (:integer eidrm "EIDRM" nil t)
- (:integer echrng "ECHRNG" nil t)
- (:integer el2nsync "EL2NSYNC" nil t)
- (:integer el3hlt "EL3HLT" nil t)
- (:integer el3rst "EL3RST" nil t)
- (:integer elnrng "ELNRNG" nil t)
- (:integer eunatch "EUNATCH" nil t)
- (:integer enocsi "ENOCSI" nil t)
- (:integer el2hlt "EL2HLT" nil t)
- (:integer ebade "EBADE" nil t)
- (:integer ebadr "EBADR" nil t)
- (:integer exfull "EXFULL" nil t)
- (:integer enoano "ENOANO" nil t)
- (:integer ebadrqc "EBADRQC" nil t)
- (:integer ebadslt "EBADSLT" nil t)
- (:integer edeadlock "EDEADLOCK" nil t)
- (:integer ebfont "EBFONT" nil t)
- (:integer enostr "ENOSTR" nil t)
- (:integer enodata "ENODATA" nil t)
- (:integer etime "ETIME" nil t)
- (:integer enosr "ENOSR" nil t)
- (:integer enonet "ENONET" nil t)
- (:integer enopkg "ENOPKG" nil t)
- (:integer eremote "EREMOTE" nil t)
- (:integer enolink "ENOLINK" nil t)
- (:integer eadv "EADV" nil t)
- (:integer esrmnt "ESRMNT" nil t)
- (:integer ecomm "ECOMM" nil t)
- (:integer eproto "EPROTO" nil t)
- (:integer emultihop "EMULTIHOP" nil t)
- (:integer edotdot "EDOTDOT" nil t)
- (:integer ebadmsg "EBADMSG" nil t)
- (:integer eoverflow "EOVERFLOW" nil t)
- (:integer enotuniq "ENOTUNIQ" nil t)
- (:integer ebadfd "EBADFD" nil t)
- (:integer eremchg "EREMCHG" nil t)
- (:integer elibacc "ELIBACC" nil t)
- (:integer elibbad "ELIBBAD" nil t)
- (:integer elibscn "ELIBSCN" nil t)
- (:integer elibmax "ELIBMAX" nil t)
- (:integer elibexec "ELIBEXEC" nil t)
- (:integer eilseq "EILSEQ" nil t)
- (:integer erestart "ERESTART" nil t)
- (:integer estrpipe "ESTRPIPE" nil t)
- (:integer eusers "EUSERS" nil t)
- (:integer enotsock "ENOTSOCK" nil t)
- (:integer edestaddrreq "EDESTADDRREQ" nil t)
- (:integer emsgsize "EMSGSIZE" nil t)
- (:integer eprototype "EPROTOTYPE" nil t)
- (:integer enoprotoopt "ENOPROTOOPT" nil t)
- (:integer eprotonosupport "EPROTONOSUPPORT" nil t)
- (:integer esocktnosupport "ESOCKTNOSUPPORT" nil t)
- (:integer eopnotsupp "EOPNOTSUPP" nil t)
- (:integer epfnosupport "EPFNOSUPPORT" nil t)
- (:integer eafnosupport "EAFNOSUPPORT" nil t)
- (:integer eaddrinuse "EADDRINUSE" nil t)
- (:integer eaddrnotavail "EADDRNOTAVAIL" nil t)
- (:integer enetdown "ENETDOWN" nil t)
- (:integer enetunreach "ENETUNREACH" nil t)
- (:integer enetreset "ENETRESET" nil t)
- (:integer econnaborted "ECONNABORTED" nil t)
- (:integer econnreset "ECONNRESET" nil t)
- (:integer enobufs "ENOBUFS" nil t)
- (:integer eisconn "EISCONN" nil t)
- (:integer enotconn "ENOTCONN" nil t)
- (:integer eshutdown "ESHUTDOWN" nil t)
- (:integer etoomanyrefs "ETOOMANYREFS" nil t)
- (:integer etimedout "ETIMEDOUT" nil t)
- (:integer econnrefused "ECONNREFUSED" nil t)
- (:integer ehostdown "EHOSTDOWN" nil t)
- (:integer ehostunreach "EHOSTUNREACH" nil t)
- (:integer ealready "EALREADY" nil t)
- (:integer einprogress "EINPROGRESS" nil t)
- (:integer estale "ESTALE" nil t)
- (:integer euclean "EUCLEAN" nil t)
- (:integer enotnam "ENOTNAM" nil t)
- (:integer enavail "ENAVAIL" nil t)
- (:integer eremoteio "EREMOTEIO" nil t)
- (:integer edquot "EDQUOT" nil t)
- (:integer enomedium "ENOMEDIUM" nil t)
- (:integer emediumtype "EMEDIUMTYPE" nil t)
+ (:errno eperm "EPERM" nil t)
+ (:errno enoent "ENOENT" nil t)
+ (:errno esrch "ESRCH" nil t)
+ (:errno eintr "EINTR" nil t)
+ (:errno eio "EIO" nil t)
+ (:errno enxio "ENXIO" nil t)
+ (:errno e2big "E2BIG" nil t)
+ (:errno enoexec "ENOEXEC" nil t)
+ (:errno ebadf "EBADF" nil t)
+ (:errno echild "ECHILD" nil t)
+ (:errno eagain "EAGAIN" nil t)
+ (:errno enomem "ENOMEM" nil t)
+ (:errno eacces "EACCES" nil t)
+ (:errno efault "EFAULT" nil t)
+ (:errno enotblk "ENOTBLK" nil t)
+ (:errno ebusy "EBUSY" nil t)
+ (:errno eexist "EEXIST" nil t)
+ (:errno exdev "EXDEV" nil t)
+ (:errno enodev "ENODEV" nil t)
+ (:errno enotdir "ENOTDIR" nil t)
+ (:errno eisdir "EISDIR" nil t)
+ (:errno einval "EINVAL" nil t)
+ (:errno enfile "ENFILE" nil t)
+ (:errno emfile "EMFILE" nil t)
+ (:errno enotty "ENOTTY" nil t)
+ (:errno etxtbsy "ETXTBSY" nil t)
+ (:errno efbig "EFBIG" nil t)
+ (:errno enospc "ENOSPC" nil t)
+ (:errno espipe "ESPIPE" nil t)
+ (:errno erofs "EROFS" nil t)
+ (:errno emlink "EMLINK" nil t)
+ (:errno epipe "EPIPE" nil t)
+ (:errno edom "EDOM" nil t)
+ (:errno erange "ERANGE" nil t)
+ (:errno edeadlk "EDEADLK" nil t)
+ (:errno enametoolong "ENAMETOOLONG" nil t)
+ (:errno enolck "ENOLCK" nil t)
+ (:errno enosys "ENOSYS" nil t)
+ (:errno enotempty "ENOTEMPTY" nil t)
+ (:errno eloop "ELOOP" nil t)
+ (:errno ewouldblock "EWOULDBLOCK" nil t)
+ (:errno enomsg "ENOMSG" nil t)
+ (:errno eidrm "EIDRM" nil t)
+ (:errno echrng "ECHRNG" nil t)
+ (:errno el2nsync "EL2NSYNC" nil t)
+ (:errno el3hlt "EL3HLT" nil t)
+ (:errno el3rst "EL3RST" nil t)
+ (:errno elnrng "ELNRNG" nil t)
+ (:errno eunatch "EUNATCH" nil t)
+ (:errno enocsi "ENOCSI" nil t)
+ (:errno el2hlt "EL2HLT" nil t)
+ (:errno ebade "EBADE" nil t)
+ (:errno ebadr "EBADR" nil t)
+ (:errno exfull "EXFULL" nil t)
+ (:errno enoano "ENOANO" nil t)
+ (:errno ebadrqc "EBADRQC" nil t)
+ (:errno ebadslt "EBADSLT" nil t)
+ (:errno edeadlock "EDEADLOCK" nil t)
+ (:errno ebfont "EBFONT" nil t)
+ (:errno enostr "ENOSTR" nil t)
+ (:errno enodata "ENODATA" nil t)
+ (:errno etime "ETIME" nil t)
+ (:errno enosr "ENOSR" nil t)
+ (:errno enonet "ENONET" nil t)
+ (:errno enopkg "ENOPKG" nil t)
+ (:errno eremote "EREMOTE" nil t)
+ (:errno enolink "ENOLINK" nil t)
+ (:errno eadv "EADV" nil t)
+ (:errno esrmnt "ESRMNT" nil t)
+ (:errno ecomm "ECOMM" nil t)
+ (:errno eproto "EPROTO" nil t)
+ (:errno emultihop "EMULTIHOP" nil t)
+ (:errno edotdot "EDOTDOT" nil t)
+ (:errno ebadmsg "EBADMSG" nil t)
+ (:errno eoverflow "EOVERFLOW" nil t)
+ (:errno enotuniq "ENOTUNIQ" nil t)
+ (:errno ebadfd "EBADFD" nil t)
+ (:errno eremchg "EREMCHG" nil t)
+ (:errno elibacc "ELIBACC" nil t)
+ (:errno elibbad "ELIBBAD" nil t)
+ (:errno elibscn "ELIBSCN" nil t)
+ (:errno elibmax "ELIBMAX" nil t)
+ (:errno elibexec "ELIBEXEC" nil t)
+ (:errno eilseq "EILSEQ" nil t)
+ (:errno erestart "ERESTART" nil t)
+ (:errno estrpipe "ESTRPIPE" nil t)
+ (:errno eusers "EUSERS" nil t)
+ (:errno enotsock "ENOTSOCK" nil t)
+ (:errno edestaddrreq "EDESTADDRREQ" nil t)
+ (:errno emsgsize "EMSGSIZE" nil t)
+ (:errno eprototype "EPROTOTYPE" nil t)
+ (:errno enoprotoopt "ENOPROTOOPT" nil t)
+ (:errno eprotonosupport "EPROTONOSUPPORT" nil t)
+ (:errno esocktnosupport "ESOCKTNOSUPPORT" nil t)
+ (:errno eopnotsupp "EOPNOTSUPP" nil t)
+ (:errno epfnosupport "EPFNOSUPPORT" nil t)
+ (:errno eafnosupport "EAFNOSUPPORT" nil t)
+ (:errno eaddrinuse "EADDRINUSE" nil t)
+ (:errno eaddrnotavail "EADDRNOTAVAIL" nil t)
+ (:errno enetdown "ENETDOWN" nil t)
+ (:errno enetunreach "ENETUNREACH" nil t)
+ (:errno enetreset "ENETRESET" nil t)
+ (:errno econnaborted "ECONNABORTED" nil t)
+ (:errno econnreset "ECONNRESET" nil t)
+ (:errno enobufs "ENOBUFS" nil t)
+ (:errno eisconn "EISCONN" nil t)
+ (:errno enotconn "ENOTCONN" nil t)
+ (:errno eshutdown "ESHUTDOWN" nil t)
+ (:errno etoomanyrefs "ETOOMANYREFS" nil t)
+ (:errno etimedout "ETIMEDOUT" nil t)
+ (:errno econnrefused "ECONNREFUSED" nil t)
+ (:errno ehostdown "EHOSTDOWN" nil t)
+ (:errno ehostunreach "EHOSTUNREACH" nil t)
+ (:errno ealready "EALREADY" nil t)
+ (:errno einprogress "EINPROGRESS" nil t)
+ (:errno estale "ESTALE" nil t)
+ (:errno euclean "EUCLEAN" nil t)
+ (:errno enotnam "ENOTNAM" nil t)
+ (:errno enavail "ENAVAIL" nil t)
+ (:errno eremoteio "EREMOTEIO" nil t)
+ (:errno edquot "EDQUOT" nil t)
+ (:errno enomedium "ENOMEDIUM" nil t)
+ (:errno emediumtype "EMEDIUMTYPE" nil t)
 
  ;; wait
  (:integer wnohang "WNOHANG")
 
  ;; mode_t
  (:type mode-t "mode_t")
+ (:integer s-ifmt "S_IFMT" nil t)
+ (:integer s-ififo "S_IFIFO" nil t)
+ (:integer s-ifchr "S_IFCHR" nil t)
+ (:integer s-ifdir "S_IFDIR" nil t)
+ (:integer s-ifblk "S_IFBLK" nil t)
+ (:integer s-ifreg "S_IFREG" nil t)
+ (:integer s-iflnk "S_IFLNK" nil t)
+ (:integer s-ifsock "S_IFSOCK" nil t)
+ (:integer s-ifwht "S_IFWHT" nil t)
  (:integer s-isuid "S_ISUID" nil t)
  (:integer s-isgid "S_ISGID" nil t)
  (:integer s-isvtx "S_ISVTX" nil t)
 
  ;; opendir()
  (:structure dirent
-             ("struct dirent"
+             (#+(and linux largefile) "struct dirent64"
+              #-(and linux largefile) "struct dirent"
               (:c-string name "char *" "d_name"
                          :distrust-length #+sunos t #-sunos nil)) t)
 
               #+nil
               (:integer fields "int" "pw_fields")))
 
+ ;; group database
+ #-win32
+ (:structure alien-group
+             ("struct group"
+              (c-string-pointer name "char *" "gr_name")
+              (c-string-pointer passwd "char *" "gr_passwd")
+              (gid-t gid "gid_t" "gr_gid")))
+
  (:structure alien-stat
              ("struct stat"
               (mode-t mode "mode_t" "st_mode")
               (time-t mtime "time_t" "st_mtime")
               (time-t ctime "time_t" "st_ctime")))
 
+ #+darwin
+ (:structure alien-timespec
+             ("struct timespec"
+              (time-t tv-sec "time_t" "tv_sec")
+              (long tv-nsec "long" "tv_nsec")))
+
  ;; open()
  (:integer o-rdonly "O_RDONLY" nil t)
  (:integer o-wronly "O_WRONLY" nil t)
  (:integer f-setlkw "F_SETLKW" nil t)
  (:integer f-getown "F_GETOWN" nil t)
  (:integer f-setown "F_SETOWN" nil t)
+ (:integer f-rdlck "F_RDLCK" nil t)
+ (:integer f-wrlck "F_WRLCK" nil t)
+ (:integer f-unlck "F_UNLCK" nil t)
+
+ (:structure alien-flock
+             ("struct flock"
+              (short type "short" "l_type")
+              (short whence "short" "l_whence")
+              (off-t start "off_t" "l_start")
+              (off-t len "off_t" "l_len")
+              (pid-t pid "pid_t" "l_pid")))
+
+ ;; lockf()
+ (:integer f-lock "F_LOCK" nil t)
+ (:integer f-tlock "F_TLOCK" nil t)
+ (:integer f-ulock "F_ULOCK" nil t)
+ (:integer f-test "F_TEST" nil t)
 
  ;; tcgetattr(), tcsetattr()
  #-win32
               (tcflag-t lflag "tcflag_t" "c_lflag")
               ((array cc-t) cc "cc_t" "c_cc")))
 
+ ;; utime(), utimes()
+ #-win32
+ (:type suseconds-t ; OAOOM warning: similar kludge in tools-for-build
+        #+os-provides-suseconds-t "suseconds_t"
+        #-os-provides-suseconds-t "long")
+
+ #-win32
+ (:structure alien-utimbuf
+             ("struct utimbuf"
+              (time-t actime "time_t" "actime")
+              (time-t modtime "time_t" "modtime")))
+ #-win32
+ (:structure alien-timeval
+             ("struct timeval"
+              (time-t sec "time_t" "tv_sec")
+              (suseconds-t usec "suseconds_t" "tv_usec")))
+
  (:integer veof "VEOF" nil t)
  (:integer veol "VEOL" nil t)
  (:integer verase "VERASE" nil t)
  (:integer b9600 "B9600" nil t)
  (:integer b19200 "B19200" nil t)
  (:integer b38400 "B38400" nil t)
+ (:integer b57600 "B57600" nil t)
+ (:integer b115200 "B115200" nil t)
+ (:integer b230400 "B230400" nil t)
 
  (:integer csize "CSIZE" nil t)
  (:integer cs5 "CS5" nil t)
  (:integer tcooff "TCOOFF" nil t)
  (:integer tcoon "TCOON" nil t)
 
- )
+ ;; syslog -- does this exist at all on Windows?
+
+ ;; SUSv3-standard openlog() facilities
+ #-win32
+ (:integer log-user "LOG_USER" "Default openlog() faclity." t)
+ #-win32
+ (:integer log-local0 "LOG_LOCAL0" "Locally-defined openlog() facility" t)
+ #-win32
+ (:integer log-local1 "LOG_LOCAL1" "Locally-defined openlog() facility" t)
+ #-win32
+ (:integer log-local2 "LOG_LOCAL2" "Locally-defined openlog() facility" t)
+ #-win32
+ (:integer log-local3 "LOG_LOCAL3" "Locally-defined openlog() facility" t)
+ #-win32
+ (:integer log-local4 "LOG_LOCAL4" "Locally-defined openlog() facility" t)
+ #-win32
+ (:integer log-local5 "LOG_LOCAL5" "Locally-defined openlog() facility" t)
+ #-win32
+ (:integer log-local6 "LOG_LOCAL6" "Locally-defined openlog() facility" t)
+ #-win32
+ (:integer log-local7 "LOG_LOCAL7" "Locally-defined openlog() facility" t)
+
+ ;; Additional, non-standard openlog() facilities (most of which
+ ;; probably won't be needed by Lisp programs, but here for
+ ;; completeness).
+ #-win32
+ (:integer
+  log-authpriv "LOG_AUTHPRIV" "openlog() facility for authorization messages" t)
+ #-win32
+ (:integer
+  log-cron "LOG_CRON" "openlog() facility for cron and at daemons" t)
+ #-win32
+ (:integer
+  log-daemon "LOG_DAEMON" "openlog() facility for arbitrary daemons" t)
+ #-win32
+ (:integer
+  log-ftp "LOG_FTP" "openlog() facility for FTP daemons" t)
+ #-win32
+ (:integer
+  log-kern "LOG_KERN" "openlog() facility for kernel messages" t)
+ #-win32
+ (:integer
+  log-lpr "LOG_LPR" "openlog() facility for the printer subsystem" t)
+ #-win32
+ (:integer
+  log-mail "LOG_MAIL" "openlog() facility for the mail subsystem" t)
+ #-win32
+ (:integer
+  log-news "LOG_NEWS" "openlog() facility for the usenet subsystem" t)
+ #-win32
+ (:integer
+  log-syslog "LOG_SYSLOG" "openlog() facility for the syslog subsystem" t)
+ #-win32
+ (:integer
+  log-uucp "LOG_UUCP" "openlog() facility for the UUCP subsystem" t)
+
+ ;; openlog() options
+ #-win32
+ (:integer
+  log-pid "LOG_PID"
+  "If supplied to openlog(), log the process ID with each message"
+  t)
+ #-win32
+ (:integer
+  log-cons "LOG_CONS"
+  "If supplied to openlog(), log to the system console as well as logfiles"
+  t)
+ #-win32
+ (:integer
+  log-ndelay "LOG_NDELAY"
+  "If supplied to openlog(), immediately open the syslog connection."
+  t)
+ #-win32
+ (:integer
+  log-odelay "LOG_ODELAY"
+  "If supplied to openlog(), delay opening the syslog connection to the first syslog() call."
+  t)
+ #-win32
+ (:integer
+  log-nowait "LOG_NOWAIT"
+  "If supplied to openlog(), do not wait for child processes created by calls to syslog()."
+  t)
+ ;; Not in SUSv3, but at least Glibc and BSD libc have this
+ #-win32
+ (:integer
+  log-perror "LOG_PERROR"
+  "If supplied to openlog(), write log messages to the process's standard error descriptor in addition to the logging facility."
+  t)
+
+ ;; syslog() severity levels
+ #-win32
+ (:integer
+  log-emerg "LOG_EMERG" "Log severity level denoting a panic." t)
+ #-win32
+ (:integer
+  log-alert "LOG_ALERT" "Log severity level denoting a condition that should be corrected immediately." t)
+ #-win32
+ (:integer
+  log-crit "LOG_CRIT" "Log severity level denoting critical conditions." t)
+ #-win32
+ (:integer
+  log-err "LOG_ERR" "Log severity level denoting an error." t)
+ #-win32
+ (:integer
+  log-warning "LOG_WARNING" "Log severity level denoting a warning." t)
+ #-win32
+ (:integer
+  log-notice "LOG_NOTICE" "Log severity level denoting non-errors that may require special handling." t)
+ #-win32
+ (:integer
+  log-info "LOG_INFO" "Log severity level denoting informational messages." t)
+ #-win32
+ (:integer
+  log-debug "LOG_DEBUG" "Log severity level denoting debugging information ." t)
+
+)