1.0.3.16: experimental x86-64/darwin suport
[sbcl.git] / contrib / sb-posix / constants.lisp
index a566050..bae76f4 100644 (file)
@@ -5,29 +5,42 @@
 ;;; first, the headers necessary to find definitions of everything
 (#||#
  "sys/types.h"
- "unistd.h"
  "sys/stat.h"
- "sys/socket.h" "sys/un.h" "netinet/in.h" "netinet/in_systm.h"
- "netinet/ip.h" "net/if.h" "netdb.h" "errno.h" "netinet/tcp.h"
- "fcntl.h" "sys/mman.h"
+ #-win32 "utime.h"
+ #-win32 "sys/socket.h"
+ #-win32 "sys/un.h"
+ #-win32 "netinet/in.h"
+ #-win32 "netinet/in_systm.h"
+ #-win32 "netinet/ip.h"
+ #-win32 "net/if.h"
+ #-win32 "netinet/tcp.h"
+ #-win32 "sys/mman.h"
+ #-win32 "sys/wait.h"
+ "fcntl.h"
+ #-win32 "netdb.h"
+ "errno.h"
  "dirent.h" "signal.h"
-
- "termios.h")
+ #-win32 "pwd.h"
+ "unistd.h"
+ #-win32 "termios.h"
+ #-win32 "syslog.h")
 
 ;;; then the stuff we're looking for
 ((:integer af-inet "AF_INET" "IP Protocol family" t)
 
- (:type uid-t "uid_t")
- (:type gid-t "gid_t")
+ ;; KLUDGE: These types simply do not seem to exist on Windows,
+ ;; but we'll provide these anyways -- at least in a way that should
+ ;; match with stat.
+ (:type uid-t   #-win32 "uid_t"   #+win32 "short")
+ (:type gid-t   #-win32 "gid_t"   #+win32 "short")
+ (:type nlink-t #-win32 "nlink_t" #+win32 "short")
 
  (:type pid-t "pid_t")
  (:type ino-t "ino_t")
 
- (:type nlink-t "nlink_t")
  (:type time-t "time_t")
  (:type dev-t "dev_t")
+
  ;; signals
  (:integer SIGHUP "SIGHUP" #+sb-doc "terminal line hangup." t)
  (:integer SIGINT "SIGINT" #+sb-doc "interrupt program." t)
  (:integer edquot "EDQUOT" nil t)
  (:integer enomedium "ENOMEDIUM" nil t)
  (:integer emediumtype "EMEDIUMTYPE" nil t)
+
+ ;; wait
+ (:integer wnohang "WNOHANG")
+ (:integer wuntraced "WUNTRACED")
+
  ;; mode_t
  (:type mode-t "mode_t")
  (:integer s-isuid "S_ISUID" nil t)
 
  ;; opendir()
  (:structure dirent
-            ("struct dirent"
-             (:c-string name "char *" "d_name"
-                        :distrust-length #+sunos t #-sunos nil)) t)
+             (#+(and linux largefile) "struct dirent64"
+              #-(and linux largefile) "struct dirent"
+              (:c-string name "char *" "d_name"
+                         :distrust-length #+sunos t #-sunos nil)) t)
+
+ ;; password database
+ #-win32
+ (:structure alien-passwd
+             ("struct passwd"
+              (c-string-pointer name "char *" "pw_name")
+              (c-string-pointer passwd "char *" "pw_passwd")
+              (uid-t uid "uid_t" "pw_uid")
+              (gid-t gid "gid_t" "pw_gid")
+              ;; 'change', 'class', and 'expire' are not supported on Linux
+              #+nil
+              (time-t change "time_t" "pw_change")
+              #+nil
+              (c-string-pointer class "char *" "pw_class")
+              (c-string-pointer gecos "char *" "pw_gecos")
+              (c-string-pointer dir "char *" "pw_dir")
+              (c-string-pointer shell "char *" "pw_shell")
+              #+nil
+              (time-t expire "time_t" "pw_expire")
+              ;; OS X manpages say this exists.  they lie!
+              #+nil
+              (:integer fields "int" "pw_fields")))
+
+ #-darwin
+ (:structure alien-stat
+             ("struct stat"
+              (mode-t mode "mode_t" "st_mode")
+              (ino-t ino "ino_t" "st_ino")
+              ;; Linux/MIPS uses unsigned long instead of dev_t here.
+              #-mips
+              (dev-t dev "dev_t" "st_dev")
+              #+mips
+              ((unsigned 32) dev "dev_t" "st_dev")
+              (nlink-t nlink "nlink_t" "st_nlink")
+              (uid-t uid "uid_t" "st_uid")
+              (gid-t gid "gid_t" "st_gid")
+              (off-t size "off_t" "st_size")
+              (time-t atime "time_t" "st_atime")
+              (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")))
+ #+darwin
  (:structure alien-stat
-            ("struct stat"
-             (mode-t mode "mode_t" "st_mode")
-             (ino-t ino "ino_t" "st_ino")
-             (dev-t dev "dev_t" "st_dev")
-             (nlink-t nlink "nlink_t" "st_nlink")
-             (uid-t uid "uid_t" "st_uid")
-             (gid-t gid "gid_t" "st_gid")
-             (off-t size "off_t" "st_size")
-             (time-t atime "time_t" "st_atime")
-             (time-t mtime "time_t" "st_mtime")
-             (time-t ctime "time_t" "st_ctime")))
+             ("struct stat"
+              (mode-t mode "mode_t" "st_mode")
+              (ino-t ino "ino_t" "st_ino")
+              ;; Linux/MIPS uses unsigned long instead of dev_t here.
+              #-mips
+              (dev-t dev "dev_t" "st_dev")
+              #+mips
+              ((unsigned 32) dev "dev_t" "st_dev")
+              (nlink-t nlink "nlink_t" "st_nlink")
+              (uid-t uid "uid_t" "st_uid")
+              (gid-t gid "gid_t" "st_gid")
+              (off-t size "off_t" "st_size")
+              (alien-timespec atime "struct timespec" "st_atime")
+              (alien-timespec mtime "struct timespec" "st_mtime")
+              (alien-timespec ctime "struct timespec" "st_ctime")))
 
  ;; open()
  (:integer o-rdonly "O_RDONLY" nil t)
  (:integer o-directory "O_DIRECTORY" nil t)
  (:integer o-direct "O_DIRECT" nil t)
  (:integer o-async "O_ASYNC" nil t)
- (:integer o-largefile "O_LARGEFILE" nil t)    ; hmm...
+ (:integer o-largefile "O_LARGEFILE" nil t)     ; hmm...
  (:integer o-dsync "O_DSYNC" nil t)
  (:integer o-rsync "O_RSYNC" nil t)
 
  (:integer f-setown "F_SETOWN" nil t)
 
  ;; tcgetattr(), tcsetattr()
+ #-win32
  (:type cc-t "cc_t")
+ #-win32
  (:type speed-t "speed_t" nil t)
+ #-win32
  (:type tcflag-t "tcflag_t" nil t)
  (:integer nccs "NCCS" nil t)
+ #-win32
  (:structure alien-termios
-            ("struct termios"
-             (tcflag-t iflag "tcflag_t" "c_iflag")
-             (tcflag-t oflag "tcflag_t" "c_oflag")
-             (tcflag-t cflag "tcflag_t" "c_cflag")
-             (tcflag-t lflag "tcflag_t" "c_lflag")
-             ((array cc-t) cc "cc_t" "c_cc")))
+             ("struct termios"
+              (tcflag-t iflag "tcflag_t" "c_iflag")
+              (tcflag-t oflag "tcflag_t" "c_oflag")
+              (tcflag-t cflag "tcflag_t" "c_cflag")
+              (tcflag-t lflag "tcflag_t" "c_lflag")
+              ((array cc-t) cc "cc_t" "c_cc")))
+
+ ;; utime(), utimes()
+ #-win32
+ (:type suseconds-t "suseconds_t")
+
+ #-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 inlcr "INLCR" nil t)
  (:integer inpck "INPCK" nil t)
  (:integer istrip "ISTRIP" nil t)
- #+xsi                              ; FIXME: an extension, apparently
+ #+xsi                               ; FIXME: an extension, apparently
  (:integer ixany "IXANY" nil t)
  (:integer ixoff "IXOFF" nil t)
  (:integer ixon "IXON" 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 tcion "TCION" 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)
+
+)