Update libc.h
[ps4-sdk.git] / libPS4 / include / file.h
blob1ef0f8c680c4f2b2e50186b8ad6567c5b634b36c
1 #pragma once
3 #include "types.h"
5 enum {
6 SEEK_SET,
7 SEEK_CUR,
8 SEEK_END
9 };
11 #define O_RDONLY 0x0000
12 #define O_WRONLY 0x0001
13 #define O_RDWR 0x0002
14 #define O_ACCMODE 0x0003
16 #define O_NONBLOCK 0x0004 /* no delay */
17 #define O_APPEND 0x0008 /* set append mode */
18 #define O_CREAT 0x0200 /* create if nonexistent */
19 #define O_TRUNC 0x0400 /* truncate to zero length */
20 #define O_EXCL 0x0800 /* error if already exists */
22 struct stat {
23 __dev_t st_dev; /* inode's device */
24 ino_t st_ino; /* inode's number */
25 mode_t st_mode; /* inode protection mode */
26 nlink_t st_nlink; /* number of hard links */
27 uid_t st_uid; /* user ID of the file's owner */
28 gid_t st_gid; /* group ID of the file's group */
29 __dev_t st_rdev; /* device type */
30 struct timespec st_atim; /* time of last access */
31 struct timespec st_mtim; /* time of last data modification */
32 struct timespec st_ctim; /* time of last file status change */
33 off_t st_size; /* file size, in bytes */
34 blkcnt_t st_blocks; /* blocks allocated for file */
35 blksize_t st_blksize; /* optimal blocksize for I/O */
36 fflags_t st_flags; /* user defined flags for file */
37 uint32_t st_gen; /* file generation number */
38 int32_t st_lspare;
39 struct timespec st_birthtim; /* time of file creation */
40 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
41 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
44 struct dirent {
45 uint32_t d_fileno;
46 uint16_t d_reclen;
47 uint8_t d_type;
48 uint8_t d_namlen;
49 char d_name[255 + 1];
52 ssize_t read(int fd, void *buf, size_t nbyte);
53 ssize_t write(int fd, const void *buf, size_t count);
54 int open(const char *path, int flags, int mode);
55 int close(int fd);
56 int unlink(const char *pathname);
57 int fchown(int fd, int uid, int gid);
58 int fchmod(int fd, int mode);
59 int rename(const char *oldpath, const char *newpath);
60 int mkdir(const char *pathname, mode_t mode);
61 int rmdir(const char *path);
62 int stat(const char *path, struct stat *sb);
63 int fstat(int fd, struct stat *sb);
64 int getdents(int fd, char *buf, size_t count);
66 int getSandboxDirectory(char *destination, int *length);