[Git][cmucl/cmucl][issue-125-unix-stat-wrong] Remove unused alien types and update docstrings

Raymond Toy (@rtoy) gitlab at common-lisp.net
Thu Aug 4 02:53:35 UTC 2022



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


Commits:
c36ad0c7 by Raymond Toy at 2022-08-03T19:53:21-07:00
Remove unused alien types and update docstrings

The alien types dev-t and nlink-t aren't used anywhere anymore so
remove them.

Update the docstrings for unix-stat and friends to describe what the
multiple return values are.

- - - - -


1 changed file:

- src/code/unix.lisp


Changes:

=====================================
src/code/unix.lisp
=====================================
@@ -69,14 +69,6 @@
     #+(and bsd netbsd) int64-t
     #+alpha unsigned-int)
 
-#+nil
-(def-alien-type dev-t
-    #-(or alpha svr4 bsd linux) short
-    #+linux u-int64-t
-    #+netbsd u-int64-t
-    #+alpha int
-    #+(and (not linux) (not netbsd) (or bsd svr4)) unsigned-long)
-
 #-BSD
 (progn
   (deftype file-offset () '(signed-byte 32))
@@ -128,13 +120,6 @@
     `(multiple-value-bind (,word ,bit) (floor ,offset 32)
        (logbitp ,bit (deref (slot ,fd-set 'fds-bits) ,word)))))
 
-(def-alien-type nlink-t
-    #-(or svr4 netbsd linux) unsigned-short
-    #+netbsd unsigned-long
-    #+svr4 unsigned-long
-    #+(and linux (not amd64)) unsigned-int
-    #+(and linux amd64) u-int64-t)
-
 (defconstant fd-setsize
   #-(or hpux alpha linux FreeBSD) 256
   #+hpux 2048 #+alpha 4096 #+(or linux FreeBSD) 1024)
@@ -1415,10 +1400,24 @@
 			blocks))))))
   (defun unix-stat (name)
     _N"Unix-stat retrieves information about the specified
-   file returning them in the form of multiple values.
-   See the UNIX Programmer's Manual for a description
-   of the values returned.  If the call fails, then NIL
-   and an error number is returned instead."
+   file returning them in the form of multiple values.  If the call
+   fails, then NIL and an error number is returned.  If the call
+   succeeds, then T is returned in addition to the following values
+   from the stat struct st:
+
+     st_dev        Device ID
+     st_ino        File serial number
+     st_mode       Mode of file
+     st_nlink      Number of hard links to the file
+     st_uid        User ID
+     st_gid        Group ID
+     st_rdev       Device ID (if file is character or block special)
+     st_atime      Last data access time, in sec
+     st_mtime      Last data modification time, in sec
+     st_ctime      Last file status change time, in sec
+     st_blksize    Preferred I/O block size
+     st_blocks     Number of blocks allocated. (Block size is implementation dependent.)
+"
     (declare (type unix-pathname name))
     (when (string= name "")
       (setf name "."))
@@ -1426,13 +1425,45 @@
 
   (defun unix-lstat (name)
     "Unix-lstat is similar to unix-stat except the specified
-   file must be a symbolic link."
+   file must be a symbolic link.  If the call fails, then NIL and an
+   error number is returned.  If the call succeeds, then T is returned
+   in addition to the following values from the stat struct st:
+
+     st_dev        Device ID
+     st_ino        File serial number
+     st_mode       Mode of file
+     st_nlink      Number of hard links to the file
+     st_uid        User ID
+     st_gid        Group ID
+     st_rdev       Device ID (if file is character or block special)
+     st_atime      Last data access time, in sec
+     st_mtime      Last data modification time, in sec
+     st_ctime      Last file status change time, in sec
+     st_blksize    Preferred I/O block size
+     st_blocks     Number of blocks allocated. (Block size is implementation dependent.)
+"
     (declare (type unix-pathname name))
     (call-stat "unix_lstat" c-call:c-string (%name->file name)))
 
   (defun unix-fstat (fd)
     _N"Unix-fstat is similar to unix-stat except the file is specified
-   by the file descriptor fd."
+   by the file descriptor fd.  If the call fails, then NIL and an
+   error number is returned.  If the call succeeds, then T is returned
+   in addition to the following values from the stat struct st:
+
+     st_dev        Device ID
+     st_ino        File serial number
+     st_mode       Mode of file
+     st_nlink      Number of hard links to the file
+     st_uid        User ID
+     st_gid        Group ID
+     st_rdev       Device ID (if file is character or block special)
+     st_atime      Last data access time, in sec
+     st_mtime      Last data modification time, in sec
+     st_ctime      Last file status change time, in sec
+     st_blksize    Preferred I/O block size
+     st_blocks     Number of blocks allocated. (Block size is implementation dependent.)
+"
     (declare (type unix-fd fd))
     (call-stat "unix_fstat" int fd)))
 



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/c36ad0c736ca2f037eddb839fc4e540eb798004e

-- 
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/c36ad0c736ca2f037eddb839fc4e540eb798004e
You're receiving this email because of your account on gitlab.common-lisp.net.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20220804/e541ef70/attachment-0001.html>


More information about the cmucl-cvs mailing list