Commit f0d04e5e9189df0f0104a97163b1b84db2e01c95

Thomas de Grivel 2018-06-15T10:46:05

fix stat on linux

diff --git a/grovel-stat.lisp b/grovel-stat.lisp
index 8dbfecc..a917fbe 100644
--- a/grovel-stat.lisp
+++ b/grovel-stat.lisp
@@ -18,7 +18,9 @@
 
 (in-package :cffi-stat)
 
+(include "sys/types.h")
 (include "sys/stat.h")
+(include "sys/unistd.h")
 
 (ctype blkcnt-t "blkcnt_t")
 (ctype blksize-t "blksize_t")
@@ -37,6 +39,23 @@
          (tv-sec "tv_sec" :type time-t)
          (tv-nsec "tv_nsec" :type :long))
 
+#+linux
+(cstruct stat "struct stat"
+         (st-mode "st_mode" :type mode-t)
+         (st-dev "st_dev" :type dev-t)
+         (st-ino "st_ino" :type ino-t)
+         (st-nlink "st_nlink" :type nlink-t)
+         (st-uid "st_uid" :type uid-t)
+         (st-gid "st_gid" :type gid-t)
+         (st-rdev "st_rdev" :type dev-t)
+         (st-atim "st_atim" :type (:struct timespec))
+         (st-mtim "st_mtim" :type (:struct timespec))
+         (st-ctim "st_ctim" :type (:struct timespec))
+         (st-size "st_size" :type off-t)
+         (st-blocks "st_blocks" :type blkcnt-t)
+         (st-blksize "st_blksize" :type blksize-t))
+
+#+openbsd
 (cstruct stat "struct stat"
          (st-mode "st_mode" :type mode-t)
          (st-dev "st_dev" :type dev-t)