Raymond Toy pushed to branch issue-125-unix-stat-wrong at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • src/code/unix.lisp
    ... ... @@ -69,14 +69,6 @@
    69 69
         #+(and bsd netbsd) int64-t
    
    70 70
         #+alpha unsigned-int)
    
    71 71
     
    
    72
    -#+nil
    
    73
    -(def-alien-type dev-t
    
    74
    -    #-(or alpha svr4 bsd linux) short
    
    75
    -    #+linux u-int64-t
    
    76
    -    #+netbsd u-int64-t
    
    77
    -    #+alpha int
    
    78
    -    #+(and (not linux) (not netbsd) (or bsd svr4)) unsigned-long)
    
    79
    -
    
    80 72
     #-BSD
    
    81 73
     (progn
    
    82 74
       (deftype file-offset () '(signed-byte 32))
    
    ... ... @@ -128,13 +120,6 @@
    128 120
         `(multiple-value-bind (,word ,bit) (floor ,offset 32)
    
    129 121
            (logbitp ,bit (deref (slot ,fd-set 'fds-bits) ,word)))))
    
    130 122
     
    
    131
    -(def-alien-type nlink-t
    
    132
    -    #-(or svr4 netbsd linux) unsigned-short
    
    133
    -    #+netbsd unsigned-long
    
    134
    -    #+svr4 unsigned-long
    
    135
    -    #+(and linux (not amd64)) unsigned-int
    
    136
    -    #+(and linux amd64) u-int64-t)
    
    137
    -
    
    138 123
     (defconstant fd-setsize
    
    139 124
       #-(or hpux alpha linux FreeBSD) 256
    
    140 125
       #+hpux 2048 #+alpha 4096 #+(or linux FreeBSD) 1024)
    
    ... ... @@ -1415,10 +1400,24 @@
    1415 1400
     			blocks))))))
    
    1416 1401
       (defun unix-stat (name)
    
    1417 1402
         _N"Unix-stat retrieves information about the specified
    
    1418
    -   file returning them in the form of multiple values.
    
    1419
    -   See the UNIX Programmer's Manual for a description
    
    1420
    -   of the values returned.  If the call fails, then NIL
    
    1421
    -   and an error number is returned instead."
    
    1403
    +   file returning them in the form of multiple values.  If the call
    
    1404
    +   fails, then NIL and an error number is returned.  If the call
    
    1405
    +   succeeds, then T is returned in addition to the following values
    
    1406
    +   from the stat struct st:
    
    1407
    +
    
    1408
    +     st_dev        Device ID
    
    1409
    +     st_ino        File serial number
    
    1410
    +     st_mode       Mode of file
    
    1411
    +     st_nlink      Number of hard links to the file
    
    1412
    +     st_uid        User ID
    
    1413
    +     st_gid        Group ID
    
    1414
    +     st_rdev       Device ID (if file is character or block special)
    
    1415
    +     st_atime      Last data access time, in sec
    
    1416
    +     st_mtime      Last data modification time, in sec
    
    1417
    +     st_ctime      Last file status change time, in sec
    
    1418
    +     st_blksize    Preferred I/O block size
    
    1419
    +     st_blocks     Number of blocks allocated. (Block size is implementation dependent.)
    
    1420
    +"
    
    1422 1421
         (declare (type unix-pathname name))
    
    1423 1422
         (when (string= name "")
    
    1424 1423
           (setf name "."))
    
    ... ... @@ -1426,13 +1425,45 @@
    1426 1425
     
    
    1427 1426
       (defun unix-lstat (name)
    
    1428 1427
         "Unix-lstat is similar to unix-stat except the specified
    
    1429
    -   file must be a symbolic link."
    
    1428
    +   file must be a symbolic link.  If the call fails, then NIL and an
    
    1429
    +   error number is returned.  If the call succeeds, then T is returned
    
    1430
    +   in addition to the following values from the stat struct st:
    
    1431
    +
    
    1432
    +     st_dev        Device ID
    
    1433
    +     st_ino        File serial number
    
    1434
    +     st_mode       Mode of file
    
    1435
    +     st_nlink      Number of hard links to the file
    
    1436
    +     st_uid        User ID
    
    1437
    +     st_gid        Group ID
    
    1438
    +     st_rdev       Device ID (if file is character or block special)
    
    1439
    +     st_atime      Last data access time, in sec
    
    1440
    +     st_mtime      Last data modification time, in sec
    
    1441
    +     st_ctime      Last file status change time, in sec
    
    1442
    +     st_blksize    Preferred I/O block size
    
    1443
    +     st_blocks     Number of blocks allocated. (Block size is implementation dependent.)
    
    1444
    +"
    
    1430 1445
         (declare (type unix-pathname name))
    
    1431 1446
         (call-stat "unix_lstat" c-call:c-string (%name->file name)))
    
    1432 1447
     
    
    1433 1448
       (defun unix-fstat (fd)
    
    1434 1449
         _N"Unix-fstat is similar to unix-stat except the file is specified
    
    1435
    -   by the file descriptor fd."
    
    1450
    +   by the file descriptor fd.  If the call fails, then NIL and an
    
    1451
    +   error number is returned.  If the call succeeds, then T is returned
    
    1452
    +   in addition to the following values from the stat struct st:
    
    1453
    +
    
    1454
    +     st_dev        Device ID
    
    1455
    +     st_ino        File serial number
    
    1456
    +     st_mode       Mode of file
    
    1457
    +     st_nlink      Number of hard links to the file
    
    1458
    +     st_uid        User ID
    
    1459
    +     st_gid        Group ID
    
    1460
    +     st_rdev       Device ID (if file is character or block special)
    
    1461
    +     st_atime      Last data access time, in sec
    
    1462
    +     st_mtime      Last data modification time, in sec
    
    1463
    +     st_ctime      Last file status change time, in sec
    
    1464
    +     st_blksize    Preferred I/O block size
    
    1465
    +     st_blocks     Number of blocks allocated. (Block size is implementation dependent.)
    
    1466
    +"
    
    1436 1467
         (declare (type unix-fd fd))
    
    1437 1468
         (call-stat "unix_fstat" int fd)))
    
    1438 1469