1iv_popen(3) ivykis programmer's manual iv_popen(3)
2
3
4
6 IV_POPEN_REQUEST_INIT, iv_popen_request_submit, iv_popen_request_close
7 - popen(3) for ivykis applications
8
10 #include <iv_popen.h>
11
12 struct iv_popen_request {
13 char *file;
14 char **argv;
15 char *type;
16 };
17
18 void IV_POPEN_REQUEST_INIT(struct iv_popen_request *this);
19 int iv_popen_request_submit(struct iv_popen_request *this);
20 void iv_popen_request_close(struct iv_popen_request *this);
21
23 iv_popen provides ivykis(3) applications with an asynchronous version
24 of popen(3) that is integrated with the ivykis event loop.
25
26 After initialising a struct iv_popen_request object using
27 IV_POPEN_REQUEST_INIT and assigning its ->file and ->argv and ->type
28 members, one can call iv_popen_request_submit on it to fork off a child
29 process which will call execvp(2) on ->file and ->argv, while in the
30 parent process returning a file descriptor that is connected to the
31 child's standard input (if ->type equals "w") or standard output (if
32 ->type equals "r").
33
34 When the application is done with the child process, it should call
35 iv_popen_request_close, and close the file descriptor returned by
36 iv_popen_request_submit (this is not done automatically).
37
38 iv_popen will continue to monitor the child's process state while it is
39 running, by registering an iv_wait(3) interest for its process ID.
40
41 If the child process has not yet terminated when iv_popen_request_close
42 is called, iv_popen will attempt to terminate the child process in the
43 background by sending it a series of SIGTERM and SIGKILL signals.
44
45 iv_popen_request_close must be called from the same thread that
46 iv_popen_request_submit was called from on this object.
47
49 ivykis(3), iv_wait(3), execvp(2), popen(3)
50
51
52
53ivykis 2010-09-04 iv_popen(3)