Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: signals??



I wonder because a test sequence I have should throw a SIGSEGV but it actually throws a SIBGBUS.

What's your test case? If the address is not mapped into your VM space (like 0x80000000, probably), you'd get a SIGSEGV. If the address is mapped into your VM space, but the protection is such that you can't access it (like 0x0), then you'd get a SIGBUS. For example:

#include <stdlib.h>

int
main(int argc, char *argv[]) {
unsigned long addr = strtoul(argv[1], NULL, 0);
return (int)(*(int *) addr);
}

% ./a.out 0x80000000
Segmentation fault
% ./a.out 0
Bus error

matt.
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.

References: 
 >signals?? (From: Andreas Tobler <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.