110c5615cSJohn Dyson /* 210c5615cSJohn Dyson * Copyright (c) 1996 John S. Dyson 310c5615cSJohn Dyson * All rights reserved. 410c5615cSJohn Dyson * 510c5615cSJohn Dyson * Redistribution and use in source and binary forms, with or without 610c5615cSJohn Dyson * modification, are permitted provided that the following conditions 710c5615cSJohn Dyson * are met: 810c5615cSJohn Dyson * 1. Redistributions of source code must retain the above copyright 910c5615cSJohn Dyson * notice immediately at the beginning of the file, without modification, 1010c5615cSJohn Dyson * this list of conditions, and the following disclaimer. 1110c5615cSJohn Dyson * 2. Redistributions in binary form must reproduce the above copyright 1210c5615cSJohn Dyson * notice, this list of conditions and the following disclaimer in the 1310c5615cSJohn Dyson * documentation and/or other materials provided with the distribution. 1410c5615cSJohn Dyson * 3. Absolutely no warranty of function or purpose is made by the author 1510c5615cSJohn Dyson * John S. Dyson. 1610c5615cSJohn Dyson * 4. This work was done expressly for inclusion into FreeBSD. Other use 1710c5615cSJohn Dyson * is allowed if this notation is included. 1810c5615cSJohn Dyson * 5. Modifications may be freely made to this file if the above conditions 1910c5615cSJohn Dyson * are met. 2010c5615cSJohn Dyson * 2110c5615cSJohn Dyson * $Id$ 2210c5615cSJohn Dyson */ 2310c5615cSJohn Dyson 2410c5615cSJohn Dyson #ifndef OLD_PIPE 2510c5615cSJohn Dyson 2610c5615cSJohn Dyson struct vm_object; 2710c5615cSJohn Dyson 2810c5615cSJohn Dyson /* 2910c5615cSJohn Dyson * pipe buffer information 3010c5615cSJohn Dyson * Seperate in, out, cnt is used to simplify calculations. 3110c5615cSJohn Dyson */ 3210c5615cSJohn Dyson struct pipebuf { 3310c5615cSJohn Dyson u_int cnt; /* number of chars currently in buffer */ 3410c5615cSJohn Dyson u_int in; /* in pointer */ 3510c5615cSJohn Dyson u_int out; /* out pointer */ 3610c5615cSJohn Dyson u_int size; /* size of buffer */ 3710c5615cSJohn Dyson caddr_t buffer; /* kva of buffer */ 3810c5615cSJohn Dyson struct vm_object *object; /* VM object containing buffer */ 3910c5615cSJohn Dyson }; 4010c5615cSJohn Dyson 4110c5615cSJohn Dyson /* 4210c5615cSJohn Dyson * pipe_state bits 4310c5615cSJohn Dyson */ 4410c5615cSJohn Dyson #define PIPE_NBIO 0x1 /* non-blocking I/O */ 4510c5615cSJohn Dyson #define PIPE_ASYNC 0x4 /* Async? I/O */ 4610c5615cSJohn Dyson #define PIPE_WANTR 0x8 /* Reader wants some characters */ 4710c5615cSJohn Dyson #define PIPE_WANTW 0x10 /* Writer wants space to put characters */ 4810c5615cSJohn Dyson #define PIPE_WANT 0x20 /* Pipe is wanted to be run-down */ 4910c5615cSJohn Dyson #define PIPE_SEL 0x40 /* Pipe has a select active */ 5010c5615cSJohn Dyson #define PIPE_EOF 0x80 /* Pipe is in EOF condition */ 5110c5615cSJohn Dyson #define PIPE_LOCK 0x100 /* Process has exclusive access to pointers/data */ 5210c5615cSJohn Dyson #define PIPE_LWANT 0x200 /* Process wants exclusive access to pointers/data */ 5310c5615cSJohn Dyson 5410c5615cSJohn Dyson /* 5510c5615cSJohn Dyson * Per-pipe data structure 5610c5615cSJohn Dyson * Two of these are linked together to produce bi-directional 5710c5615cSJohn Dyson * pipes. 5810c5615cSJohn Dyson */ 5910c5615cSJohn Dyson struct pipe { 6010c5615cSJohn Dyson struct pipebuf pipe_buffer; /* data storage */ 6110c5615cSJohn Dyson struct selinfo pipe_sel; /* for compat with select */ 6210c5615cSJohn Dyson struct timeval pipe_atime; /* time of last access */ 6310c5615cSJohn Dyson struct timeval pipe_mtime; /* time of last modify */ 6410c5615cSJohn Dyson struct timeval pipe_ctime; /* time of status change */ 6510c5615cSJohn Dyson int pipe_pgid; 6610c5615cSJohn Dyson struct pipe *pipe_peer; /* link with other direction */ 6710c5615cSJohn Dyson u_int pipe_state; /* pipe status info */ 6810c5615cSJohn Dyson int pipe_busy; /* busy flag, mostly to handle rundown sanely */ 6910c5615cSJohn Dyson }; 7010c5615cSJohn Dyson 7110c5615cSJohn Dyson int pipe_stat __P((struct pipe *pipe, struct stat *ub)); 7210c5615cSJohn Dyson 7310c5615cSJohn Dyson #endif 74