summaryrefslogtreecommitdiff
path: root/legacy/evil/src/lib/evil_fcntl.h
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2008-09-15 06:56:14 +0000
committerVincent Torri <vincent.torri@gmail.com>2008-09-15 06:56:14 +0000
commita7f00b51bcf19c8a5b040e6fc47398b689caa63f (patch)
tree75e34ba81140b77e14921744f28e1f98cd2fa43f /legacy/evil/src/lib/evil_fcntl.h
parentbae73a2b6079992df4b24a003229940e318f42af (diff)
* Makefile.am:
add autogen.sh in archive distribution * configure.ac: remove useless defines first support of mingw32msvc compiler * src/lib/Evil.h: move some macro definitions * src/lib/Makefile.am: add evil_(fcntl/langinfo).(c/h) and install pwd.h * src/lib/dlfcn/dlfcn.h: remove useless ifdef * src/lib/evil.c: comment all code for now. It will be deleted later * src/lib/evil_fcntl.c: * src/lib/evil_fcntl.h: * src/lib/evil_langinfo.c: * src/lib/evil_langinfo.h: move fcntl and langinfo related code to their own files * src/lib/evil_mman.c: remove useless inclusion * src/lib/evil_pwd.c: pw var is not needed with cegcc * src/lib/evil_stdlib.c: fix bugs, formatting * src/lib/evil_unistd.c: add missing declarations and fix header files * src/lib/evil_unistd.h: move pid_t typedef to Evil.h * src/lib/evil_util.c: additional include and fix a bug in output * src/lib/pwd.h: use EAPI from Evil.h, define struct passwd when not using cegcc * src/lib/sys/mman.h: use EAPI from Evil.h * win32/common/fnmatch.c: * win32/common/fnmatch.h: * win32/common/fnmatch_list_of_states.c: * win32/vs8/evil.sln: fix and cleanup with vc++ compilation Based on patch by Dmitriy Mazovka SVN revision: 35993
Diffstat (limited to 'legacy/evil/src/lib/evil_fcntl.h')
-rw-r--r--legacy/evil/src/lib/evil_fcntl.h106
1 files changed, 106 insertions, 0 deletions
diff --git a/legacy/evil/src/lib/evil_fcntl.h b/legacy/evil/src/lib/evil_fcntl.h
new file mode 100644
index 0000000..cedeffb
--- /dev/null
+++ b/legacy/evil/src/lib/evil_fcntl.h
@@ -0,0 +1,106 @@
1#ifndef __EVIL_FCNTL_H__
2#define __EVIL_FCNTL_H__
3
4
5#ifndef __CEGCC__
6
7# include <sys/types.h>
8
9/**
10 * @def FD_CLOEXEC
11 * Specifies that the file descriptor should be closed when an exec()
12 * function is invoked.
13 */
14# define FD_CLOEXEC 1
15
16/**
17 * @def F_SETFD
18 * Specifies that fcntl() should set the file descriptor flags
19 * associated with the filedes argument.
20 */
21
22/**
23 * @def F_SETLK
24 * Specifies that fcntl() should set or clear a file segment lock
25 * according to the lock description pointed to by the third argument.
26 */
27
28/**
29 * @def F_SETLKW
30 * Equivalent to F_SETLK except that if a shared or exclusive lock
31 * is blocked by other locks, the thread shall wait until the request
32 * can be satisfied.
33 */
34
35# define F_SETFD 2
36# define F_SETLK 6
37# define F_SETLKW 7
38
39/**
40 * @def F_RDLCK
41 * Read (or shared) lock
42 */
43
44/**
45 * @def F_WRLCK
46 * Write (or exclusive) lock
47 */
48
49/**
50 * @def F_UNLCK
51 * Remove lock
52 */
53
54# ifndef F_RDLCK
55# define F_RDLCK 0
56# define F_WRLCK 1
57# define F_UNLCK 2
58# endif /* ! F_RDLCK */
59
60/**
61 * @struct flock
62 * @brief A structure that control the lock of a file descriptor.
63 */
64struct flock
65{
66 short int l_type; /**< lock type: read, write, ... */
67 short int l_whence; /**< type of l_start */
68 off_t l_start; /**< starting offset */
69 off_t l_len; /**< 0 means end of the file */
70 pid_t l_pid; /**< lock owner */
71};
72
73
74/**
75 * @brief Provide control over file descriptors.
76 *
77 * @param fd The file descriptor.
78 * @param cmd The type of control.
79 * @return 0 on success, -1 otherwise.
80 *
81 * Performs one of various miscellaneous operations on @p fd.
82 * The operation in question is determined by @p cmd:
83 *
84 * - F_SETFD: Set the close-on-exec flag to the value specified
85 * by the argument after command (only the least significant
86 * bit is used).
87 * - F_SETLK and F_SETLKW: used to manage discretionary file locks.
88 * The third argument must be a pointer to a struct flock (that
89 * may be overwritten by this call).
90 *
91 * This function returns 0 on success, -1 otherwise.
92 *
93 * Conformity: None.
94 *
95 * Supported OS: Windows Vista, Windows XP or Windows 2000
96 * Professional.
97 *
98 * @ingroup Evil
99 */
100EAPI int fcntl(int fd, int cmd, ...);
101
102
103#endif /* ! __CEGCC__ */
104
105
106#endif /* __EVIL_FCNTL_H__ */