/[cmucl]/src/code/unix-glibc2.lisp
ViewVC logotype

Diff of /src/code/unix-glibc2.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.18 by toy, Tue Nov 19 13:17:14 2002 UTC revision 1.19 by emarsden, Mon Feb 24 16:19:48 2003 UTC
# Line 313  Line 313 
313  (def-alien-type u-int16-t unsigned-short)  (def-alien-type u-int16-t unsigned-short)
314  (def-alien-type int32-t int)  (def-alien-type int32-t int)
315  (def-alien-type u-int32-t unsigned-int)  (def-alien-type u-int32-t unsigned-int)
316  (def-alien-type int64-t #+alpha long #-alpha (array long 2))  (def-alien-type int64-t (signed 64))
317  (def-alien-type u-int64-t #+alpha unsigned-long #-alpha (array unsigned-long 2))  (def-alien-type u-int64-t (unsigned 64))
318  (def-alien-type register-t #-alpha int #+alpha long)  (def-alien-type register-t #-alpha int #+alpha long)
319    
320    
321  (def-alien-type dev-t u-int64-t)  (def-alien-type dev-t #+alpha u-int64-t #-alpha (array unsigned-long 2))
322  (def-alien-type uid-t unsigned-int)  (def-alien-type uid-t unsigned-int)
323  (def-alien-type gid-t unsigned-int)  (def-alien-type gid-t unsigned-int)
324  (def-alien-type ino-t u-int32-t)  (def-alien-type ino-t u-int32-t)
325  (def-alien-type mode-t unsigned-int)  (def-alien-type mode-t unsigned-int)
326  (def-alien-type nlink-t unsigned-int)  (def-alien-type nlink-t unsigned-int)
327  (def-alien-type off-t long)  (def-alien-type off-t long)
328  (def-alien-type loff-t quad-t)  (def-alien-type loff-t u-int64-t)
329  (def-alien-type pid-t int)  (def-alien-type pid-t int)
330  ;(def-alien-type ssize-t #-alpha int #+alpha long)  ;(def-alien-type ssize-t #-alpha int #+alpha long)
331    
# Line 447  Line 447 
447    (int-syscall ("fcntl" int unsigned-int unsigned-int) fd cmd arg))    (int-syscall ("fcntl" int unsigned-int unsigned-int) fd cmd arg))
448    
449  (defun unix-open (path flags mode)  (defun unix-open (path flags mode)
450    "Unix-open opens the file whose pathname is specified by path    "Unix-open opens the file whose pathname is specified by PATH
451     for reading and/or writing as specified by the flags argument.     for reading and/or writing as specified by the FLAGS argument.
452       Returns an integer file descriptor.
453     The flags argument can be:     The flags argument can be:
454    
455       o_rdonly        Read-only flag.       o_rdonly        Read-only flag.
# Line 457  Line 458 
458       o_append        Append flag.       o_append        Append flag.
459       o_creat         Create-if-nonexistant flag.       o_creat         Create-if-nonexistant flag.
460       o_trunc         Truncate-to-size-0 flag.       o_trunc         Truncate-to-size-0 flag.
461       o_excl          Error if the file allready exists       o_excl          Error if the file already exists
462       o_noctty        Don't assign controlling tty       o_noctty        Don't assign controlling tty
463       o_ndelay        Non-blocking I/O       o_ndelay        Non-blocking I/O
464       o_sync          Synchronous I/O       o_sync          Synchronous I/O
465       o_async         Asynchronous I/O       o_async         Asynchronous I/O
466    
467     If the o_creat flag is specified, then the file is created with     If the o_creat flag is specified, then the file is created with
468     a permission of argument mode if the file doesn't exist.  An     a permission of argument MODE if the file doesn't exist."
    integer file descriptor is returned by unix-open."  
469    (declare (type unix-pathname path)    (declare (type unix-pathname path)
470             (type fixnum flags)             (type fixnum flags)
471             (type unix-file-mode mode))             (type unix-file-mode mode))
472    (int-syscall ("open" c-string int int) path flags mode))    (int-syscall ("open64" c-string int int) path flags mode))
473    
474  (defun unix-getdtablesize ()  (defun unix-getdtablesize ()
475    "Unix-getdtablesize returns the maximum size of the file descriptor    "Unix-getdtablesize returns the maximum size of the file descriptor
# Line 500  Line 500 
500    
501    (declare (type unix-pathname name)    (declare (type unix-pathname name)
502             (type unix-file-mode mode))             (type unix-file-mode mode))
503    (int-syscall ("creat" c-string int) name mode))    (int-syscall ("creat64" c-string int) name mode))
504    
505  ;;; fcntlbits.h  ;;; fcntlbits.h
506    
# Line 1759  length LEN and type TYPE." Line 1759  length LEN and type TYPE."
1759     l_xtnd       Extend the file size.     l_xtnd       Extend the file size.
1760    "    "
1761    (declare (type unix-fd fd)    (declare (type unix-fd fd)
1762             (type (unsigned-byte 32) offset)             (type (signed-byte 64) offset)
1763             (type (integer 0 2) whence))             (type (integer 0 2) whence))
1764    (int-syscall ("lseek" int off-t int) fd offset whence))    (let ((result (alien-funcall
1765                     (extern-alien "lseek64" (function loff-t int loff-t int))
1766                     fd offset whence)))
1767        (if (minusp result)
1768            (values nil (get-errno))
1769            (values result 0))))
1770    
1771    
1772  ;;; Unix-read accepts a file descriptor, a buffer, and the length to read.  ;;; Unix-read accepts a file descriptor, a buffer, and the length to read.
# Line 2251  length LEN and type TYPE." Line 2256  length LEN and type TYPE."
2256  ;;; Unix-truncate accepts a file name and a new length.  The file is  ;;; Unix-truncate accepts a file name and a new length.  The file is
2257  ;;; truncated to the new length.  ;;; truncated to the new length.
2258    
2259  (defun unix-truncate (name len)  (defun unix-truncate (name length)
2260    "Unix-truncate truncates the named file to the length (in    "Unix-truncate truncates the named file to the length (in
2261     bytes) specified by len.  NIL and an error number is returned     bytes) specified by LENGTH.  NIL and an error number is returned
2262     if the call is unsuccessful."     if the call is unsuccessful."
2263    (declare (type unix-pathname name)    (declare (type unix-pathname name)
2264             (type (unsigned-byte 32) len))             (type (unsigned-byte 64) length))
2265    (void-syscall ("truncate" c-string off-t) name len))    (void-syscall ("truncate64" c-string loff-t) name length))
2266    
2267  (defun unix-ftruncate (fd len)  (defun unix-ftruncate (fd length)
2268    "Unix-ftruncate is similar to unix-truncate except that the first    "Unix-ftruncate is similar to unix-truncate except that the first
2269     argument is a file descriptor rather than a file name."     argument is a file descriptor rather than a file name."
2270    (declare (type unix-fd fd)    (declare (type unix-fd fd)
2271             (type (unsigned-byte 32) len))             (type (unsigned-byte 64) length))
2272    (void-syscall ("ftruncate" int off-t) fd len))    (void-syscall ("ftruncate64" int loff-t) fd length))
2273    
2274  #+nil  #+nil
2275  (defun unix-getdtablesize ()  (defun unix-getdtablesize ()

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

  ViewVC Help
Powered by ViewVC 1.1.5