Annotation of sys/sys/pipe.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: pipe.h,v 1.13 2005/11/21 18:16:46 millert Exp $ */
2:
3: /*
4: * Copyright (c) 1996 John S. Dyson
5: * All rights reserved.
6: *
7: * Redistribution and use in source and binary forms, with or without
8: * modification, are permitted provided that the following conditions
9: * are met:
10: * 1. Redistributions of source code must retain the above copyright
11: * notice immediately at the beginning of the file, without modification,
12: * this list of conditions, and the following disclaimer.
13: * 2. Redistributions in binary form must reproduce the above copyright
14: * notice, this list of conditions and the following disclaimer in the
15: * documentation and/or other materials provided with the distribution.
16: * 3. Absolutely no warranty of function or purpose is made by the author
17: * John S. Dyson.
18: * 4. This work was done expressly for inclusion into FreeBSD. Other use
19: * is allowed if this notation is included.
20: * 5. Modifications may be freely made to this file if the above conditions
21: * are met.
22: */
23:
24: #ifndef _SYS_PIPE_H_
25: #define _SYS_PIPE_H_
26:
27: #ifndef _KERNEL
28: #include <sys/time.h> /* for struct timeval */
29: #include <sys/selinfo.h> /* for struct selinfo */
30: #include <uvm/uvm_extern.h> /* for vm_page_t */
31: #include <machine/param.h> /* for PAGE_SIZE */
32: #endif /* _KERNEL */
33:
34: /*
35: * Pipe buffer size, keep moderate in value, pipes take kva space.
36: */
37: #ifndef PIPE_SIZE
38: #define PIPE_SIZE 16384
39: #endif
40:
41: #ifndef BIG_PIPE_SIZE
42: #define BIG_PIPE_SIZE (64*1024)
43: #endif
44:
45: /*
46: * Pipe buffer information.
47: * Separate in, out, cnt are used to simplify calculations.
48: * Buffered write is active when the buffer.cnt field is set.
49: */
50: struct pipebuf {
51: u_int cnt; /* number of chars currently in buffer */
52: u_int in; /* in pointer */
53: u_int out; /* out pointer */
54: u_int size; /* size of buffer */
55: caddr_t buffer; /* kva of buffer */
56: };
57:
58: /*
59: * Bits in pipe_state.
60: */
61: #define PIPE_ASYNC 0x004 /* Async? I/O. */
62: #define PIPE_WANTR 0x008 /* Reader wants some characters. */
63: #define PIPE_WANTW 0x010 /* Writer wants space to put characters. */
64: #define PIPE_WANT 0x020 /* Pipe is wanted to be run-down. */
65: #define PIPE_SEL 0x040 /* Pipe has a select active. */
66: #define PIPE_EOF 0x080 /* Pipe is in EOF condition. */
67: #define PIPE_LOCK 0x100 /* Process has exclusive access to pointers/data. */
68: #define PIPE_LWANT 0x200 /* Process wants exclusive access to pointers/data. */
69:
70: /*
71: * Per-pipe data structure.
72: * Two of these are linked together to produce bi-directional pipes.
73: */
74: struct pipe {
75: struct pipebuf pipe_buffer; /* data storage */
76: struct selinfo pipe_sel; /* for compat with select */
77: struct timespec pipe_atime; /* time of last access */
78: struct timespec pipe_mtime; /* time of last modify */
79: struct timespec pipe_ctime; /* time of status change */
80: int pipe_pgid; /* process/group for async I/O */
81: struct pipe *pipe_peer; /* link with other direction */
82: u_int pipe_state; /* pipe status info */
83: int pipe_busy; /* busy flag, mostly to handle rundown sanely */
84: };
85:
86: #ifdef _KERNEL
87: void pipe_init(void);
88: #endif /* _KERNEL */
89:
90: #endif /* !_SYS_PIPE_H_ */
CVSweb