2 * Copyright (c) 1996 John S. Dyson
4 * Copyright (c) 2003-2017 The DragonFly Project. All rights reserved.
6 * This code is derived from software contributed to The DragonFly Project
7 * by Matthew Dillon <dillon@backplane.com>
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice immediately at the beginning of the file, without modification,
14 * this list of conditions, and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Absolutely no warranty of function or purpose is made by the author
20 * 4. This work was done expressly for inclusion into FreeBSD. Other use
21 * is allowed if this notation is included.
22 * 5. Modifications may be freely made to this file if the above conditions
29 #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
32 #include <sys/types.h>
35 #include <sys/time.h> /* for struct timespec */
38 #include <sys/event.h> /* for struct kqinfo */
41 #include <sys/xio.h> /* for struct xio */
43 #ifndef _SYS_THREAD_H_
44 #include <sys/thread.h> /* for struct lwkt_token */
46 #ifndef _MACHINE_PARAM_H_
47 #include <machine/param.h> /* for PAGE_SIZE */
51 * Pipe buffer information.
55 struct lwkt_token rlock;
56 size_t rindex; /* current read index (FIFO) */
57 int32_t rip; /* blocking read requested (FIFO) */
58 int32_t unu01; /* blocking read requested (FIFO) */
59 struct timespec atime; /* time of last access */
62 struct lwkt_token wlock;
63 size_t windex; /* current write index (FIFO) */
66 struct timespec mtime; /* time of last modify */
68 size_t size; /* size of buffer */
69 caddr_t buffer; /* kva of buffer */
70 struct vm_object *object; /* VM object containing buffer */
71 struct kqinfo kq; /* for compat with select/poll/kq */
72 struct sigio *sigio; /* information for async I/O */
73 uint32_t state; /* pipe status info */
77 * Bits in pipebuf.state.
79 #define PIPE_ASYNC 0x0004 /* Async? I/O */
80 #define PIPE_WANTR 0x0008 /* Reader wants some characters */
81 #define PIPE_WANTW 0x0010 /* Writer wants space to put characters */
82 #define PIPE_REOF 0x0040 /* Pipe is in EOF condition (read EOF) */
83 #define PIPE_WEOF 0x0080 /* Pipe is in EOF condition (write shutdown) */
84 #define PIPE_CLOSED 0x1000 /* Pipe has been closed */
87 * The pipe() data structure encompasses two pipes. Bit 0 in fp->f_data
91 struct pipebuf bufferA; /* data storage */
92 struct pipebuf bufferB; /* data storage */
93 struct timespec ctime; /* time of status change */
98 #endif /* _KERNEL || _KERNEL_STRUCTURES */
99 #endif /* !_SYS_PIPE_H_ */