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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [newlib/] [libc/] [sys/] [sparc64/] [sys/] [fcntl.h] - Blame information for rev 816

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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