OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [branches/] [newlib/] [newlib/] [newlib/] [libc/] [include/] [sys/] [fcntl.h] - Blame information for rev 39

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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