[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] hurd_types.defs: redefine io_statbuf_t, timespec_t and fsys_stat
From: |
Flavio Cruz |
Subject: |
[PATCH] hurd_types.defs: redefine io_statbuf_t, timespec_t and fsys_statfsbuf_t as true structs |
Date: |
Sat, 12 Nov 2022 02:19:45 -0500 |
time_t and long are defined as uint32_t or uint64_t depending on the
arch.
---
hurd/hurd_types.defs | 91 +++++++++++++++++++++++++++++++++++++++++---
1 file changed, 86 insertions(+), 5 deletions(-)
diff --git a/hurd/hurd_types.defs b/hurd/hurd_types.defs
index 95399289..84e1c0ff 100644
--- a/hurd/hurd_types.defs
+++ b/hurd/hurd_types.defs
@@ -401,7 +401,6 @@ serverprefix SERVERPREFIX;
type data_t = array[] of char;
type string_t = c_string[1024]; /* XXX */
-type io_statbuf_t = struct[32] of int;
type uid_t = uint32_t;
type gid_t = uint32_t;
type mode_t = uint32_t;
@@ -419,12 +418,9 @@ type off_array_t = array[] of loff_t;
type pidarray_t = array[] of pid_t;
type procinfo_t = array[] of int;
-type fsys_statfsbuf_t=struct[22] of int;
type idarray_t = array[] of uid_t;
-type rusage_t = struct[18] of int; /* XXX */
-
type flock_t = struct {
int l_type;
int l_whence;
@@ -433,7 +429,92 @@ type flock_t = struct {
pid_t l_pid;
};
-type timespec_t = struct[2] of int;
+#if defined(__x86_64__)
+type time_t = uint64_t;
+type long = uint64_t;
+#else
+type time_t = uint32_t;
+type long = uint32_t;
+#endif /* defined(__x86_64__) */
+
+type timespec_t = struct {
+ time_t tv_sec;
+ long tv_nsec;
+};
+type timeval = timespec_t;
+
+type fsid_t = uint32_t;
+type dev_t = uint32_t;
+type nlink_t = uint32_t;
+type blksize_t = uint32_t;
+type blkcnt64_t = uint64_t;
+
+// Dummy structure just to add padding to io_statbuf_t.
+type io_statbuf_spare_int = struct[9] of int;
+// Needs to be kept in sync with bits/stat.h.
+type io_statbuf_t = struct {
+ int st_fstype;
+ fsid_t st_fsid;
+ ino64_t st_ino;
+ int st_gen;
+ dev_t st_rdev;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ loff_t st_size;
+ timespec_t st_atim;
+ timespec_t st_mtim;
+ timespec_t st_ctim;
+ blksize_t st_blksize;
+ blkcnt64_t st_blocks;
+ uid_t st_author;
+ int st_flags;
+ io_statbuf_spare_int st_spare;
+};
+
+type fsblkcnt64_t = uint64_t;
+type fsfilcnt64_t = uint64_t;
+type fsid_t = uint64_t;
+
+// Needs to be kept in sync with bits/statfs.h.
+type fsys_statfsbuf_t = struct {
+ int f_type;
+ long f_bsize;
+ fsblkcnt64_t f_blocks;
+ fsblkcnt64_t f_bfree;
+ fsblkcnt64_t f_bavail;
+ fsblkcnt64_t f_files;
+ fsblkcnt64_t f_ffree;
+ fsid_t f_fsid;
+ long f_namelen;
+ fsfilcnt64_t f_favail;
+ long f_frsize;
+ long f_flag;
+ int f_spare1;
+ int f_spare2;
+ int f_spare3;
+};
+
+// Needs to be kept in sync with struct_rusage.h.
+type rusage_t = struct {
+ timeval ru_utime;
+ timeval ru_stime;
+ long ru_maxrss;
+ long ru_ixrss;
+ long ru_idrss;
+ long ru_isrss;
+ long ru_minflt;
+ long ru_majflt;
+ long ru_nswap;
+ long ru_inblock;
+ long ru_oublock;
+ long ru_msgsnd;
+ long ru_msgrcv;
+ long ru_nsignals;
+ long ru_nvcsw;
+ long ru_nivcsw;
+};
#define _SYS_UTSNAME_H /* Inhibit warning from <bits/utsname.h>. */
#include <bits/utsname.h>
--
2.37.2
- [PATCH] hurd_types.defs: redefine io_statbuf_t, timespec_t and fsys_statfsbuf_t as true structs,
Flavio Cruz <=