The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Functions
pipe.h File Reference

BIO pipe handlers. More...

Go to the source code of this file.

Data Structures

struct  fr_bio_pipe_cb_funcs_t
 

Functions

fr_bio_tfr_bio_pipe_alloc (TALLOC_CTX *ctx, fr_bio_pipe_cb_funcs_t *cb, size_t buffer_size)
 Allocate a thread-safe pipe which can be used for both reads and writes. More...
 
void fr_bio_pipe_set_eof (fr_bio_t *bio)
 Set EOF. More...
 

Detailed Description

BIO pipe handlers.

Id
7c3d9cb0b83fd0d7ce86e6d727a75513f2170a7a

Definition in file pipe.h.


Data Structure Documentation

◆ fr_bio_pipe_cb_funcs_t

struct fr_bio_pipe_cb_funcs_t

Definition at line 27 of file pipe.h.

+ Collaboration diagram for fr_bio_pipe_cb_funcs_t:
Data Fields
fr_bio_callback_t readable
fr_bio_callback_t writeable

Function Documentation

◆ fr_bio_pipe_alloc()

fr_bio_t* fr_bio_pipe_alloc ( TALLOC_CTX *  ctx,
fr_bio_pipe_cb_funcs_t cb,
size_t  buffer_size 
)

Allocate a thread-safe pipe which can be used for both reads and writes.

Due to talloc issues with multiple threads, if the caller wants a bi-directional pipe, this function will need to be called twice. That way a free in each context won't result in a race condition on two mutex locks.

For now, iqt's too difficult to emulate the pipe[2] behavior, where two identical "connected" things are returned, and either can be used for reading or for writing.

i.e. a pipe is really a mutex-protected memory buffer. One side should call write (and never read). The other side should call read (and never write).

The pipe should be freed only after both ends have set EOF.

Definition at line 147 of file pipe.c.

+ Here is the call graph for this function:

◆ fr_bio_pipe_set_eof()

void fr_bio_pipe_set_eof ( fr_bio_t bio)

Set EOF.

Either side can set EOF, in which case pending reads are still processed. Writes return EOF immediately. Readers return pending data, and then EOF.

Definition at line 182 of file pipe.c.