2
xfermem: unidirectional fast pipe
4
copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1
5
see COPYING and AUTHORS files in distribution or http://mpg123.de
6
initially written by Oliver Fromme
7
old timestamp: Sat Mar 29 04:41:34 MET 1997
9
This is a stand-alone module which implements a unidirectional,
10
fast pipe using mmap(). Its primary use is to transfer large
11
amounts of data from a parent process to its child process,
12
with a buffer in between which decouples blocking conditions
13
on both sides. Control information is transferred between the
14
processes through a socketpair. See xftest.c for an example on
15
how to use this module.
17
note: xftest not there anymore
29
int freeindex; /* [W] next free index */
30
int readindex; /* [R] next index to read */
40
* [W] -- May be written to by the writing process only!
41
* [R] -- May be written to by the reading process only!
42
* All other entries are initialized once.
45
void xfermem_init (txfermem **xf, int bufsize, int msize,int skipbuf);
46
void xfermem_init_writer (txfermem *xf);
47
void xfermem_init_reader (txfermem *xf);
49
int xfermem_write (txfermem *xf, byte *data, int count);
50
int xfermem_read (txfermem *xf, byte *data, int count);
52
int xfermem_get_freespace (txfermem *xf);
53
int xfermem_get_usedspace (txfermem *xf);
54
#define XF_CMD_WAKEUP_INFO 0x04
55
#define XF_CMD_WAKEUP 0x02
56
#define XF_CMD_TERMINATE 0x03
59
int xfermem_getcmd (int fd, int block);
60
int xfermem_putcmd (int fd, byte cmd);
61
int xfermem_block (int fd, txfermem *xf);
63
void xfermem_done (txfermem *xf);
64
#define xfermem_done_writer xfermem_init_reader
65
#define xfermem_done_reader xfermem_init_writer