1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 05:45:07 +00:00
serenity/VirtualFileSystem/UnixTypes.h
Andreas Kling fdbd9f1e27 Start working on memory-mapped files.
First of all, change sys$mmap to take a struct SC_mmap_params since our
sycsall calling convention can't handle more than 3 arguments.

This exposed a bug in Syscall::invoke() needing to use clobber lists.
It was a bit confusing to debug. :^)
2018-11-08 11:40:58 +01:00

89 lines
1.9 KiB
C++

#pragma once
extern "C" {
namespace Unix {
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#define MAP_SHARED 0x01
#define MAP_PRIVATE 0x02
#define MAP_FIXED 0x10
#define MAP_ANONYMOUS 0x20
#define MAP_ANON MAP_ANONYMOUS
#define PROT_READ 0x1
#define PROT_WRITE 0x2
#define PROT_EXEC 0x4
#define PROT_NONE 0x0
typedef dword dev_t;
typedef dword ino_t;
typedef dword mode_t;
typedef dword nlink_t;
typedef dword uid_t;
typedef dword gid_t;
#ifdef SERENITY
typedef void (*__sighandler_t)(int);
typedef __sighandler_t sighandler_t;
typedef dword sigset_t;
typedef void siginfo_t;
struct sigaction {
union {
void (*sa_handler)(int);
void (*sa_sigaction)(int, siginfo_t*, void*);
};
sigset_t sa_mask;
int sa_flags;
void (*sa_restorer)(void);
};
#define SA_NOCLDSTOP 1
#define SA_NOCLDWAIT 2
#define SA_SIGINFO 4
#define SIG_BLOCK 0
#define SIG_UNBLOCK 1
#define SIG_SETMASK 2
#endif
#ifdef SERENITY
// FIXME: Support 64-bit offsets!
typedef signed_dword off_t;
typedef unsigned int time_t;
#else
typedef signed_qword off_t;
typedef ::time_t time_t;
#endif
typedef dword blksize_t;
typedef dword blkcnt_t;
typedef dword size_t;
typedef signed_dword ssize_t;
struct stat {
dev_t st_dev; /* ID of device containing file */
ino_t st_ino; /* inode number */
mode_t st_mode; /* protection */
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 */
blksize_t st_blksize; /* blocksize for file system I/O */
blkcnt_t st_blocks; /* number of 512B blocks allocated */
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 */
};
}
}