1RFIO_POPEN(3) Rfio Library Functions RFIO_POPEN(3)
2
3
4
6 rfio_popen, rfio_pclose - start a process and open a pipe to it
7
9 #include <sys/types.h>
10 #include "rfio_api.h"
11
12 FILE *rfio_popen (const char *command, const char *type);
13
14 int rfio_pclose (FILE *fs);
15
17 rfio_popen starts a process and opens a pipe to it.
18
19 command is a pointer to a string specifying the shell command to be
20 executed.
21
22 type is a mode indicator for the pipe. One of the characters "r" or
23 "w".
24
25 rfio_pclose waits for the forked process to terminate and returns the
26 exit status of the command.
27
29 int c;
30 FILE *rf;
31
32 rf = rfio_popen (command, "r");
33 if (rf == NULL) {
34 rfio_perror ("rfio_popen");
35 exit (1);
36 }
37 while ((c = rfio_pread (buf, 1, sizeof(buf), rf)) > 0) {
38 ...
39 }
40 c = rfio_pclose (rf);
41
43 This routine returns NULL if the operation failed or a non-NULL pointer
44 to a FILE structure if the operation was successful. If it fails, ser‐
45 rno variable is set appropriately.
46
48 ENOMEM Not enough memory.
49
50 EINVAL The mode provided is invalid.
51
52 ECONNRESET Connection reset by peer
53
54 ETIMEDOUT Connection timed out
55
56 ECONNREFUSED Connection refused
57
58 EHOSTUNREACH No route to host
59
60 SENOSHOST Host unknown.
61
62 SENOSSERV Service unknown.
63
64 SEUMSG2LONG Command string too long.
65
66 SECOMERR Communication error.
67
69 rfio_pread(3), rfio_pwrite(3)
70
72 LCG Grid Deployment Team
73
74
75
76LCG $Date: 2008/09/24 11:25:01 $ RFIO_POPEN(3)