Skip to content
Snippets Groups Projects
unix.lisp 94.4 KiB
Newer Older
wlott's avatar
wlott committed
;;; -*- Package: UNIX -*-
;;;
;;; **********************************************************************
;;; This code was written as part of the CMU Common Lisp project at
;;; Carnegie Mellon University, and has been placed in the public domain.
;;;
(ext:file-comment
dtc's avatar
dtc committed
  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unix.lisp,v 1.58 1998/01/29 07:41:52 dtc Exp $")
wlott's avatar
wlott committed
;;;
;;; **********************************************************************
;;;
;;; This file contains the UNIX low-level support.
;;;
(in-package "UNIX")
(use-package "ALIEN")
(use-package "C-CALL")
(use-package "SYSTEM")
(use-package "EXT")

(export '(
	  daddr-t caddr-t ino-t swblk-t size-t time-t dev-t off-t uid-t gid-t
	  timeval tv-sec tv-usec timezone tz-minuteswest tz-dsttime
	  itimerval it-interval it-value tchars t-intrc t-quitc t-startc
wlott's avatar
wlott committed
	  t-stopc t-eofc t-brkc ltchars t-suspc t-dsuspc t-rprntc t-flushc
wlott's avatar
wlott committed
	  t-werasc t-lnextc sgttyb sg-ispeed sg-ospeed sg-erase sg-kill
	  sg-flags winsize ws-row ws-col ws-xpixel ws-ypixel
ram's avatar
ram committed
	  direct d-off d-ino d-reclen #-(or linux svr4) d-namlen d-name
wlott's avatar
wlott committed
	  stat st-dev st-mode st-nlink st-uid st-gid st-rdev st-size
	  st-atime st-mtime st-ctime st-blksize st-blocks
	  s-ifmt s-ifdir s-ifchr s-ifblk s-ifreg s-iflnk s-ifsock
	  s-isuid s-isgid s-isvtx s-iread s-iwrite s-iexec
	  ruseage ru-utime ru-stime ru-maxrss ru-ixrss ru-idrss
	  ru-isrss ru-minflt ru-majflt ru-nswap ru-inblock ru-oublock
	  ru-msgsnd ru-msgrcv ru-nsignals ru-nvcsw ru-nivcsw
ram's avatar
ram committed
	  rlimit rlim-cur rlim-max sc-onstack sc-mask sc-pc
wlott's avatar
wlott committed

	  unix-errno get-unix-error-msg

	  unix-pathname unix-file-mode unix-fd unix-pid unix-uid unix-gid
	  unix-setitimer unix-getitimer
	  unix-access r_ok w_ok x_ok f_ok unix-chdir unix-chmod setuidexec
wlott's avatar
wlott committed
	  setgidexec savetext readown writeown execown readgrp writegrp
	  execgrp readoth writeoth execoth unix-fchmod unix-chown unix-fchown
	  unix-getdtablesize unix-close unix-creat unix-dup unix-dup2
	  unix-fcntl f-dupfd f-getfd f-setfd f-getfl f-setfl f-getown f-setown
	  fndelay fappend fasync fcreat ftrunc fexcl unix-link unix-lseek
	  l_set l_incr l_xtnd unix-mkdir unix-open o_rdonly o_wronly o_rdwr
pw's avatar
pw committed
	  #+(or hpux svr4 freebsd linux) o_ndelay
	  #+(or hpux svr4 freebsd linux) o_noctty #+(or hpux svr4) o_nonblock
	  o_append o_creat o_trunc o_excl unix-pipe unix-read unix-readlink
	  unix-rename unix-rmdir unix-fast-select fd-setsize fd-set fd-clr
	  fd-isset fd-zero unix-select unix-sync unix-fsync unix-truncate
dtc's avatar
dtc committed
	  unix-ftruncate unix-symlink
	  #+(and sparc svr4) unix-times
	  unix-unlink unix-write unix-ioctl
	  tcsetpgrp tcgetpgrp tty-process-group
	  terminal-speeds tty-raw tty-crmod tty-echo tty-lcase
pw's avatar
pw committed
	  #-hpux tty-cbreak #-(or hpux linux) tty-tandem
	  #+(or hpux svr4 linux freebsd) termios
          #+(or hpux svr4 linux freebsd) c-lflag
	  #+(or hpux svr4 linux freebsd) c-iflag
          #+(or hpux svr4 linux freebsd) c-oflag
	  #+(or hpux svr4 linux freebsd) tty-icrnl
          #+(or hpux svr4 linux) tty-ocrnl
	  #+(or hpux svr4 freebsd) vdsusp #+(or hpux svr4 linux freebsd) veof
	  #+(or hpux svr4 linux freebsd) vintr
          #+(or hpux svr4 linux freebsd) vquit
          #+(or hpux svr4 linux freebsd) vstart
	  #+(or hpux svr4 linux freebsd) vstop
          #+(or hpux svr4 linux freebsd) vsusp
	  #+(or hpux svr4 linux freebsd) c-cflag
	  #+(or hpux svr4 linux freebsd) c-cc
          #+(or hpux svr4 linux freebsd) tty-icanon
	  #+(or hpux svr4 linux freebsd) vmin
          #+(or hpux svr4 linux freebsd) vtime
	  #+(or hpux svr4 linux freebsd) tty-ixon
          #+(or hpux svr4 freebsd linux) tcsanow
          #+(or hpux svr4 freebsd linux) tcsadrain
          #+(or hpux svr4 freebsd linux) tciflush
          #+(or hpux svr4 freebsd linux) tcoflush
          #+(or hpux svr4 freebsd linux) tcioflush
	  #+(or hpux svr4 freebsd linux) tcsaflush
          #+(or hpux svr4 linux freebsd) unix-tcgetattr
          #+(or hpux svr4 linux freebsd) unix-tcsetattr
          #+(or hpux svr4 freebsd) unix-cfgetospeed
          #+(or hpux svr4 freebsd) unix-cfsetospeed
          #+(or hpux svr4 freebsd) unix-cfgetispeed
          #+(or hpux svr4 freebsd) unix-cfsetispeed
          #+(or hpux svr4 linux freebsd) tty-ignbrk
          #+(or hpux svr4 linux freebsd) tty-brkint
          #+(or hpux svr4 linux freebsd) tty-ignpar
          #+(or hpux svr4 linux freebsd) tty-parmrk
          #+(or hpux svr4 linux freebsd) tty-inpck
          #+(or hpux svr4 linux freebsd) tty-istrip
          #+(or hpux svr4 linux freebsd) tty-inlcr
          #+(or hpux svr4 linux freebsd) tty-igncr
          #+(or hpux svr4 linux) tty-iuclc
          #+(or hpux svr4 linux freebsd) tty-ixany
          #+(or hpux svr4 linux freebsd) tty-ixoff
          #+hpux tty-ienqak
          #+(or hpux irix solaris linux freebsd) tty-imaxbel
          #+(or hpux svr4 linux freebsd) tty-opost
          #+(or hpux svr4 linux) tty-olcuc
          #+(or hpux svr4 linux freebsd) tty-onlcr
          #+(or hpux svr4 linux) tty-onocr
          #+(or hpux svr4 linux) tty-onlret
          #+(or hpux svr4 linux) tty-ofill
          #+(or hpux svr4 linux) tty-ofdel
          #+(or hpux svr4 linux freebsd) tty-isig
          #+(or hpux svr4 linux) tty-xcase
          #+(or hpux svr4 linux freebsd) tty-echoe
          #+(or hpux svr4 linux freebsd) tty-echok
          #+(or hpux svr4 linux freebsd) tty-echonl
          #+(or hpux svr4 linux freebsd) tty-noflsh
          #+(or hpux svr4 linux freebsd) tty-iexten
          #+(or hpux svr4 linux freebsd) tty-tostop
          #+(or hpux irix solaris linux freebsd) tty-echoctl
          #+(or hpux irix solaris linux freebsd) tty-echoprt
          #+(or hpux irix solaris linux freebsd) tty-echoke
          #+(or hpux irix solaris) tty-defecho
          #+(or hpux irix solaris freebsd) tty-flusho
          #+(or hpux irix solaris linux freebsd) tty-pendin
          #+(or hpux svr4 linux freebsd) tty-cstopb
          #+(or hpux svr4 linux freebsd) tty-cread
          #+(or hpux svr4 linux freebsd) tty-parenb
          #+(or hpux svr4 linux freebsd) tty-parodd
          #+(or hpux svr4 linux freebsd) tty-hupcl
          #+(or hpux svr4 linux freebsd) tty-clocal
          #+(or irix solaris) rcv1en
          #+(or irix solaris) xmt1en
          #+(or hpux irix solaris) tty-loblk
          #+(or hpux svr4 linux freebsd) vintr
          #+(or hpux svr4 linux freebsd) verase
          #+(or hpux svr4 linux freebsd) vkill
          #+(or hpux svr4 linux freebsd) veol
          #+(or hpux irix solaris linux freebsd) veol2
          #+(or hpux irix solaris) tty-cbaud
          #+(or hpux svr4 freebsd) tty-csize #+(or hpux svr4 freebsd) tty-cs5
          #+(or hpux svr4 freebsd) tty-cs6 #+(or hpux svr4 freebsd) tty-cs7
          #+(or hpux svr4 freebsd) tty-cs8
          #+(or hpux svr4 freebsd) unix-tcsendbreak
          #+(or hpux svr4 freebsd) unix-tcdrain
          #+(or hpux svr4 freebsd) unix-tcflush
          #+(or hpux svr4 freebsd) unix-tcflow
          
	  TIOCGETP TIOCSETP TIOCFLUSH TIOCSETC TIOCGETC TIOCSLTC
wlott's avatar
wlott committed
	  TIOCGLTC TIOCNOTTY TIOCSPGRP TIOCGPGRP TIOCGWINSZ TIOCSWINSZ
wlott's avatar
wlott committed
	  KBDCGET KBDCSET KBDCRESET KBDCRST KBDCSSTD KBDSGET KBDGCLICK
ram's avatar
ram committed
	  KBDSCLICK FIONREAD #+(or hpux freebsd) siocspgrp
	  unix-exit unix-stat unix-lstat unix-fstat
	  unix-getrusage unix-fast-getrusage rusage_self rusage_children
	  unix-gettimeofday
	  #-hpux unix-utimes #-(or svr4 hpux) unix-setreuid
	  #-(or svr4 hpux) unix-setregid
wlott's avatar
wlott committed
	  unix-getgid unix-getegid unix-getpgrp unix-setpgrp unix-getuid
	  unix-getpagesize unix-gethostname unix-gethostid unix-fork
	  unix-current-directory unix-isatty unix-ttyname unix-execve
	  unix-socket unix-connect unix-bind unix-listen unix-accept
	  unix-recv unix-send unix-getpeername unix-getsockname))
