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
36extern "C" {
37#endif
38
39/* file functions */
40extern int			fssh_access(const char *path, int accessMode);
41
42extern int			fssh_chdir(const char *path);
43extern int			fssh_fchdir(int fd);
44extern char			*fssh_getcwd(char *buffer, fssh_size_t size);
45
46extern int			fssh_dup(int fd);
47extern int			fssh_dup2(int fd1, int fd2);
48extern int			fssh_close(int fd);
49extern int			fssh_link(const char *name, const char *new_name);
50extern int			fssh_unlink(const char *name);
51extern int			fssh_rmdir(const char *path);
52
53extern fssh_ssize_t	fssh_readlink(const char *path, char *buffer,
54						fssh_size_t bufferSize);
55extern int      	fssh_symlink(const char *from, const char *to);
56
57extern int      	fssh_ftruncate(int fd, fssh_off_t newSize);
58extern int      	fssh_truncate(const char *path, fssh_off_t newSize);
59extern int			fssh_ioctl(int fd, unsigned long op, ...);
60
61extern fssh_ssize_t	fssh_read(int fd, void *buffer, fssh_size_t count);
62extern fssh_ssize_t	fssh_read_pos(int fd, fssh_off_t pos, void *buffer,
63						fssh_size_t count);
64extern fssh_ssize_t	fssh_pread(int fd, void *buffer, fssh_size_t count,
65						fssh_off_t pos);
66extern fssh_ssize_t	fssh_write(int fd, const void *buffer, fssh_size_t count);
67extern fssh_ssize_t	fssh_write_pos(int fd, fssh_off_t pos, const void *buffer,
68						fssh_size_t count);
69extern fssh_ssize_t	fssh_pwrite(int fd, const void *buffer, fssh_size_t count,
70						fssh_off_t pos);
71extern fssh_off_t	fssh_lseek(int fd, fssh_off_t offset, int whence);
72
73extern int			fssh_sync(void);
74extern int			fssh_fsync(int fd);
75
76/* access permissions */
77extern fssh_gid_t	fssh_getegid(void);
78extern fssh_uid_t	fssh_geteuid(void);
79extern fssh_gid_t	fssh_getgid(void);
80extern int			fssh_getgroups(int groupSize, fssh_gid_t groupList[]);
81extern fssh_uid_t	fssh_getuid(void);
82
83#ifdef __cplusplus
84}
85#endif
86
87#endif  /* _FSSH_UNISTD_H */
88