compiled newlib, need to hook up the system calls
This commit is contained in:
50
sysroot/usr/include/sys/stat.h
Normal file
50
sysroot/usr/include/sys/stat.h
Normal file
@@ -0,0 +1,50 @@
|
||||
#ifndef _SYS_STAT_H
|
||||
#define _SYS_STAT_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// Basic POSIX types for i686 execution
|
||||
typedef uint32_t dev_t;
|
||||
typedef uint32_t ino_t;
|
||||
typedef uint32_t mode_t;
|
||||
typedef uint32_t nlink_t;
|
||||
typedef uint32_t uid_t;
|
||||
typedef uint32_t gid_t;
|
||||
typedef int32_t off_t;
|
||||
typedef int32_t time_t;
|
||||
|
||||
// The stat layout expected by standard C files
|
||||
struct stat {
|
||||
dev_t st_dev; /* ID of device containing file */
|
||||
ino_t st_ino; /* Inode number */
|
||||
mode_t st_mode; /* File type and mode flags */
|
||||
nlink_t st_nlink; /* Number of hard links */
|
||||
uid_t st_uid; /* User ID of owner */
|
||||
gid_t st_gid; /* Group ID of owner */
|
||||
dev_t st_rdev; /* Device ID (if special file) */
|
||||
off_t st_size; /* Total size, in bytes */
|
||||
time_t st_atime; /* Time of last access */
|
||||
time_t st_mtime; /* Time of last modification */
|
||||
time_t st_ctime; /* Time of last status change */
|
||||
};
|
||||
|
||||
// Traditional POSIX file permission/type bitmasks
|
||||
#define S_IFMT 0170000 /* Bitmask for the file type bit fields */
|
||||
#define S_IFSOCK 0140000 /* Socket */
|
||||
#define S_IFLNK 0120000 /* Symbolic link */
|
||||
#define S_IFREG 0100000 /* Regular file */
|
||||
#define S_IFBLK 0060000 /* Block device */
|
||||
#define S_IFDIR 0040000 /* Directory */
|
||||
#define S_IFCHR 0020000 /* Character device */
|
||||
#define S_IFIFO 0010000 /* FIFO */
|
||||
|
||||
#define S_IRUSR 00400 /* Owner has read permission */
|
||||
#define S_IWUSR 00200 /* Owner has write permission */
|
||||
#define S_IXUSR 00100 /* Owner has execute permission */
|
||||
#define S_IRWXU 00700 /* Owner has read, write, and execute permission */
|
||||
|
||||
// Helper check macros commonly used in PDCLib
|
||||
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
|
||||
#endif /* _SYS_STAT_H */
|
||||
21
sysroot/usr/include/sys/time.h
Normal file
21
sysroot/usr/include/sys/time.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _SYS_TIME_H
|
||||
#define _SYS_TIME_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
// Represents an exact elapsed time signature
|
||||
struct timeval {
|
||||
time_t tv_sec; /* Seconds since Unix Epoch */
|
||||
int32_t tv_usec; /* Microseconds component */
|
||||
};
|
||||
|
||||
// Represents traditional timezone offsets (largely obsolete but required)
|
||||
struct timezone {
|
||||
int tz_minuteswest; /* Minutes west of Greenwich */
|
||||
int tz_dsttime; /* Type of DST correction */
|
||||
};
|
||||
|
||||
/* Prototype for time fetching system operation */
|
||||
int gettimeofday(struct timeval *restrict tv, void *restrict tz);
|
||||
|
||||
#endif /* _SYS_TIME_H */
|
||||
17
sysroot/usr/include/sys/times.h
Normal file
17
sysroot/usr/include/sys/times.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef _SYS_TIMES_H
|
||||
#define _SYS_TIMES_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/* Structure describing CPU time used by a process and its children */
|
||||
struct tms {
|
||||
clock_t tms_utime; /* User CPU time */
|
||||
clock_t tms_stime; /* System CPU time */
|
||||
clock_t tms_cutime; /* User CPU time of dead children */
|
||||
clock_t tms_cstime; /* System CPU time of dead children */
|
||||
};
|
||||
|
||||
/* Function prototype for timing system call */
|
||||
clock_t times(struct tms *buffer);
|
||||
|
||||
#endif /* _SYS_TIMES_H */
|
||||
29
sysroot/usr/include/sys/types.h
Normal file
29
sysroot/usr/include/sys/types.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef _SYS_TYPES_H
|
||||
#define _SYS_TYPES_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// Standard signed and unsigned size primitives
|
||||
typedef int32_t ssize_t;
|
||||
typedef uint32_t size_t;
|
||||
|
||||
// Process and Thread IDs
|
||||
typedef int32_t pid_t;
|
||||
typedef int32_t id_t;
|
||||
|
||||
// File system block and reference markers
|
||||
typedef int32_t blkcnt_t;
|
||||
typedef int32_t blksize_t;
|
||||
typedef uint32_t dev_t;
|
||||
typedef uint32_t gid_t;
|
||||
typedef uint32_t ino_t;
|
||||
typedef uint32_t mode_t;
|
||||
typedef uint32_t nlink_t;
|
||||
typedef int32_t off_t;
|
||||
typedef uint32_t uid_t;
|
||||
|
||||
// Clock and Timing fields
|
||||
typedef int32_t time_t;
|
||||
typedef int32_t clock_t;
|
||||
|
||||
#endif /* _SYS_TYPES_H */
|
||||
Reference in New Issue
Block a user