1 #include <lunaix/fs/taskfs.h>
2 #include <lunaix/process.h>
5 __read_pending_sig(struct twimap* map)
7 struct proc_info* proc = twimap_data(map, struct proc_info*);
8 twimap_printf(map, "%bb", proc->sig_pending);
12 __read_masked_sig(struct twimap* map)
14 struct proc_info* proc = twimap_data(map, struct proc_info*);
15 twimap_printf(map, "%bb", proc->sig_mask);
19 __read_parent(struct twimap* map)
21 struct proc_info* proc = twimap_data(map, struct proc_info*);
22 twimap_printf(map, "%d", proc->parent->pid);
26 __read_ctimestamp(struct twimap* map)
28 struct proc_info* proc = twimap_data(map, struct proc_info*);
29 twimap_printf(map, "%d", proc->created);
33 __read_pgid(struct twimap* map)
35 struct proc_info* proc = twimap_data(map, struct proc_info*);
36 twimap_printf(map, "%d", proc->pgid);
40 __read_children(struct twimap* map)
42 struct llist_header* proc_list = twimap_index(map, struct llist_header*);
43 struct proc_info* proc =
44 container_of(proc_list, struct proc_info, siblings);
47 twimap_printf(map, "%d ", proc->pid);
51 __next_children(struct twimap* map)
53 struct llist_header* proc = twimap_index(map, struct llist_header*);
54 struct proc_info* current = twimap_data(map, struct proc_info*);
57 map->index = proc->next;
58 if (map->index == ¤t->children) {
65 __reset_children(struct twimap* map)
67 struct proc_info* proc = twimap_data(map, struct proc_info*);
68 if (llist_empty(&proc->children)) {
72 map->index = proc->children.next;
79 map = twimap_create(NULL);
80 map->read = __read_pending_sig;
81 taskfs_export_attr("sig_pending", map);
83 map = twimap_create(NULL);
84 map->read = __read_masked_sig;
85 taskfs_export_attr("sig_masked", map);
87 map = twimap_create(NULL);
88 map->read = __read_parent;
89 taskfs_export_attr("parent", map);
91 map = twimap_create(NULL);
92 map->read = __read_ctimestamp;
93 taskfs_export_attr("created", map);
95 map = twimap_create(NULL);
96 map->read = __read_pgid;
97 taskfs_export_attr("pgid", map);
99 map = twimap_create(NULL);
100 map->read = __read_children;
101 map->go_next = __next_children;
102 map->reset = __reset_children;
103 taskfs_export_attr("children", map);