summaryrefslogtreecommitdiff
path: root/src/lib/escape/escape_unistd.h
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2012-12-02 22:35:45 +0000
committerVincent Torri <vincent.torri@gmail.com>2012-12-02 22:35:45 +0000
commit7d6010b12c47a20e492da808e3192c3f87dab619 (patch)
tree26c6fd189e046a76560c0bc740b85f4d767ae399 /src/lib/escape/escape_unistd.h
parent53fc441d5475155965d92da89502fe4634a561b2 (diff)
merge: add escape ecore, fix several bugs
SVN revision: 79995
Diffstat (limited to 'src/lib/escape/escape_unistd.h')
-rw-r--r--src/lib/escape/escape_unistd.h107
1 files changed, 107 insertions, 0 deletions
diff --git a/src/lib/escape/escape_unistd.h b/src/lib/escape/escape_unistd.h
new file mode 100644
index 0000000000..0e96d3f3cb
--- /dev/null
+++ b/src/lib/escape/escape_unistd.h
@@ -0,0 +1,107 @@
1#ifndef __ESCAPE_UNISTD_H__
2#define __ESCAPE_UNISTD_H__
3
4/**
5 * @file escape_unistd.h
6 * @brief The file that provides functions ported from Unix in unistd.h.
7 * @defgroup Escape_Unistd_Group Unistd.h functions
8 *
9 * This header provides functions ported from Unix in unistd.h.
10 *
11 * @{
12 */
13
14#include <sys/syslimits.h>
15
16/* Path function */
17/**
18 * @brief return the canonicalized absolute pathname
19 *
20 * @param path A path to canonicalize
21 * @param resolved_path A pointer of size PATH_MAX where to store the result
22 *
23 * realpath() expands all symbolic links and resolves references to /./, /../
24 * and extra '/' characters in the null-terminated string named by path to
25 * produce a canonicalized absolute pathname. The resulting pathname is
26 * stored as a null-terminated string, up to a maximum of PATH_MAX bytes,
27 * in the buffer pointed to by resolved_path. The resulting path will have
28 * no symbolic link, /./ or /../ components.
29 *
30 * If resolved_path is specified as NULL, then realpath() uses malloc(3)
31 * to allocate a buffer of up to PATH_MAX bytes to hold the resolved pathname,
32 * and returns a pointer to this buffer.
33 * The caller should deallocate this buffer using free(3).
34 *
35 */
36EAPI char *escape_realpath(const char *path, char *resolved_path);
37#ifdef realpath
38#undef realpath
39#endif
40#define realpath escape_realpath
41
42EAPI ssize_t
43escape_readlink(const char *path,
44 char *buf,
45 size_t bufsize);
46#ifdef readlink
47#undef readlink
48#endif
49#define readlink escape_readlink
50
51EAPI int
52escape_symlink(const char *path1, const char *path2);
53#ifdef symlink
54#undef symlink
55#endif
56#define symlink escape_symlink
57
58/**
59 * @brief check real user's permissions for a file
60 *
61 * @param pathname The path to check
62 * @param mode the permission to check
63 *
64 * access() checks whether the calling process can access the file pathname.
65 * If pathname is a symbolic link, it is dereferenced.
66 * The mode specifies the accessibility check(s) to be performed, and is either
67 * the value F_OK, or a mask consisting of the bitwise OR of one or more
68 * of R_OK, W_OK, and X_OK. F_OK tests for the existence of the file.
69 * R_OK, W_OK, and X_OK test whether the file exists and grants read, write,
70 * and execute permissions, respectively.
71 *
72 */
73EAPI int
74escape_access(const char *pathname, int mode);
75#ifdef access
76#undef access
77#endif
78#define access escape_access
79
80/**
81 * @brief Create a pair of sockets.
82 *
83 * @param fds A pointer that contains two sockets.
84 *
85 * Create a pair of sockets that can be use with select().
86 * Contrary to Unix, that functions does not
87 * create a pair of file descriptors.
88 *
89 * Conformity: Not applicable.
90 */
91EAPI int
92escape_pipe(int *fds);
93
94/**
95 * @def pipe(fds)
96 *
97 * Wrapper around escape_pipe().
98 */
99#define pipe(fds) escape_pipe(fds)
100
101//#define sync()
102
103/**
104 * @}
105 */
106
107#endif /* __ESCAPE_UNISTD_H__ */