Ignore:
Timestamp:
Aug 21, 2008, 10:51:47 AM (11 years ago)
Author:
gb
Message:

Replace syscall with int-errno call. See what breaks ...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-1/linux-files.lisp

    r10441 r10515  
    1616
    1717(in-package "CCL")
    18 
    19 (eval-when (:compile-toplevel :execute)
    20   #+linuxppc-target
    21   (require "PPC-LINUX-SYSCALLS")
    22   #+linuxx8664-target
    23   (require "X8664-LINUX-SYSCALLS")
    24   #+darwinppc-target
    25   (require "DARWINPPC-SYSCALLS")
    26   #+darwinx8632-target
    27   (require "DARWINX8632-SYSCALLS")
    28   #+darwinx8664-target
    29   (require "DARWINX8664-SYSCALLS")
    30   #+(and freebsd-target x8664-target)
    31   (require "X8664-FREEBSD-SYSCALLS")
    32   #+(and solaris-target x8664-target)
    33   (require "X8664-SOLARIS-SYSCALLS")
    34   )
    3518
    3619
     
    210193(defun %chdir (dirname)
    211194  (with-filename-cstrs ((dirname dirname))
    212     (syscall syscalls::chdir dirname)))
     195    (int-errno-call (#_chdir dirname))))
    213196
    214197(defun %mkdir (name mode)
     
    218201      (setq name (subseq name 0 (1- len))))
    219202    (with-filename-cstrs ((name name))
    220       (syscall syscalls::mkdir name mode))))
     203      (int-errno-call (#_mkdir name mode)))))
    221204
    222205(defun %rmdir (name)
     
    226209                 (eql (%get-byte name last) (char-code #\/)))
    227210        (setf (%get-byte name last) 0))
    228     (syscall syscalls::rmdir name))))
     211      (int-errno-call (#_rmdir name)))))
    229212
    230213
     
    251234fails unless the OpenMCL process has super-user privileges or the ID
    252235given is that of the current user."
    253   (syscall syscalls::setuid uid))
     236  (int-errno-call (#_setuid uid)))
    254237
    255238(defun setgid (uid)
     
    257240fails unless the OpenMCL process has super-user privileges or the ID
    258241given is that of a group to which the current user belongs."
    259   (syscall syscalls::setgid uid))
     242  (int-errno-call (#_setgid uid)))
    260243 
    261244
     
    291274     (#_ __xstat #$_STAT_VER_LINUX cname stat)
    292275     #-linux-target
    293      (syscall syscalls::stat cname stat)
     276     (#_stat cname stat)
    294277     stat)))
    295278
     
    299282   (#_ __fxstat #$_STAT_VER_LINUX fd stat)
    300283   #-linux-target
    301    (syscall syscalls::fstat fd stat)
     284   (#_fstat fd stat)
    302285   stat))
    303286
     
    308291     (#_ __lxstat #$_STAT_VER_LINUX cname stat)
    309292     #-linux-target
    310      (syscall syscalls::lstat cname stat)
     293     (#_lstat cname stat)
    311294     stat)))
    312295
     
    386369(defun %uname (idx)
    387370  (%stack-block ((buf (* #$_UTSNAME_LENGTH 6))) 
    388     (%uts-string (syscall syscalls::uname buf) idx buf)))
     371    (%uts-string (#_uname buf) idx buf)))
    389372
    390373#+darwin-target
     
    404387
    405388(defun fd-dup (fd)
    406   (syscall syscalls::dup fd))
     389  (int-errno-call (#_dup fd)))
    407390
    408391(defun fd-fsync (fd)
    409   #-solaris-target
    410   (syscall syscalls::fsync fd)
    411   #+solaris-target
    412   (syscall syscalls::fdsync fd #$FSYNC))
     392  (int-errno-call (#_fsync fd)))
    413393
    414394(defun fd-get-flags (fd)
    415   (let* ((result (#_fcntl fd #$F_GETFL)))
    416     (declare (fixnum result))
    417     (if (< result 0)
    418       (%get-errno)
    419       result)))
     395  (int-errno-call (#_fcntl fd #$F_GETFL)))
    420396
    421397(defun fd-set-flags (fd new)
    422   (let* ((result (#_fcntl fd #$F_SETFL :int new)))
    423     (declare (fixnum result))
    424     (if (< result 0)
    425       (%get-errno)
    426       result)))
     398  (int-errno-call (#_fcntl fd #$F_SETFL :int new)))
    427399
    428400(defun fd-set-flag (fd mask)
     
    514486
    515487(defun %%rusage (usage &optional (who #$RUSAGE_SELF))
    516   #-solaris-target
    517   (syscall syscalls::getrusage who usage)
    518   #+solaris-target
    519   (#_getrusage who usage)
    520   )
     488  (int-errno-call (#_getrusage who usage)))
    521489
    522490
     
    579547(defun getpid ()
    580548  "Return the ID of the OpenMCL OS process."
    581   (syscall syscalls::getpid))
     549  (int-errno-call (#_getpid)))
    582550
    583551(defun getuid ()
    584552  "Return the (real) user ID of the current user."
    585   (syscall syscalls::getuid))
     553  (int-errno-call (#_getuid)))
    586554
    587555(defun get-user-home-dir (userid)
     
    612580(defun %delete-file (name)
    613581  (with-cstrs ((n name))
    614     (syscall syscalls::unlink n)))
     582    (int-errno-call (#_unlink n))))
    615583
    616584(defun os-command (string)
     
    749717    (#_close fd)))
    750718
    751 
    752 
    753 
    754 
    755 
    756 ;;; I believe that the Darwin/FreeBSD syscall infterface is rather ... odd.
    757 ;;; Use libc's interface.
    758719(defun pipe ()
    759720  ;;  (rlet ((filedes (:array :int 2)))
     
    11541115created with :WAIT NIL.) Return T if successful; signal an error otherwise."
    11551116  (require-type proc 'external-process)
    1156   (let* ((pid (external-process-pid proc))
    1157          (error (syscall syscalls::kill pid signal)))
    1158     (or (eql error 0)
    1159         (%errno-disp error))))
     1117  (let* ((pid (external-process-pid proc)))
     1118    (when pid
     1119      (int-errno-call (#_kill pid signal)))))
     1120
    11601121
    11611122;;; EOF on a TTY is transient, but I'm less sure of other cases.
Note: See TracChangeset for help on using the changeset viewer.