2 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
28 * For further information regarding this notice, see:
30 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
33 #define LIO_IO_SYNC 00001 /* read/write */
34 #define LIO_IO_ASYNC 00002 /* reada/writea/aio_write/aio_read */
35 #define LIO_IO_SLISTIO 00004 /* single stride sync listio */
36 #define LIO_IO_ALISTIO 00010 /* single stride async listio */
37 #define LIO_IO_SYNCV 00020 /* single-buffer readv/writev */
38 #define LIO_IO_SYNCP 00040 /* pread/pwrite */
41 #define LIO_IO_ATYPES 00077 /* all io types */
42 #define LIO_IO_TYPES 00061 /* all io types, non-async */
45 #define LIO_IO_TYPES 00021 /* all io types */
48 #define LIO_IO_TYPES 00017 /* all io types */
51 #define LIO_WAIT_NONE 00010000 /* return asap -- use with care */
52 #define LIO_WAIT_ACTIVE 00020000 /* spin looking at iosw fields, or EINPROGRESS */
53 #define LIO_WAIT_RECALL 00040000 /* call recall(2)/aio_suspend(3) */
54 #define LIO_WAIT_SIGPAUSE 00100000 /* call pause */
55 #define LIO_WAIT_SIGACTIVE 00200000 /* spin waiting for signal */
57 #define LIO_WAIT_CBSUSPEND 00400000 /* aio_suspend waiting for callback */
58 #define LIO_WAIT_SIGSUSPEND 01000000 /* aio_suspend waiting for signal */
59 #define LIO_WAIT_ATYPES 01760000 /* all async wait types, except nowait */
60 #define LIO_WAIT_TYPES 00020000 /* all sync wait types (sorta) */
63 #define LIO_WAIT_TYPES 00300000 /* all wait types, except nowait */
66 #define LIO_WAIT_TYPES 00360000 /* all wait types, except nowait */
73 /* all callback wait types */
74 #define LIO_WAIT_CBTYPES (LIO_WAIT_CBSUSPEND)
75 /* all signal wait types */
76 #define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE|LIO_WAIT_SIGACTIVE|LIO_WAIT_SIGSUSPEND)
77 /* all aio_{read,write} or lio_listio */
78 #define LIO_IO_ASYNC_TYPES (LIO_IO_ASYNC|LIO_IO_SLISTIO|LIO_IO_ALISTIO)
81 /* all signal wait types */
82 #define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE)
85 /* all signal wait types */
86 #define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE|LIO_WAIT_SIGACTIVE)
90 * This bit provides a way to randomly pick an io type and wait method.
91 * lio_read_buffer() and lio_write_buffer() functions will call
92 * lio_random_methods() with the given method.
94 #define LIO_RANDOM 010000000
97 * This bit provides a way for the programmer to use async i/o with
98 * signals and to use their own signal handler. By default,
99 * the signal will only be given to the system call if the wait
100 * method is LIO_WAIT_SIGPAUSE or LIO_WAIT_SIGACTIVE.
101 * Whenever these wait methods are used, libio signal handler
104 #define LIO_USE_SIGNAL 020000000
107 * prototypes/structures for functions in the libio.c module. See comments
108 * in that module, or man page entries for information on the individual
112 int stride_bounds(int offset, int stride, int nstrides,
113 int bytes_per_stride, int *min_byte, int *max_byte);
115 int lio_set_debug(int level);
116 int lio_parse_io_arg1(char *string);
117 void lio_help1(char *prefex);
118 int lio_parse_io_arg2(char *string, char **badtoken);
119 void lio_help2(char *prefex);
120 int lio_write_buffer(int fd, int method, char *buffer, int size,
121 int sig, char **errmsg, long wrd);
123 int lio_read_buffer(int fd, int method, char *buffer, int size,
124 int sig, char **errmsg, long wrd);
125 int lio_random_methods(long mask);
128 #include <sys/iosw.h>
129 int lio_wait4asyncio(int method, int fd, struct iosw **statptr);
130 int lio_check_asyncio(char *io_type, int size, struct iosw *status);
134 int lio_wait4asyncio(int method, int fd, aiocb_t *aiocbp);
135 int lio_check_asyncio(char *io_type, int size, aiocb_t *aiocbp, int method);
139 * Define the structure that contains the infomation that is used
140 * by the parsing and help functions.
142 struct lio_info_type {