Lines 26-34
Link Here
|
26 |
#include <sys/stat.h> |
26 |
#include <sys/stat.h> |
27 |
#include <sys/types.h> |
27 |
#include <sys/types.h> |
28 |
#include <sys/time.h> |
28 |
#include <sys/time.h> |
29 |
#include <xmms/plugin.h> |
29 |
#include <audacious/plugin.h> |
30 |
#include <xmms/util.h> |
30 |
#include <audacious/util.h> |
31 |
#include <xmms/xmmsctrl.h> |
31 |
#include <audacious/beepctrl.h> |
32 |
|
32 |
|
33 |
#include "infopipe.h" |
33 |
#include "infopipe.h" |
34 |
#include "../config.h" |
34 |
#include "../config.h" |
Lines 228-243
Link Here
|
228 |
fd_set fds; |
228 |
fd_set fds; |
229 |
FILE *p; /* the pipe */ |
229 |
FILE *p; /* the pipe */ |
230 |
int fd; /* File descriptor for pipe, and its flags. */ |
230 |
int fd; /* File descriptor for pipe, and its flags. */ |
|
|
231 |
struct timespec tv; |
231 |
|
232 |
|
232 |
for(;;) { |
233 |
for(;;) { |
|
|
234 |
/* This is a thread, fill the structure early */ |
235 |
tv.tv_sec = 0; |
236 |
tv.tv_nsec = 100000000; /* 1/10th of a second */ |
237 |
|
233 |
/* Open the pipe as file descriptor. */ |
238 |
/* Open the pipe as file descriptor. */ |
234 |
/* (O_RDONLY seems to be enough in Linux, but FreeBSDites seemed to |
239 |
/* (O_RDONLY seems to be enough in Linux, but FreeBSDites seemed to |
235 |
demand O_RDWR.) */ |
240 |
demand O_RDWR.) */ |
236 |
fd = open(fifo_file, O_RDWR); |
241 |
/* (Actually, we need to write to the pipe, not read it, so O_WRONLY) */ |
|
|
242 |
fd = open(fifo_file, O_WRONLY); |
237 |
|
243 |
|
238 |
if(fd == -1) { |
244 |
if(fd == -1) { |
239 |
perror("xmms_infopipe: Pipe open failed"); |
245 |
perror("xmms_infopipe: Pipe open failed"); |
240 |
xmms_quit(); |
246 |
xmms_quit(); |
|
|
247 |
/* exit the function, don't give the chance to fill with invalid data */ |
248 |
return; |
241 |
} |
249 |
} |
242 |
|
250 |
|
243 |
/* Set the file handle to use non-blocking I/O */ |
251 |
/* Set the file handle to use non-blocking I/O */ |
Lines 262-270
Link Here
|
262 |
/* Changed to 1 second after request... report if you have problems. |
270 |
/* Changed to 1 second after request... report if you have problems. |
263 |
FIXME: Should use XMMS configfile facility & config dialog??? |
271 |
FIXME: Should use XMMS configfile facility & config dialog??? |
264 |
*/ |
272 |
*/ |
265 |
sleep(1); /* Umm, or non-blockingness still doesn't work without this! |
273 |
|
266 |
Is there some nicer way of saying this, like "wait |
274 |
nanosleep(&tv, NULL); |
267 |
until no reader?" select()? */ |
|
|
268 |
} |
275 |
} |
269 |
} |
276 |
} |
270 |
|
277 |
|