Fix termios struct on Linux

The termios::c_cc field turned out to be incorrectly defined on Linux
due to some confusion between the glibc and kernel definitions. We'll
be using the kernel definition, since it has the strongest consensus.

Fields have been have been added to struct stat for BSD compatibility
such as st_birthtim, plus the GLIBC compatibility of isystem/sys/stat
has been improved.
This commit is contained in:
Justine Tunney 2021-09-03 22:19:41 -07:00
parent 0584684a82
commit 5b60e5a37d
52 changed files with 358 additions and 296 deletions

View file

@ -3,25 +3,23 @@
#include "libc/calls/struct/timespec.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
struct stat { /* linux abi */
int64_t st_dev; /* 0: id of device with file */
int64_t st_ino; /* 8: inode number in disk b-tree */
int64_t st_nlink; /* 16: hard link count */
int32_t st_mode; /* 24: octal file mask thing */
int32_t st_uid; /* 28: user id of owner */
int32_t st_gid; /* group id of owning group */
int32_t __pad; /* ignore this */
int64_t st_rdev; /* id of device if a special file */
int64_t st_size; /* bytes in file */
int64_t st_blksize; /* preferred chunking for underlying filesystem */
int64_t st_blocks; /* number of 512-byte pages allocated to file */
struct timespec st_atim; /* access time (consider noatime) */
struct timespec st_mtim; /* modified time */
struct timespec st_ctim; /* complicated time */
int64_t __future[3 + 10]; /* reserved for future use */
#define st_atime st_atim.tv_sec
#define st_mtime st_mtim.tv_sec
#define st_ctime st_ctim.tv_sec
struct stat { /* cosmo abi */
uint64_t st_dev; /* 0: id of device with file */
uint64_t st_ino; /* 8: inode number in disk b-tree */
uint64_t st_nlink; /* 16: hard link count */
uint32_t st_mode; /* 24: octal file mask thing */
uint32_t st_uid; /* 28: user id of owner */
uint32_t st_gid; /* group id of owning group */
uint32_t st_flags; /* flags (bsd-only) */
uint64_t st_rdev; /* id of device if a special file */
int64_t st_size; /* bytes in file */
int64_t st_blksize; /* preferred chunking for underlying filesystem */
int64_t st_blocks; /* number of 512-byte pages allocated to file */
struct timespec st_atim; /* access time */
struct timespec st_mtim; /* modified time */
struct timespec st_ctim; /* complicated time */
struct timespec st_birthtim;
uint64_t st_gen;
};
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */