summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/procctl.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/procctl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/procctl.cpp1
1 files changed, 0 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/procctl.cpp b/noncore/apps/opie-console/procctl.cpp
index d1cfaf6..ff6bea8 100644
--- a/noncore/apps/opie-console/procctl.cpp
+++ b/noncore/apps/opie-console/procctl.cpp
@@ -50,48 +50,47 @@ void ProcCtl::remove( pid_t pi ) {
50 if ( pi == con->pid ) { 50 if ( pi == con->pid ) {
51 forw->prev = con->prev; 51 forw->prev = con->prev;
52 delete con; 52 delete con;
53 return; 53 return;
54 } 54 }
55 55
56 forw = con; 56 forw = con;
57 con = con->prev; 57 con = con->prev;
58 } 58 }
59 59
60} 60}
61void ProcCtl::remove( ProcContainer con ) { 61void ProcCtl::remove( ProcContainer con ) {
62 remove( con.pid ); 62 remove( con.pid );
63} 63}
64int ProcCtl::status(pid_t pid )const{ 64int ProcCtl::status(pid_t pid )const{
65 ProcContainer *con = m_last; 65 ProcContainer *con = m_last;
66 while (con) { 66 while (con) {
67 if (con->pid == pid ) 67 if (con->pid == pid )
68 return con->status; 68 return con->status;
69 con = con->prev; 69 con = con->prev;
70 } 70 }
71 return -1; 71 return -1;
72} 72}
73void ProcCtl::signal_handler(int) { 73void ProcCtl::signal_handler(int) {
74 qWarning("signal handler in ProcCtl");
75 int status; 74 int status;
76 signal( SIGCHLD, signal_handler ); 75 signal( SIGCHLD, signal_handler );
77 pid_t pi = waitpid( -1, &status, WNOHANG ); 76 pid_t pi = waitpid( -1, &status, WNOHANG );
78 77
79 /* 78 /*
80 * find the container for pid 79 * find the container for pid
81 * 80 *
82 */ 81 */
83 if ( pi < 0 ) { 82 if ( pi < 0 ) {
84 return; 83 return;
85 } 84 }
86 85
87 ProcContainer* con = m_last; 86 ProcContainer* con = m_last;
88 while (con) { 87 while (con) {
89 if ( con->pid == pi ) { 88 if ( con->pid == pi ) {
90 con->status = status; 89 con->status = status;
91 char result = 1; 90 char result = 1;
92 /* give a 'signal' */ 91 /* give a 'signal' */
93 ::write(con->fd, &result, 1 ); 92 ::write(con->fd, &result, 1 );
94 } 93 }
95 con = con->prev; 94 con = con->prev;
96 } 95 }
97} 96}