1
/* ==== fd.h ============================================================
2
* Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
8
* 1. Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* 2. Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions and the following disclaimer in the
12
* documentation and/or other materials provided with the distribution.
13
* 3. All advertising materials mentioning features or use of this software
14
* must display the following acknowledgement:
15
* This product includes software developed by Chris Provenzano.
16
* 4. The name of Chris Provenzano may not be used to endorse or promote
17
* products derived from this software without specific prior written
20
* THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND
21
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
* ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY
24
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34
* Description : Basic fd header.
36
* 1.00 93/08/14 proven
37
* -Started coding this file.
39
* 1.01 93/11/13 proven
40
* -The functions readv() and writev() added
47
FD_NT, /* Not tested */
48
FD_NIU, /* Known to be not in use */
49
FD_HALF_DUPLEX, /* Files, and seeking devices */
50
FD_FULL_DUPLEX, /* pipes, sockets, drivers, ... */
51
FD_TEST_HALF_DUPLEX, /* Redo machdep_sys_fcntl */
52
FD_TEST_FULL_DUPLEX /* Redo machdep_sys_fcntl */
58
#define FD_RDWR (FD_READ | FD_WRITE)
68
pthread_ssize_t (*write) __P_((union fd_data, int, const void *,
69
size_t, struct timespec *));
70
pthread_ssize_t (*read) __P_((union fd_data, int, void *, size_t,
74
int (*writev) __P_((union fd_data, int,
76
int, struct timespec *));
77
int (*readv) __P_((union fd_data, int,
79
int, struct timespec *));
84
struct fd_table_entry {
85
struct pthread_queue r_queue;
86
struct pthread_queue w_queue;
87
struct pthread *r_owner;
88
struct pthread *w_owner;
89
pthread_mutex_t mutex;
90
struct fd_table_entry *next;
93
int r_lockcount; /* Count for FILE read locks */
94
int w_lockcount; /* Count for FILE write locks */
97
/* data that needs to be passed to the type dependent fd */
105
#if defined(PTHREAD_KERNEL)
107
extern struct fd_table_entry **fd_table;
108
extern int dtablesize;
118
#if defined(PTHREAD_KERNEL)