1 #include <lunaix/fs/taskfs.h>
2 #include <lunaix/process.h>
5 __read_parent(struct twimap* map)
7 struct proc_info* proc = twimap_data(map, struct proc_info*);
8 twimap_printf(map, "%d", proc->parent->pid);
12 __read_ctimestamp(struct twimap* map)
14 struct proc_info* proc = twimap_data(map, struct proc_info*);
15 twimap_printf(map, "%d", proc->created);
19 __read_pgid(struct twimap* map)
21 struct proc_info* proc = twimap_data(map, struct proc_info*);
22 twimap_printf(map, "%d", proc->pgid);
26 __read_children(struct twimap* map)
28 struct llist_header* proc_list = twimap_index(map, struct llist_header*);
29 struct proc_info* proc =
30 container_of(proc_list, struct proc_info, siblings);
33 twimap_printf(map, "%d ", proc->pid);
37 __next_children(struct twimap* map)
39 struct llist_header* proc = twimap_index(map, struct llist_header*);
40 struct proc_info* current = twimap_data(map, struct proc_info*);
43 map->index = proc->next;
44 if (map->index == ¤t->children) {
51 __reset_children(struct twimap* map)
53 struct proc_info* proc = twimap_data(map, struct proc_info*);
54 if (llist_empty(&proc->children)) {
58 map->index = proc->children.next;
66 // FIXME goes to thread specific location
67 // map = twimap_create(NULL);
68 // map->read = __read_pending_sig;
69 // taskfs_export_attr("sig_pending", map);
71 // map = twimap_create(NULL);
72 // map->read = __read_masked_sig;
73 // taskfs_export_attr("sig_masked", map);
75 map = twimap_create(NULL);
76 map->read = __read_parent;
77 taskfs_export_attr("parent", map);
79 map = twimap_create(NULL);
80 map->read = __read_ctimestamp;
81 taskfs_export_attr("created", map);
83 map = twimap_create(NULL);
84 map->read = __read_pgid;
85 taskfs_export_attr("pgid", map);
87 map = twimap_create(NULL);
88 map->read = __read_children;
89 map->go_next = __next_children;
90 map->reset = __reset_children;
91 taskfs_export_attr("children", map);