Play with some possible *.api code.
[wrappi.git] / APIs / processes.api
1 object process
2   dir_list "/proc/[1-9]*"
3
4   constructor <<
5     $pid = atoi ($basename);
6   >>
7
8   property int pid (* implicit *)
9
10   property string short_command
11   <<
12     // some code to parse $filename/stat
13   >>
14   property char state
15   <<
16     // some code to parse $filename/stat
17   >>
18
19   writable property foo << ... >>
20
21   method err kill (signal sig)
22   <<
23     return kill ($pid, sig);
24   >>
25   method bool exists ()
26   <<
27     int r = kill ($pid, 0);
28     if (r == 0)
29       return 1;
30     if (r == -1 && errno == ESRCH)
31       return 0;
32     save_errno ();
33     return -1;
34   >>