comparison src/process.c @ 96620:3bea8ede5bd0

* syswait.h: Remove old if 0 code. Do not define WAITTYPE, it was always defined as int. * s/netbsd.h (HAVE_UNION_WAIT, HAVE_WAIT_HEADER, WAIT_USE_INT): * s/gnu.h (HAVE_WAIT_HEADER, WAIT_USE_INT, HAVE_UNION_WAIT): * s/gnu-linux.h (HAVE_WAIT_HEADER): * s/freebsd.h (HAVE_WAIT_HEADER): * s/bsd-common.h (HAVE_UNION_WAIT): * s/aix4-2.h (HAVE_WAIT_HEADER): * m/mips.h (HAVE_UNION_WAIT): * s/usg5-4.h (HAVE_WAIT_HEADER, WAITTYPE): Do not define, not used. (COFF, static): Do not define, they are undefined later in the file. * process.c (update_status): Don't use a union. (status_convert): (sigchld_handler): Use int instead of WAITTYPE. * movemail.c (main): Use int instead of WAITTYPE.
author Dan Nicolaescu <dann@ics.uci.edu>
date Sat, 12 Jul 2008 05:31:23 +0000
parents a99299e4d2de
children d45acf0c8d23
comparison
equal deleted inserted replaced
96619:029de4e224b6 96620:3bea8ede5bd0
405 #endif 405 #endif
406 406
407 /* Compute the Lisp form of the process status, p->status, from 407 /* Compute the Lisp form of the process status, p->status, from
408 the numeric status that was returned by `wait'. */ 408 the numeric status that was returned by `wait'. */
409 409
410 static Lisp_Object status_convert (); 410 static Lisp_Object status_convert (int);
411 411
412 static void 412 static void
413 update_status (p) 413 update_status (p)
414 struct Lisp_Process *p; 414 struct Lisp_Process *p;
415 { 415 {
416 union { int i; WAITTYPE wt; } u;
417 eassert (p->raw_status_new); 416 eassert (p->raw_status_new);
418 u.i = p->raw_status; 417 p->status = status_convert (p->raw_status);
419 p->status = status_convert (u.wt);
420 p->raw_status_new = 0; 418 p->raw_status_new = 0;
421 } 419 }
422 420
423 /* Convert a process status word in Unix format to 421 /* Convert a process status word in Unix format to
424 the list that we use internally. */ 422 the list that we use internally. */
425 423
426 static Lisp_Object 424 static Lisp_Object
427 status_convert (w) 425 status_convert (int w)
428 WAITTYPE w;
429 { 426 {
430 if (WIFSTOPPED (w)) 427 if (WIFSTOPPED (w))
431 return Fcons (Qstop, Fcons (make_number (WSTOPSIG (w)), Qnil)); 428 return Fcons (Qstop, Fcons (make_number (WSTOPSIG (w)), Qnil));
432 else if (WIFEXITED (w)) 429 else if (WIFEXITED (w))
433 return Fcons (Qexit, Fcons (make_number (WRETCODE (w)), 430 return Fcons (Qexit, Fcons (make_number (WRETCODE (w)),
6696 SIGNAL_THREAD_CHECK (signo); 6693 SIGNAL_THREAD_CHECK (signo);
6697 6694
6698 while (1) 6695 while (1)
6699 { 6696 {
6700 pid_t pid; 6697 pid_t pid;
6701 WAITTYPE w; 6698 int w;
6702 Lisp_Object tail; 6699 Lisp_Object tail;
6703 6700
6704 #ifdef WNOHANG 6701 #ifdef WNOHANG
6705 #ifndef WUNTRACED 6702 #ifndef WUNTRACED
6706 #define WUNTRACED 0 6703 #define WUNTRACED 0
6768 } 6765 }
6769 6766
6770 /* Change the status of the process that was found. */ 6767 /* Change the status of the process that was found. */
6771 if (p != 0) 6768 if (p != 0)
6772 { 6769 {
6773 union { int i; WAITTYPE wt; } u;
6774 int clear_desc_flag = 0; 6770 int clear_desc_flag = 0;
6775 6771
6776 p->tick = ++process_tick; 6772 p->tick = ++process_tick;
6777 u.wt = w; 6773 p->raw_status = w;
6778 p->raw_status = u.i;
6779 p->raw_status_new = 1; 6774 p->raw_status_new = 1;
6780 6775
6781 /* If process has terminated, stop waiting for its output. */ 6776 /* If process has terminated, stop waiting for its output. */
6782 if ((WIFSIGNALED (w) || WIFEXITED (w)) 6777 if ((WIFSIGNALED (w) || WIFEXITED (w))
6783 && p->infd >= 0) 6778 && p->infd >= 0)