OpenCores
URL https://opencores.org/ocsvn/hf-risc/hf-risc/trunk

Subversion Repositories hf-risc

[/] [hf-risc/] [trunk/] [tools/] [riscv-gnu-toolchain-master/] [newlib/] [newlib/] [libc/] [machine/] [riscv/] [sys/] [fcntl.h] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 serginhofr
 
2
/* YUNSUP: snatched _default_fcntl.h and matched numbers with linux host
3
 * machine */
4
 
5
#ifndef _RISCV_SYS_FCNTL_H_
6
#ifdef __cplusplus
7
extern "C" {
8
#endif
9
#define _RISCV_SYS_FCNTL_H_
10
#include <_ansi.h>
11
#define _FOPEN          (-1)    /* from sys/file.h, kernel use only */
12
#define _FREAD          0x0001  /* read enabled */
13
#define _FWRITE         0x0002  /* write enabled */
14
 
15
#define _FCREAT           0100  /* open with file create */
16
#define _FEXCL            0200  /* error on open if file exists */
17
#define _FNOCTTY          0400  /* don't assign a ctty on this open */
18
#define _FTRUNC          01000  /* open with truncation */
19
#define _FAPPEND         02000  /* append (writes guaranteed at the end) */
20
#define _FNONBLOCK 04000        /* non blocking I/O (POSIX style) */
21
#define _FSYNC          010000  /* do all writes synchronously */
22
 
23
#define _FMARK           0x2000 /* internal; mark during gc() */
24
#define _FDEFER          0x4000 /* internal; defer for next gc pass */
25
#define _FASYNC          0x8000 /* signal pgrp when data ready */
26
#define _FSHLOCK        0x10000 /* BSD flock() shared lock present */
27
#define _FEXLOCK        0x20000 /* BSD flock() exclusive lock present */
28
#define _FNBIO          0x40000 /* non blocking I/O (sys5 style) */
29
#define _FNDELAY        _FNONBLOCK      /* non blocking I/O (4.2 style) */
30
 
31
#define O_ACCMODE       (O_RDONLY|O_WRONLY|O_RDWR)
32
 
33
/*
34
 * Flag values for open(2) and fcntl(2)
35
 * The kernel adds 1 to the open modes to turn it into some
36
 * combination of FREAD and FWRITE.
37
 */
38
#define O_RDONLY        00              /* +1 == FREAD */
39
#define O_WRONLY        01              /* +1 == FWRITE */
40
#define O_RDWR          02              /* +1 == FREAD|FWRITE */
41
#define O_CREAT         _FCREAT
42
#define O_EXCL          _FEXCL
43
#define O_NOCTTY        _FNOCTTY
44
#define O_TRUNC         _FTRUNC
45
#define O_APPEND        _FAPPEND
46
#define O_NONBLOCK      _FNONBLOCK
47
#define O_SYNC          _FSYNC
48
/*      O_NDELAY        _FNDELAY        set in include/fcntl.h */
49
/*      O_NDELAY        _FNBIO          set in include/fcntl.h */
50
/* For machines which care - */
51
#if defined (_WIN32) || defined (__CYGWIN__)
52
#define _FBINARY        0x10000
53
#define _FTEXT          0x20000
54
#define _FNOINHERIT     0x40000
55
 
56
#define O_BINARY        _FBINARY
57
#define O_TEXT          _FTEXT
58
#define O_NOINHERIT     _FNOINHERIT
59
 
60
/* The windows header files define versions with a leading underscore.  */
61
#define _O_RDONLY       O_RDONLY
62
#define _O_WRONLY       O_WRONLY
63
#define _O_RDWR         O_RDWR
64
#define _O_APPEND       O_APPEND
65
#define _O_CREAT        O_CREAT
66
#define _O_TRUNC        O_TRUNC
67
#define _O_EXCL         O_EXCL
68
#define _O_TEXT         O_TEXT
69
#define _O_BINARY       O_BINARY
70
#define _O_RAW          O_BINARY
71
#define _O_NOINHERIT    O_NOINHERIT
72
#endif
73
 
74
#ifndef _POSIX_SOURCE
75
 
76
/*
77
 * Flags that work for fcntl(fd, F_SETFL, FXXXX)
78
 */
79
#define FAPPEND         _FAPPEND
80
#define FSYNC           _FSYNC
81
#define FASYNC          _FASYNC
82
#define FNBIO           _FNBIO
83
#define FNONBIO         _FNONBLOCK      /* XXX fix to be NONBLOCK everywhere */
84
#define FNDELAY         _FNDELAY
85
 
86
/*
87
 * Flags that are disallowed for fcntl's (FCNTLCANT);
88
 * used for opens, internal state, or locking.
89
 */
90
#define FREAD           _FREAD
91
#define FWRITE          _FWRITE
92
#define FMARK           _FMARK
93
#define FDEFER          _FDEFER
94
#define FSHLOCK         _FSHLOCK
95
#define FEXLOCK         _FEXLOCK
96
 
97
/*
98
 * The rest of the flags, used only for opens
99
 */
100
#define FOPEN           _FOPEN
101
#define FCREAT          _FCREAT
102
#define FTRUNC          _FTRUNC
103
#define FEXCL           _FEXCL
104
#define FNOCTTY         _FNOCTTY
105
 
106
#endif  /* !_POSIX_SOURCE */
107
 
108
/* XXX close on exec request; must match UF_EXCLOSE in user.h */
109
#define FD_CLOEXEC      1       /* posix */
110
 
111
/* fcntl(2) requests */
112
#define F_DUPFD         0        /* Duplicate fildes */
113
#define F_GETFD         1       /* Get fildes flags (close on exec) */
114
#define F_SETFD         2       /* Set fildes flags (close on exec) */
115
#define F_GETFL         3       /* Get file flags */
116
#define F_SETFL         4       /* Set file flags */
117
#ifndef _POSIX_SOURCE
118
#define F_GETOWN        5       /* Get owner - for ASYNC */
119
#define F_SETOWN        6       /* Set owner - for ASYNC */
120
#endif  /* !_POSIX_SOURCE */
121
#define F_GETLK         7       /* Get record-locking information */
122
#define F_SETLK         8       /* Set or Clear a record-lock (Non-Blocking) */
123
#define F_SETLKW        9       /* Set or Clear a record-lock (Blocking) */
124
#ifndef _POSIX_SOURCE
125
#define F_RGETLK        10      /* Test a remote lock to see if it is blocked */
126
#define F_RSETLK        11      /* Set or unlock a remote lock */
127
#define F_CNVT          12      /* Convert a fhandle to an open fd */
128
#define F_RSETLKW       13      /* Set or Clear remote record-lock(Blocking) */
129
#endif  /* !_POSIX_SOURCE */
130
 
131
/* fcntl(2) flags (l_type field of flock structure) */
132
#define F_RDLCK         1       /* read lock */
133
#define F_WRLCK         2       /* write lock */
134
#define F_UNLCK         3       /* remove lock(s) */
135
#ifndef _POSIX_SOURCE
136
#define F_UNLKSYS       4       /* remove remote locks for a given system */
137
#endif  /* !_POSIX_SOURCE */
138
 
139
#ifdef __CYGWIN__
140
/* Special descriptor value to denote the cwd in calls to openat(2) etc. */
141
#define AT_FDCWD -2
142
 
143
/* Flag values for faccessat2) et al. */
144
#define AT_EACCESS              1
145
#define AT_SYMLINK_NOFOLLOW     2
146
#define AT_SYMLINK_FOLLOW       4
147
#define AT_REMOVEDIR            8
148
#endif
149
 
150
/*#include <sys/stdtypes.h>*/
151
 
152
#ifndef __CYGWIN__
153
/* file segment locking set data type - information passed to system by user */
154
struct flock {
155
        short   l_type;         /* F_RDLCK, F_WRLCK, or F_UNLCK */
156
        short   l_whence;       /* flag to choose starting offset */
157
        long    l_start;        /* relative offset, in bytes */
158
        long    l_len;          /* length, in bytes; 0 means lock to EOF */
159
        short   l_pid;          /* returned with F_GETLK */
160
        short   l_xxx;          /* reserved for future use */
161
};
162
#endif /* __CYGWIN__ */
163
 
164
#ifndef _POSIX_SOURCE
165
/* extended file segment locking set data type */
166
struct eflock {
167
        short   l_type;         /* F_RDLCK, F_WRLCK, or F_UNLCK */
168
        short   l_whence;       /* flag to choose starting offset */
169
        long    l_start;        /* relative offset, in bytes */
170
        long    l_len;          /* length, in bytes; 0 means lock to EOF */
171
        short   l_pid;          /* returned with F_GETLK */
172
        short   l_xxx;          /* reserved for future use */
173
        long    l_rpid;         /* Remote process id wanting this lock */
174
        long    l_rsys;         /* Remote system id wanting this lock */
175
};
176
#endif  /* !_POSIX_SOURCE */
177
 
178
 
179
#include <sys/types.h>
180
#include <sys/stat.h>           /* sigh. for the mode bits for open/creat */
181
 
182
extern int open _PARAMS ((const char *, int, ...));
183
extern int creat _PARAMS ((const char *, mode_t));
184
extern int fcntl _PARAMS ((int, int, ...));
185
#ifdef __CYGWIN__
186
#include <sys/time.h>
187
extern int futimesat _PARAMS ((int, const char *, const struct timeval *));
188
extern int openat _PARAMS ((int, const char *, int, ...));
189
extern int unlinkat _PARAMS ((int, const char *, int));
190
#endif
191
 
192
/* Provide _<systemcall> prototypes for functions provided by some versions
193
   of newlib.  */
194
#ifdef _COMPILING_NEWLIB
195
extern int _open _PARAMS ((const char *, int, ...));
196
extern int _fcntl _PARAMS ((int, int, ...));
197
#ifdef __LARGE64_FILES
198
extern int _open64 _PARAMS ((const char *, int, ...));
199
#endif
200
#endif
201
 
202
#ifdef __cplusplus
203
}
204
#endif
205
#endif  /* !_RISCV_SYS_FCNTL_H_ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.