
The function fstatat can do the same thing as the stat and lstat functions. However, it can be passed the file descriptor of a directory which will be used when as the starting point for relative paths. This is contrary to stat and lstat which use the current working directory as the starting for relative paths.
66 lines
1.4 KiB
C
66 lines
1.4 KiB
C
/*
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
* Copyright (c) 2021, sin-ack <sin-ack@protonmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#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 F_ISTTY 5
|
|
|
|
#define FD_CLOEXEC 1
|
|
|
|
#define O_RDONLY (1 << 0)
|
|
#define O_WRONLY (1 << 1)
|
|
#define O_RDWR (O_RDONLY | O_WRONLY)
|
|
#define O_ACCMODE (O_RDONLY | O_WRONLY)
|
|
#define O_EXEC (1 << 2)
|
|
#define O_CREAT (1 << 3)
|
|
#define O_EXCL (1 << 4)
|
|
#define O_NOCTTY (1 << 5)
|
|
#define O_TRUNC (1 << 6)
|
|
#define O_APPEND (1 << 7)
|
|
#define O_NONBLOCK (1 << 8)
|
|
#define O_DIRECTORY (1 << 9)
|
|
#define O_NOFOLLOW (1 << 10)
|
|
#define O_CLOEXEC (1 << 11)
|
|
#define O_DIRECT (1 << 12)
|
|
|
|
int creat(const char* path, mode_t);
|
|
int open(const char* path, int options, ...);
|
|
#define AT_FDCWD -100
|
|
#define AT_SYMLINK_NOFOLLOW 0x100
|
|
int openat(int dirfd, const char* path, int options, ...);
|
|
|
|
int fcntl(int fd, int cmd, ...);
|
|
int create_inode_watcher(unsigned flags);
|
|
int inode_watcher_add_watch(int fd, const char* path, size_t path_length, unsigned event_mask);
|
|
int inode_watcher_remove_watch(int fd, int wd);
|
|
|
|
#define F_RDLCK 0
|
|
#define F_WRLCK 1
|
|
#define F_UNLCK 2
|
|
#define F_GETLK 5
|
|
#define F_SETLK 6
|
|
#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
|