LibC: Add stat structure

This commit is contained in:
Bananymous 2023-03-24 17:40:58 +02:00
parent 1fade1aa9e
commit 9fd17ef73c
3 changed files with 55 additions and 5 deletions

29
libc/include/sys/stat.h Normal file
View File

@ -0,0 +1,29 @@
#pragma once
#include <sys/types.h>
#include <time.h>
__BEGIN_DECLS
#define st_atime st_atim.tv_sec
#define st_ctime st_ctim.tv_sec
#define st_mtime st_mtim.tv_sec
struct stat
{
dev_t st_dev;
ino_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
off_t st_size;
timespec st_atim;
timespec st_mtim;
timespec st_ctim;
blksize_t st_blksize;
blkcnt_t st_blocks;
};
__END_DECLS

View File

@ -5,10 +5,18 @@
__BEGIN_DECLS
typedef int32_t id_t;
typedef id_t pid_t;
typedef id_t uid_t;
typedef id_t gid_t;
typedef uint16_t mode_t;
using blkcnt_t = int32_t;
using blksize_t = int32_t;
using dev_t = uint64_t;
using ino_t = uint32_t;
using mode_t = uint16_t;
using nlink_t = uint32_t;
using off_t = int64_t;
using time_t = uint64_t;
using id_t = int32_t;
using pid_t = id_t;
using uid_t = id_t;
using gid_t = id_t;
__END_DECLS

13
libc/include/time.h Normal file
View File

@ -0,0 +1,13 @@
#pragma once
#include <sys/types.h>
__BEGIN_DECLS
struct timespec
{
time_t tv_sec;
long tv_nsec;
};
__END_DECLS