1 /* 2 * Copyright 2004-2007, Haiku Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _FSSH_UNISTD_H 6 #define _FSSH_UNISTD_H 7 8 9 #include "fssh_defs.h" 10 11 12 /* access modes */ 13 #define FSSH_R_OK 4 14 #define FSSH_W_OK 2 15 #define FSSH_X_OK 1 16 #define FSSH_F_OK 0 17 18 /* standard file descriptors */ 19 #define FSSH_STDIN_FILENO 0 20 #define FSSH_STDOUT_FILENO 1 21 #define FSSH_STDERR_FILENO 2 22 23 /* lseek() constants */ 24 #ifndef FSSH_SEEK_SET 25 # define FSSH_SEEK_SET 0 26 #endif 27 #ifndef FSSH_SEEK_CUR 28 # define FSSH_SEEK_CUR 1 29 #endif 30 #ifndef FSSH_SEEK_END 31 # define FSSH_SEEK_END 2 32 #endif 33 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 39 /* file functions */ 40 extern int fssh_access(const char *path, int accessMode); 41 42 extern int fssh_chdir(const char *path); 43 extern int fssh_fchdir(int fd); 44 extern char *fssh_getcwd(char *buffer, fssh_size_t size); 45 46 extern int fssh_dup(int fd); 47 extern int fssh_dup2(int fd1, int fd2); 48 extern int fssh_close(int fd); 49 extern int fssh_link(const char *name, const char *new_name); 50 extern int fssh_unlink(const char *name); 51 extern int fssh_rmdir(const char *path); 52 53 extern fssh_ssize_t fssh_readlink(const char *path, char *buffer, 54 fssh_size_t bufferSize); 55 extern int fssh_symlink(const char *from, const char *to); 56 57 extern int fssh_ftruncate(int fd, fssh_off_t newSize); 58 extern int fssh_truncate(const char *path, fssh_off_t newSize); 59 extern int fssh_ioctl(int fd, unsigned long op, ...); 60 61 extern fssh_ssize_t fssh_read(int fd, void *buffer, fssh_size_t count); 62 extern fssh_ssize_t fssh_read_pos(int fd, fssh_off_t pos, void *buffer, 63 fssh_size_t count); 64 extern fssh_ssize_t fssh_pread(int fd, void *buffer, fssh_size_t count, 65 fssh_off_t pos); 66 extern fssh_ssize_t fssh_write(int fd, const void *buffer, fssh_size_t count); 67 extern fssh_ssize_t fssh_write_pos(int fd, fssh_off_t pos, const void *buffer, 68 fssh_size_t count); 69 extern fssh_ssize_t fssh_pwrite(int fd, const void *buffer, fssh_size_t count, 70 fssh_off_t pos); 71 extern fssh_off_t fssh_lseek(int fd, fssh_off_t offset, int whence); 72 73 extern int fssh_sync(void); 74 extern int fssh_fsync(int fd); 75 76 /* access permissions */ 77 extern fssh_gid_t fssh_getegid(void); 78 extern fssh_uid_t fssh_geteuid(void); 79 extern fssh_gid_t fssh_getgid(void); 80 extern int fssh_getgroups(int groupSize, fssh_gid_t groupList[]); 81 extern fssh_uid_t fssh_getuid(void); 82 83 #ifdef __cplusplus 84 } 85 #endif 86 87 #endif /* _FSSH_UNISTD_H */ 88