diff options
author | sabetts <sabetts> | 2003-05-15 07:36:21 +0000 |
---|---|---|
committer | sabetts <sabetts> | 2003-05-15 07:36:21 +0000 |
commit | 55fadaecf93dfdf6a7c9510098057c5152e3b920 (patch) | |
tree | f1fc81a4aa497466f1cf5a497386ae994265984c /src/main.c | |
parent | 2d8945e4ee37ceee9d58e91681c6d3722a83c956 (diff) | |
download | ratpoison-55fadaecf93dfdf6a7c9510098057c5152e3b920.zip |
* src/data.h (struct rp_frame): renamed from rp_window_frame. All
dependant code updated.
* src/main.c: remove child_info global. Add rp_children global.
(chld_handler): update the terminated and status fields of any
terminated children.
* src/events.c (handle_signals): loop through each child process
and remove them from the list. Print a message for any child that
doesn't return a 0 status.
* src/data.h (rp_child_info): new fields, terminated and node.
remove child_info global. Add rp_children global.
* src/actions.c (spawn): Add the command to the list of children.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -70,7 +70,7 @@ rp_screen *screens; int num_screens; Display *dpy; -struct rp_child_info child_info; +LIST_HEAD (rp_children); struct rp_defaults defaults; int ignore_badwindow = 0; @@ -218,6 +218,7 @@ chld_handler (int signum) { int pid, status, serrno; serrno = errno; + rp_child_info *cur; while (1) { @@ -227,15 +228,18 @@ chld_handler (int signum) PRINT_DEBUG(("Child status: %d\n", WEXITSTATUS (status))); - /* Tell ratpoison about the CHLD signal. We are only interested - in reporting commands that failed to execute. These processes - have a return value of 127 (according to the sh manual). */ - if (WEXITSTATUS (status) == 127) + /* Find the child and update its structure. */ + list_for_each_entry (cur, &rp_children, node) { - chld_signalled = 1; - child_info.pid = pid; - child_info.status = status; + if (cur->pid == pid) + { + cur->terminated = 1; + cur->status = WEXITSTATUS (status); + break; + } } + + chld_signalled = 1; } errno = serrno; } @@ -763,10 +767,10 @@ init_screen (rp_screen *s, int screen_num) static void free_screen (rp_screen *s) { - rp_window_frame *frame; + rp_frame *frame; struct list_head *iter, *tmp; - list_for_each_safe_entry (frame, iter, tmp, &s->rp_window_frames, node) + list_for_each_safe_entry (frame, iter, tmp, &s->frames, node) { frame_free (s, frame); } |