Willy Tarreau | 982b6e3 | 2009-01-25 13:49:53 +0100 | [diff] [blame] | 1 | /* |
| 2 | include/proto/pipe.h |
| 3 | Pipe management |
| 4 | |
| 5 | Copyright (C) 2000-2009 Willy Tarreau - w@1wt.eu |
| 6 | |
| 7 | This library is free software; you can redistribute it and/or |
| 8 | modify it under the terms of the GNU Lesser General Public |
| 9 | License as published by the Free Software Foundation, version 2.1 |
| 10 | exclusively. |
| 11 | |
| 12 | This library is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | Lesser General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU Lesser General Public |
| 18 | License along with this library; if not, write to the Free Software |
| 19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ |
| 21 | |
| 22 | #ifndef _PROTO_PIPE_H |
| 23 | #define _PROTO_PIPE_H |
| 24 | |
Willy Tarreau | 4c7e4b7 | 2020-05-27 12:58:42 +0200 | [diff] [blame^] | 25 | #include <haproxy/api.h> |
Willy Tarreau | 982b6e3 | 2009-01-25 13:49:53 +0100 | [diff] [blame] | 26 | #include <types/pipe.h> |
| 27 | |
| 28 | extern int pipes_used; /* # of pipes in use (2 fds each) */ |
| 29 | extern int pipes_free; /* # of pipes unused (2 fds each) */ |
| 30 | |
| 31 | /* return a pre-allocated empty pipe. Try to allocate one if there isn't any |
| 32 | * left. NULL is returned if a pipe could not be allocated. |
| 33 | */ |
| 34 | struct pipe *get_pipe(); |
| 35 | |
| 36 | /* destroy a pipe, possibly because an error was encountered on it. Its FDs |
| 37 | * will be closed and it will not be reinjected into the live pool. |
| 38 | */ |
| 39 | void kill_pipe(struct pipe *p); |
| 40 | |
| 41 | /* put back a unused pipe into the live pool. If it still has data in it, it is |
| 42 | * closed and not reinjected into the live pool. The caller is not allowed to |
| 43 | * use it once released. |
| 44 | */ |
| 45 | void put_pipe(struct pipe *p); |
| 46 | |
| 47 | #endif /* _PROTO_PIPE_H */ |
| 48 | |
| 49 | /* |
| 50 | * Local variables: |
| 51 | * c-indent-level: 8 |
| 52 | * c-basic-offset: 8 |
| 53 | * End: |
| 54 | */ |