Opened 11 years ago

Closed 11 years ago

#2773 closed bug (fixed)

Wrong SIG returned

Reported by: scottmc Owned by: bonefish
Priority: normal Milestone: R1
Component: - General Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

When building CMake we ran into some failed test cases. One of them was test processes. Here's a sample program that shows a difference between Haiku and Linux, that Bill Hoffman wrote up:

#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <sys/wait.h>

int main()
{
 int status;
 pid_t pid = fork();
 if(pid == 0) { *(int*)0 = 0; return 1; }
 while((waitpid(pid, &status, 0) < 0) && (errno == EINTR));
 if(WIFEXITED(status))
  {
   fprintf(stderr, "exited %d\n", (int)WEXITSTATUS(status));
  }
 else if(WIFSIGNALED(status) )
  {
   fprintf(stderr, "sig %d\n", (int)WTERMSIG(status));
 }
 return 0;
}
hoffman@hythloth:~$ ./a.out
sig 11
hoffman@hythloth:~$

That was on a linux box.  On Haiku it prints sig 9.

Adjust the summary as needed as I didn't know what to call this one.

Attachments (1)

beos-also-sig-11.png (45.7 KB ) - added by scottmc 11 years ago.
BeOS also shows sig 11 like linux

Download all attachments as: .zip

Change History (3)

by scottmc, 11 years ago

Attachment: beos-also-sig-11.png added

BeOS also shows sig 11 like linux

comment:1 by bonefish, 11 years ago

Owner: changed from axeld to bonefish
Status: newassigned

I didn't think anyone would care, so ATM we send a SIGKILL when a segment violation occurs and there's no SIGSEGV handler. Will change that later.

comment:2 by bonefish, 11 years ago

Resolution: fixed
Status: assignedclosed

Fixed in hrev27757.

Note: See TracTickets for help on using tickets.