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