This has been installing `gcrt0.o' for awhile, which would be fine except
[unix-history] / lib / libpthread / include / fd.h
CommitLineData
90269d47 1/* ==== fd.h ============================================================
56a62443 2 * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu
30b08b75
AM
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
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:
56a62443
CP
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
18 * permission.
30b08b75 19 *
56a62443 20 * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND
30b08b75
AM
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
56a62443
CP
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
30 * SUCH DAMAGE.
31 *
32 * Description : Basic fd header.
33 *
34 * 1.00 93/08/14 proven
35 * -Started coding this file.
36 *
37 * 1.01 93/11/13 proven
38 * -The functions readv() and writev() added
30b08b75 39 */
56a62443 40
90269d47
AM
41/*
42 * New pthread types.
43 */
44enum fd_type {
45 FD_NT, /* Not tested */
46 FD_NIU, /* Known to be not in use */
47 FD_HALF_DUPLEX, /* Files, and seeking devices */
48 FD_FULL_DUPLEX /* pipes, sockets, drivers, ... */
49};
50
51
52#define FD_READ 0x1
53#define FD_WRITE 0x2
54#define FD_RDWR (FD_READ | FD_WRITE)
55
56struct fd_ops {
57 int (*write)();
58 int (*read)();
59 int (*close)();
60 int (*fcntl)();
90269d47
AM
61 int (*writev)();
62 int (*readv)();
774b174b 63 int (*seek)();
90269d47
AM
64};
65
66union fd_data {
67 void *ptr;
68 int i;
69};
70
71struct fd_table_entry {
72 struct pthread_queue r_queue;
73 struct pthread_queue w_queue;
74 struct pthread *r_owner;
75 struct pthread *w_owner;
76 semaphore lock;
77 struct fd_table_entry *next;
78 struct fd_ops *ops;
79 enum fd_type type;
80 int lockcount; /* Count for FILE locks */
81 int count;
82
83 /* data that needs to be passed to the type dependent fd */
84 int flags;
85 union fd_data fd;
86};
87
88/*
89 * Important data structure
90 */
91extern struct fd_table_entry *fd_table[];
92extern int dtablesize;
93
94/*
95 * New functions
96 */
97
98__BEGIN_DECLS
99
100#if defined(PTHREAD_KERNEL)
101
102#endif
103
104__END_DECLS