mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 17:58:18 +03:00
59ed235c85
Files opened with O_DIRECT will now bypass the disk cache in read/write operations (though metadata operations will still hit the disk cache.) This will allow us to test actual disk performance instead of testing disk *cache* performance, if that's what we want. :^) There's room for improvment here, we're very aggressively flushing any dirty cache entries for the specific block before reading/writing that block. This is done by walking the entire cache, which may be slow.
75 lines
1.3 KiB
C
75 lines
1.3 KiB
C
#pragma once
|
|
|
|
#include <sys/cdefs.h>
|
|
#include <sys/types.h>
|
|
|
|
__BEGIN_DECLS
|
|
|
|
#define F_DUPFD 0
|
|
#define F_GETFD 1
|
|
#define F_SETFD 2
|
|
#define F_GETFL 3
|
|
#define F_SETFL 4
|
|
|
|
#define FD_CLOEXEC 1
|
|
|
|
#define O_RDONLY 0
|
|
#define O_WRONLY 1
|
|
#define O_RDWR 2
|
|
#define O_CREAT 0100
|
|
#define O_EXCL 0200
|
|
#define O_NOCTTY 0400
|
|
#define O_TRUNC 01000
|
|
#define O_APPEND 02000
|
|
#define O_NONBLOCK 04000
|
|
#define O_DIRECTORY 00200000
|
|
#define O_NOFOLLOW 00400000
|
|
#define O_CLOEXEC 02000000
|
|
#define O_DIRECT 04000000
|
|
|
|
#define S_IFMT 0170000
|
|
#define S_IFDIR 0040000
|
|
#define S_IFCHR 0020000
|
|
#define S_IFBLK 0060000
|
|
#define S_IFREG 0100000
|
|
#define S_IFIFO 0010000
|
|
#define S_IFLNK 0120000
|
|
#define S_IFSOCK 0140000
|
|
|
|
#define S_ISUID 04000
|
|
#define S_ISGID 02000
|
|
#define S_ISVTX 01000
|
|
#define S_IRUSR 0400
|
|
#define S_IWUSR 0200
|
|
#define S_IXUSR 0100
|
|
#define S_IRGRP 0040
|
|
#define S_IWGRP 0020
|
|
#define S_IXGRP 0010
|
|
#define S_IROTH 0004
|
|
#define S_IWOTH 0002
|
|
#define S_IXOTH 0001
|
|
|
|
#define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
|
|
|
|
#define S_IRWXG (S_IRWXU >> 3)
|
|
#define S_IRWXO (S_IRWXG >> 3)
|
|
|
|
int fcntl(int fd, int cmd, ...);
|
|
int watch_file(const char* path, int path_length);
|
|
|
|
#define F_RDLCK 0
|
|
#define F_WRLCK 1
|
|
#define F_UNLCK 2
|
|
|
|
#define F_SETLKW 7
|
|
|
|
struct flock {
|
|
short l_type;
|
|
short l_whence;
|
|
off_t l_start;
|
|
off_t l_len;
|
|
pid_t l_pid;
|
|
};
|
|
|
|
__END_DECLS
|