wlott's avatar
wlott committed

(pushnew :unix *features*)


;;;; Common machine independent structures.

ram's avatar
ram committed
#+bsd
(def-alien-type quad-t (array unsigned-long 2))

wlott's avatar
wlott committed
;;; From sys/types.h

ram's avatar
ram committed
(def-alien-type daddr-t #-(or linux alpha) long #+(or linux alpha) int)
wlott's avatar
wlott committed
(def-alien-type caddr-t (* char))
hallgren's avatar
hallgren committed
(def-alien-type ino-t #-alpha unsigned-long #+alpha unsigned-int)
wlott's avatar
wlott committed
(def-alien-type swblk-t long)
ram's avatar
ram committed
(def-alien-type size-t #-(or linux alpha) long #+linux unsigned-int 
  #+alpha unsigned-long)
(def-alien-type time-t #-(or linux alpha) unsigned-long #+linux long
  #+alpha unsigned-int)

(def-alien-type dev-t #-(or alpha svr4 bsd linux) short #+linux unsigned-short
	 #+alpha int #+(and (not linux) (or bsd svr4)) unsigned-long)
#-FreeBSD
hallgren's avatar
hallgren committed
(def-alien-type off-t #-alpha long #+alpha unsigned-long)
ram's avatar
ram committed
#+FreeBSD
(def-alien-type off-t quad-t)
#-FreeBSD
(def-alien-type uid-t #-(or alpha svr4) unsigned-short #+alpha unsigned-int
  #+svr4 long)
ram's avatar
ram committed
#+FreeBSD
(def-alien-type uid-t unsigned-long)
#-FreeBSD
(def-alien-type gid-t #-(or alpha svr4) unsigned-short #+alpha unsigned-int
  #+svr4 long)
ram's avatar
ram committed
#+FreeBSD
(def-alien-type gid-t unsigned-long)
(def-alien-type mode-t #-(or alpha svr4) unsigned-short
ram's avatar
ram committed
  #+alpha unsigned-int #+svr4 unsigned-long)
Loading
Loading full blame...