1 /* Sequent Symmetry host interface, for GDB when running under Unix.
2 Copyright 1986, 1987, 1989, 1991, 1992, 1994 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
20 /* FIXME, some 387-specific items of use taken from i387-tdep.c -- ought to be
29 /* FIXME: What is the _INKERNEL define for? */
34 #include <sys/param.h>
38 #include <sys/ioctl.h>
40 #include <sys/ptrace.h>
44 #define TERMINAL struct sgttyb
49 store_inferior_registers(regno
)
52 struct pt_regset regs
;
54 extern char registers
[];
56 regs
.pr_eax
= *(int *)®isters
[REGISTER_BYTE(0)];
57 regs
.pr_ebx
= *(int *)®isters
[REGISTER_BYTE(5)];
58 regs
.pr_ecx
= *(int *)®isters
[REGISTER_BYTE(2)];
59 regs
.pr_edx
= *(int *)®isters
[REGISTER_BYTE(1)];
60 regs
.pr_esi
= *(int *)®isters
[REGISTER_BYTE(6)];
61 regs
.pr_edi
= *(int *)®isters
[REGISTER_BYTE(7)];
62 regs
.pr_esp
= *(int *)®isters
[REGISTER_BYTE(14)];
63 regs
.pr_ebp
= *(int *)®isters
[REGISTER_BYTE(15)];
64 regs
.pr_eip
= *(int *)®isters
[REGISTER_BYTE(16)];
65 regs
.pr_flags
= *(int *)®isters
[REGISTER_BYTE(17)];
66 for (i
= 0; i
< 31; i
++)
68 regs
.pr_fpa
.fpa_regs
[i
] =
69 *(int *)®isters
[REGISTER_BYTE(FP1_REGNUM
+i
)];
71 mptrace (XPT_WREGS
, inferior_pid
, (PTRACE_ARG3_TYPE
) ®s
, 0);
75 fetch_inferior_registers (regno
)
79 struct pt_regset regs
;
80 extern char registers
[];
84 mptrace (XPT_RREGS
, (pid
), (regaddr
), 0);
85 *(int *)®isters
[REGISTER_BYTE(EAX_REGNUM
)] = regs
.pr_eax
;
86 *(int *)®isters
[REGISTER_BYTE(EBX_REGNUM
)] = regs
.pr_ebx
;
87 *(int *)®isters
[REGISTER_BYTE(ECX_REGNUM
)] = regs
.pr_ecx
;
88 *(int *)®isters
[REGISTER_BYTE(EDX_REGNUM
)] = regs
.pr_edx
;
89 *(int *)®isters
[REGISTER_BYTE(ESI_REGNUM
)] = regs
.pr_esi
;
90 *(int *)®isters
[REGISTER_BYTE(EDI_REGNUM
)] = regs
.pr_edi
;
91 *(int *)®isters
[REGISTER_BYTE(EBP_REGNUM
)] = regs
.pr_ebp
;
92 *(int *)®isters
[REGISTER_BYTE(ESP_REGNUM
)] = regs
.pr_esp
;
93 *(int *)®isters
[REGISTER_BYTE(EIP_REGNUM
)] = regs
.pr_eip
;
94 *(int *)®isters
[REGISTER_BYTE(EFLAGS_REGNUM
)] = regs
.pr_flags
;
95 for (i
= 0; i
< FPA_NREGS
; i
++)
97 *(int *)®isters
[REGISTER_BYTE(FP1_REGNUM
+i
)] =
98 regs
.pr_fpa
.fpa_regs
[i
];
100 memcpy (®isters
[REGISTER_BYTE(ST0_REGNUM
)], regs
.pr_fpu
.fpu_stack
[0], 10);
101 memcpy (®isters
[REGISTER_BYTE(ST1_REGNUM
)], regs
.pr_fpu
.fpu_stack
[1], 10);
102 memcpy (®isters
[REGISTER_BYTE(ST2_REGNUM
)], regs
.pr_fpu
.fpu_stack
[2], 10);
103 memcpy (®isters
[REGISTER_BYTE(ST3_REGNUM
)], regs
.pr_fpu
.fpu_stack
[3], 10);
104 memcpy (®isters
[REGISTER_BYTE(ST4_REGNUM
)], regs
.pr_fpu
.fpu_stack
[4], 10);
105 memcpy (®isters
[REGISTER_BYTE(ST5_REGNUM
)], regs
.pr_fpu
.fpu_stack
[5], 10);
106 memcpy (®isters
[REGISTER_BYTE(ST6_REGNUM
)], regs
.pr_fpu
.fpu_stack
[6], 10);
107 memcpy (®isters
[REGISTER_BYTE(ST7_REGNUM
)], regs
.pr_fpu
.fpu_stack
[7], 10);
110 /* FIXME: This should be merged with i387-tdep.c as well. */
121 printf_unfiltered("80387:");
122 if (ep
.pr_fpu
.fpu_ip
== 0) {
123 printf_unfiltered(" not in use.\n");
126 printf_unfiltered("\n");
128 if (ep
.pr_fpu
.fpu_status
!= 0) {
129 print_387_status_word (ep
.pr_fpu
.fpu_status
);
131 print_387_control_word (ep
.pr_fpu
.fpu_control
);
132 printf_unfiltered ("last exception: ");
133 printf_unfiltered ("opcode 0x%x; ", ep
.pr_fpu
.fpu_rsvd4
);
134 printf_unfiltered ("pc 0x%x:0x%x; ", ep
.pr_fpu
.fpu_cs
, ep
.pr_fpu
.fpu_ip
);
135 printf_unfiltered ("operand 0x%x:0x%x\n", ep
.pr_fpu
.fpu_data_offset
, ep
.pr_fpu
.fpu_op_sel
);
137 top
= (ep
.pr_fpu
.fpu_status
>> 11) & 7;
139 printf_unfiltered ("regno tag msb lsb value\n");
140 for (fpreg
= 7; fpreg
>= 0; fpreg
--)
144 printf_unfiltered ("%s %d: ", fpreg
== top
? "=>" : " ", fpreg
);
146 switch ((ep
.pr_fpu
.fpu_tag
>> (fpreg
* 2)) & 3)
148 case 0: printf_unfiltered ("valid "); break;
149 case 1: printf_unfiltered ("zero "); break;
150 case 2: printf_unfiltered ("trap "); break;
151 case 3: printf_unfiltered ("empty "); break;
153 for (i
= 9; i
>= 0; i
--)
154 printf_unfiltered ("%02x", ep
.pr_fpu
.fpu_stack
[fpreg
][i
]);
156 i387_to_double ((char *)ep
.pr_fpu
.fpu_stack
[fpreg
], (char *)&val
);
157 printf_unfiltered (" %g\n", val
);
159 if (ep
.pr_fpu
.fpu_rsvd1
)
160 warning ("rsvd1 is 0x%x\n", ep
.pr_fpu
.fpu_rsvd1
);
161 if (ep
.pr_fpu
.fpu_rsvd2
)
162 warning ("rsvd2 is 0x%x\n", ep
.pr_fpu
.fpu_rsvd2
);
163 if (ep
.pr_fpu
.fpu_rsvd3
)
164 warning ("rsvd3 is 0x%x\n", ep
.pr_fpu
.fpu_rsvd3
);
165 if (ep
.pr_fpu
.fpu_rsvd5
)
166 warning ("rsvd5 is 0x%x\n", ep
.pr_fpu
.fpu_rsvd5
);
170 print_1167_control_word(pcr
)
176 pcr_tmp
= pcr
& FPA_PCR_MODE
;
177 printf_unfiltered("\tMODE= %#x; RND= %#x ", pcr_tmp
, pcr_tmp
& 12);
178 switch (pcr_tmp
& 12) {
180 printf_unfiltered("RN (Nearest Value)");
183 printf_unfiltered("RZ (Zero)");
186 printf_unfiltered("RP (Positive Infinity)");
189 printf_unfiltered("RM (Negative Infinity)");
192 printf_unfiltered("; IRND= %d ", pcr_tmp
& 2);
193 if (0 == pcr_tmp
& 2) {
194 printf_unfiltered("(same as RND)\n");
196 printf_unfiltered("(toward zero)\n");
198 pcr_tmp
= pcr
& FPA_PCR_EM
;
199 printf_unfiltered("\tEM= %#x", pcr_tmp
);
200 if (pcr_tmp
& FPA_PCR_EM_DM
) printf_unfiltered(" DM");
201 if (pcr_tmp
& FPA_PCR_EM_UOM
) printf_unfiltered(" UOM");
202 if (pcr_tmp
& FPA_PCR_EM_PM
) printf_unfiltered(" PM");
203 if (pcr_tmp
& FPA_PCR_EM_UM
) printf_unfiltered(" UM");
204 if (pcr_tmp
& FPA_PCR_EM_OM
) printf_unfiltered(" OM");
205 if (pcr_tmp
& FPA_PCR_EM_ZM
) printf_unfiltered(" ZM");
206 if (pcr_tmp
& FPA_PCR_EM_IM
) printf_unfiltered(" IM");
207 printf_unfiltered("\n");
208 pcr_tmp
= FPA_PCR_CC
;
209 printf_unfiltered("\tCC= %#x", pcr_tmp
);
210 if (pcr_tmp
& FPA_PCR_20MHZ
) printf_unfiltered(" 20MHZ");
211 if (pcr_tmp
& FPA_PCR_CC_Z
) printf_unfiltered(" Z");
212 if (pcr_tmp
& FPA_PCR_CC_C2
) printf_unfiltered(" C2");
214 /* Dynix defines FPA_PCR_CC_C0 to 0x100 and ptx defines
215 FPA_PCR_CC_C1 to 0x100. Use whichever is defined and assume
216 the OS knows what it is doing. */
218 if (pcr_tmp
& FPA_PCR_CC_C1
) printf_unfiltered(" C1");
221 if (pcr_tmp
& FPA_PCR_CC_C1
) printf_unfiltered(" C0");
227 printf_unfiltered(" (Equal)");
235 printf_unfiltered(" (Less than)");
238 printf_unfiltered(" (Greater than)");
247 printf_unfiltered(" (Unordered)");
250 printf_unfiltered(" (Undefined)");
253 printf_unfiltered("\n");
254 pcr_tmp
= pcr
& FPA_PCR_AE
;
255 printf_unfiltered("\tAE= %#x", pcr_tmp
);
256 if (pcr_tmp
& FPA_PCR_AE_DE
) printf_unfiltered(" DE");
257 if (pcr_tmp
& FPA_PCR_AE_UOE
) printf_unfiltered(" UOE");
258 if (pcr_tmp
& FPA_PCR_AE_PE
) printf_unfiltered(" PE");
259 if (pcr_tmp
& FPA_PCR_AE_UE
) printf_unfiltered(" UE");
260 if (pcr_tmp
& FPA_PCR_AE_OE
) printf_unfiltered(" OE");
261 if (pcr_tmp
& FPA_PCR_AE_ZE
) printf_unfiltered(" ZE");
262 if (pcr_tmp
& FPA_PCR_AE_EE
) printf_unfiltered(" EE");
263 if (pcr_tmp
& FPA_PCR_AE_IE
) printf_unfiltered(" IE");
264 printf_unfiltered("\n");
267 print_1167_regs(regs
)
268 long regs
[FPA_NREGS
];
283 for (i
= 0; i
< FPA_NREGS
; i
++) {
285 printf_unfiltered("%%fp%d: raw= %#x, single= %f", i
+1, regs
[i
], xf
.f
);
287 printf_unfiltered("\n");
291 printf_unfiltered(", double= %f\n", xd
.d
);
301 printf_unfiltered("WTL 1167:");
302 if (ep
.pr_fpa
.fpa_pcr
!=0) {
303 printf_unfiltered("\n");
304 print_1167_control_word(ep
.pr_fpa
.fpa_pcr
);
305 print_1167_regs(ep
.pr_fpa
.fpa_regs
);
307 printf_unfiltered(" not in use.\n");
311 #if 0 /* disabled because it doesn't go through the target vector. */
314 char ubuf
[UPAGES
*NBPG
];
315 struct pt_regset regset
;
317 if (have_inferior_p())
319 PTRACE_READ_REGS (inferior_pid
, (PTRACE_ARG3_TYPE
) ®set
);
323 int corechan
= bfd_cache_lookup (core_bfd
);
324 if (lseek (corechan
, 0, 0) < 0)
326 perror ("seek on core file");
328 if (myread (corechan
, ubuf
, UPAGES
*NBPG
) < 0)
330 perror ("read on core file");
332 /* only interested in the floating point registers */
333 regset
.pr_fpu
= ((struct user
*) ubuf
)->u_fpusave
;
334 regset
.pr_fpa
= ((struct user
*) ubuf
)->u_fpasave
;
336 print_fpu_status(regset
);
337 print_fpa_status(regset
);
341 static volatile int got_sigchld
;
344 /* This will eventually be more interesting. */
346 sigchld_handler(signo
)
353 * Signals for which the default action does not cause the process
354 * to die. See <sys/signal.h> for where this came from (alas, we
355 * can't use those macros directly)
358 #define sigmask(s) (1 << ((s) - 1))
360 #define SIGNALS_DFL_SAFE sigmask(SIGSTOP) | sigmask(SIGTSTP) | \
361 sigmask(SIGTTIN) | sigmask(SIGTTOU) | sigmask(SIGCHLD) | \
362 sigmask(SIGCONT) | sigmask(SIGWINCH) | sigmask(SIGPWR) | \
363 sigmask(SIGURG) | sigmask(SIGPOLL)
367 * Thanks to XPT_MPDEBUGGER, we have to mange child_wait().
370 child_wait(pid
, status
)
372 struct target_waitstatus
*status
;
374 int save_errno
, rv
, xvaloff
, saoff
, sa_hand
;
378 /* Host signal number for a signal which the inferior terminates with, or
379 0 if it hasn't terminated due to a signal. */
380 static int death_by_signal
= 0;
381 #ifdef SVR4_SHARED_LIBS /* use this to distinguish ptx 2 vs ptx 4 */
387 set_sigint_trap(); /* Causes SIGINT to be passed on to the
395 while (got_sigchld
== 0) {
402 rv
= mptrace(XPT_STOPSTAT
, 0, (char *)&pt
, 0);
404 printf("XPT_STOPSTAT: errno %d\n", errno
); /* DEBUG */
410 if (pid
!= inferior_pid
) {
411 /* NOTE: the mystery fork in csh/tcsh needs to be ignored.
412 * We should not return new children for the initial run
413 * of a process until it has done the exec.
415 /* inferior probably forked; send it on its way */
416 rv
= mptrace(XPT_UNDEBUG
, pid
, 0, 0);
418 printf("child_wait: XPT_UNDEBUG: pid %d: %s\n", pid
,
419 safe_strerror(errno
));
423 /* FIXME: Do we deal with fork notification correctly? */
424 switch (pt
.ps_reason
) {
426 /* multi proc: treat like PTS_EXEC */
428 * Pretend this didn't happen, since gdb isn't set up
429 * to deal with stops on fork.
431 rv
= ptrace(PT_CONTSIG
, pid
, 1, 0);
433 printf("PTS_FORK: PT_CONTSIG: error %d\n", errno
);
438 * Pretend this is a SIGTRAP.
440 status
->kind
= TARGET_WAITKIND_STOPPED
;
441 status
->value
.sig
= TARGET_SIGNAL_TRAP
;
445 * Note: we stop before the exit actually occurs. Extract
446 * the exit code from the uarea. If we're stopped in the
447 * exit() system call, the exit code will be in
448 * u.u_ap[0]. An exit due to an uncaught signal will have
449 * something else in here, see the comment in the default:
450 * case, below. Finally,let the process exit.
454 status
->kind
= TARGET_WAITKIND_SIGNALED
;
455 status
->value
.sig
= target_signal_from_host (death_by_signal
);
459 xvaloff
= (unsigned long)&u
.u_ap
[0] - (unsigned long)&u
;
461 rv
= ptrace(PT_RUSER
, pid
, (char *)xvaloff
, 0);
462 status
->kind
= TARGET_WAITKIND_EXITED
;
463 status
->value
.integer
= rv
;
465 * addr & data to mptrace() don't matter here, since
466 * the process is already dead.
468 rv
= mptrace(XPT_UNDEBUG
, pid
, 0, 0);
470 printf("child_wait: PTS_EXIT: XPT_UNDEBUG: pid %d error %d\n", pid
,
474 case PTS_WATCHPT_HIT
:
475 fatal("PTS_WATCHPT_HIT\n");
478 /* stopped by signal */
479 status
->kind
= TARGET_WAITKIND_STOPPED
;
480 status
->value
.sig
= target_signal_from_host (pt
.ps_reason
);
483 if (0 == (SIGNALS_DFL_SAFE
& sigmask(pt
.ps_reason
))) {
486 /* else default action of signal is to die */
487 #ifdef SVR4_SHARED_LIBS
488 rv
= ptrace(PT_GET_PRSTATUS
, pid
, (char *)&pstatus
, 0);
490 error("child_wait: signal %d PT_GET_PRSTATUS: %s\n",
491 pt
.ps_reason
, safe_strerror(errno
));
492 if (pstatus
.pr_cursig
!= pt
.ps_reason
) {
493 printf("pstatus signal %d, pt signal %d\n",
494 pstatus
.pr_cursig
, pt
.ps_reason
);
496 sa_hand
= (int)pstatus
.pr_action
.sa_handler
;
498 saoff
= (unsigned long)&u
.u_sa
[0] - (unsigned long)&u
;
499 saoff
+= sizeof(struct sigaction
) * (pt
.ps_reason
- 1);
501 sa_hand
= ptrace(PT_RUSER
, pid
, (char *)saoff
, 0);
503 error("child_wait: signal %d: RUSER: %s\n",
504 pt
.ps_reason
, safe_strerror(errno
));
506 if ((int)SIG_DFL
== sa_hand
) {
507 /* we will be dying */
508 death_by_signal
= pt
.ps_reason
;
513 } while (pid
!= inferior_pid
); /* Some other child died or stopped */
520 /* This function simply calls ptrace with the given arguments.
521 It exists so that all calls to ptrace are isolated in this
522 machine-dependent file. */
524 call_ptrace (request
, pid
, addr
, data
)
526 PTRACE_ARG3_TYPE addr
;
529 return ptrace (request
, pid
, addr
, data
);
533 call_mptrace(request
, pid
, addr
, data
)
535 PTRACE_ARG3_TYPE addr
;
538 return mptrace(request
, pid
, addr
, data
);
541 #if defined (DEBUG_PTRACE)
542 /* For the rest of the file, use an extra level of indirection */
543 /* This lets us breakpoint usefully on call_ptrace. */
544 #define ptrace call_ptrace
545 #define mptrace call_mptrace
551 if (inferior_pid
== 0)
554 * Don't use PT_KILL, since the child will stop again with a PTS_EXIT.
555 * Just hit him with SIGKILL (so he stops) and detach.
557 kill (inferior_pid
, SIGKILL
);
559 target_mourn_inferior ();
562 /* Resume execution of the inferior process.
563 If STEP is nonzero, single-step it.
564 If SIGNAL is nonzero, give it that signal. */
567 child_resume (pid
, step
, signal
)
577 /* An address of (PTRACE_ARG3_TYPE)1 tells ptrace to continue from where
578 it was. (If GDB wanted it to start some other way, we have already
579 written a new PC value to the child.)
581 If this system does not support PT_SSTEP, a higher level function will
582 have called single_step() to transmute the step request into a
583 continue request (by setting breakpoints on all possible successor
584 instructions), so we don't have to worry about that here. */
587 ptrace (PT_SSTEP
, pid
, (PTRACE_ARG3_TYPE
) 1, signal
);
589 ptrace (PT_CONTSIG
, pid
, (PTRACE_ARG3_TYPE
) 1, signal
);
592 perror_with_name ("ptrace");
596 /* Start debugging the process whose number is PID. */
604 rv
= mptrace(XPT_DEBUG
, pid
, 0, 0);
606 error("mptrace(XPT_DEBUG): %s", safe_strerror(errno
));
608 rv
= mptrace(XPT_SIGNAL
, pid
, 0, SIGSTOP
);
610 error("mptrace(XPT_SIGNAL): %s", safe_strerror(errno
));
622 rv
= mptrace(XPT_UNDEBUG
, inferior_pid
, 1, signo
);
624 error("mptrace(XPT_UNDEBUG): %s", safe_strerror(errno
));
629 #endif /* ATTACH_DETACH */
631 /* Default the type of the ptrace transfer to int. */
632 #ifndef PTRACE_XFER_TYPE
633 #define PTRACE_XFER_TYPE int
637 /* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory
638 in the NEW_SUN_PTRACE case.
639 It ought to be straightforward. But it appears that writing did
640 not write the data that I specified. I cannot understand where
641 it got the data that it actually did write. */
643 /* Copy LEN bytes to or from inferior's memory starting at MEMADDR
644 to debugger memory starting at MYADDR. Copy to inferior if
647 Returns the length copied, which is either the LEN argument or zero.
648 This xfer function does not do partial moves, since child_ops
649 doesn't allow memory operations to cross below us in the target stack
653 child_xfer_memory (memaddr
, myaddr
, len
, write
, target
)
658 struct target_ops
*target
; /* ignored */
661 /* Round starting address down to longword boundary. */
662 register CORE_ADDR addr
= memaddr
& - sizeof (PTRACE_XFER_TYPE
);
663 /* Round ending address up; get number of longwords that makes. */
665 = (((memaddr
+ len
) - addr
) + sizeof (PTRACE_XFER_TYPE
) - 1)
666 / sizeof (PTRACE_XFER_TYPE
);
667 /* Allocate buffer of that many longwords. */
668 register PTRACE_XFER_TYPE
*buffer
669 = (PTRACE_XFER_TYPE
*) alloca (count
* sizeof (PTRACE_XFER_TYPE
));
673 /* Fill start and end extra bytes of buffer with existing memory data. */
675 if (addr
!= memaddr
|| len
< (int) sizeof (PTRACE_XFER_TYPE
)) {
676 /* Need part of initial word -- fetch it. */
677 buffer
[0] = ptrace (PT_RTEXT
, inferior_pid
, (PTRACE_ARG3_TYPE
) addr
,
681 if (count
> 1) /* FIXME, avoid if even boundary */
684 = ptrace (PT_RTEXT
, inferior_pid
,
686 (addr
+ (count
- 1) * sizeof (PTRACE_XFER_TYPE
))),
690 /* Copy data to be written over corresponding part of buffer */
692 memcpy ((char *) buffer
+ (memaddr
& (sizeof (PTRACE_XFER_TYPE
) - 1)),
696 /* Write the entire buffer. */
698 for (i
= 0; i
< count
; i
++, addr
+= sizeof (PTRACE_XFER_TYPE
))
701 ptrace (PT_WRITE_D
, inferior_pid
, (PTRACE_ARG3_TYPE
) addr
,
705 /* Using the appropriate one (I or D) is necessary for
706 Gould NP1, at least. */
708 ptrace (PT_WTEXT
, inferior_pid
, (PTRACE_ARG3_TYPE
) addr
,
717 /* Read all the longwords */
718 for (i
= 0; i
< count
; i
++, addr
+= sizeof (PTRACE_XFER_TYPE
))
721 buffer
[i
] = ptrace (PT_RTEXT
, inferior_pid
,
722 (PTRACE_ARG3_TYPE
) addr
, 0);
728 /* Copy appropriate bytes out of the buffer. */
730 (char *) buffer
+ (memaddr
& (sizeof (PTRACE_XFER_TYPE
) - 1)),
738 _initialize_symm_nat ()
741 * the MPDEBUGGER is necessary for process tree debugging and attach
742 * to work, but it alters the behavior of debugged processes, so other
743 * things (at least child_wait()) will have to change to accomodate
746 * Note that attach is not implemented in dynix 3, and not in ptx
747 * until version 2.1 of the OS.
751 struct sigaction sact
;
753 rv
= mptrace(XPT_MPDEBUGGER
, 0, 0, 0);
755 fatal("_initialize_symm_nat(): mptrace(XPT_MPDEBUGGER): %s",
756 safe_strerror(errno
));
760 * Under MPDEBUGGER, we get SIGCLHD when a traced process does
761 * anything of interest.
765 * Block SIGCHLD. We leave it blocked all the time, and then
766 * call sigsuspend() in child_wait() to wait for the child
767 * to do something. None of these ought to fail, but check anyway.
770 rv
= sigaddset(&set
, SIGCHLD
);
772 fatal("_initialize_symm_nat(): sigaddset(SIGCHLD): %s",
773 safe_strerror(errno
));
775 rv
= sigprocmask(SIG_BLOCK
, &set
, (sigset_t
*)NULL
);
777 fatal("_initialize_symm_nat(): sigprocmask(SIG_BLOCK): %s",
778 safe_strerror(errno
));
781 sact
.sa_handler
= sigchld_handler
;
782 sigemptyset(&sact
.sa_mask
);
783 sact
.sa_flags
= SA_NOCLDWAIT
; /* keep the zombies away */
784 rv
= sigaction(SIGCHLD
, &sact
, (struct sigaction
*)NULL
);
786 fatal("_initialize_symm_nat(): sigaction(SIGCHLD): %s",
787 safe_strerror(errno
));
This page took 0.104038 seconds and 5 git commands to generate.