source: vendor/emx/current/src/os2/files.h

Last change on this file was 18, checked in by bird, 22 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 3.4 KB
Line 
1/* files.h -- Header file for modules involved in file handle management
2 Copyright (c) 1994-1995 by Eberhard Mattes
3
4This file is part of emx.
5
6emx is free software; you can redistribute it and/or modify it
7under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11emx is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with emx; see the file COPYING. If not, write to
18the Free Software Foundation, 59 Temple Place - Suite 330,
19Boston, MA 02111-1307, USA.
20
21As special exception, emx.dll can be distributed without source code
22unless it has been changed. If you modify emx.dll, this exception
23no longer applies and you must remove this paragraph from all source
24files for emx.dll. */
25
26
27/* Requires INCL_DOSDEVIOCTL! */
28
29#define ASYNC_SETEXTBAUDRATE 0x0043
30#define ASYNC_GETEXTBAUDRATE 0x0063
31
32typedef struct
33{
34 ULONG ulCurrentRate;
35 BYTE bCurrentFract;
36 ULONG ulMinimumRate;
37 BYTE bMinimumFract;
38 ULONG ulMaximumRate;
39 BYTE bMaximumFract;
40} GETEXTBAUDRATE;
41typedef GETEXTBAUDRATE *PGETEXTBAUDRATE;
42
43typedef struct
44{
45 ULONG ulRate;
46 BYTE bFract;
47} SETEXTBAUDRATE;
48typedef SETEXTBAUDRATE *PSETEXTBAUDRATE;
49
50
51#define SET_INVALID_FILE(handle) (handle_file[handle] = handle_count)
52#define IS_VALID_FILE(handle) (handle_file[handle] < handle_count)
53#define GET_FILE(handle) (&files[handle_file[handle]])
54
55
56typedef struct
57{
58 ULONG flags;
59 ULONG ref_count;
60
61 /* termio interface */
62
63 ULONG c_iflag;
64 ULONG c_oflag;
65 ULONG c_cflag;
66 ULONG c_lflag;
67 UCHAR c_cc[11]; /* NCC == 8, NCCS == 11 */
68
69 /* termio implementation */
70
71 char *tio_buf;
72 unsigned tio_buf_count;
73 unsigned tio_buf_size;
74 unsigned tio_buf_idx;
75 char tio_escape;
76 ULONG tio_input_handle;
77 ULONG tio_output_handle;
78
79 /* Data which depends on the file type. */
80
81 union
82 {
83 struct
84 {
85 GETEXTBAUDRATE speed;
86 LINECONTROL lctl;
87 DCBINFO dcb;
88 } async;
89 struct
90 {
91 int handle;
92 int fd_flags; /* FD_CLOEXEC */
93 } socket;
94 struct
95 {
96 ULONG id; /* ID returned by XF86SUP_DRVID */
97 HEV sem; /* Semaphore handle */
98 BYTE sem_open; /* Semaphore handle valid */
99 } xf86sup; /* xf86sup device */
100 } x;
101} my_file;
102
103
104extern ULONG handle_count;
105extern ULONG *handle_flags;
106extern ULONG *handle_file;
107extern my_file *files;
108extern long ino_number;
109extern HMTX files_access;
110
111
112/* Duplicate S_IREAD, S_IWRITE, and S_IEXEC bits into all three groups
113 of the permission mask. */
114
115#define MAKEPERM(x) (((x) >> 6) * 0111)
116
117#define IS_SOCKET(h) ((h) < handle_count && (handle_flags[h] & HF_SOCKET))
118
119
120/* `handle_flags' array is protected by a Mutex semaphore. These
121 macros are used for requesting and releasing that semaphore. */
122
123#define LOCK_FILES request_mutex (files_access)
124#define UNLOCK_FILES DosReleaseMutexSem (files_access)
125
126void alloc_file_description (ULONG handle);
127void close_handle (ULONG handle);
128void set_handle_flags (ULONG handle, ULONG flags);
129int find_unused_handles (ULONG *dst, int count);
Note: See TracBrowser for help on using the repository browser.