Re: Pointer Testing
Re: Pointer Testing
- Subject: Re: Pointer Testing
- From: Jeff Jenkins <email@hidden>
- Date: Sat, 15 Feb 2003 14:02:20 -0800
On Saturday, February 15, 2003, at 09:07 AM, Brent Marykuca wrote:
On Friday, February 14, 2003, at 10:00 PM, Jeff Jenkins wrote:
I think you are asking a question that everyone who has ever used the
C
language would like to have a simple solution to. The answer is no,
there is nothing inherent in the language that does this.
Yes, I know that C itself has nothing to help, but surely the
information is available to the kernel. The virtual memory system must
maintain tables of valid/invalid address ranges and read/write
permissions for every task, so it's not inconceivable that such an API
could be made available. Win32, for example, has routines called
IsBadReadPtr(), IsBadWritePtr(), IsBadCodePtr() and IsBadStringPtr()
that do this.
Install a SIGSEGV handler if you don't want your process to quit.
Also, if these calls result in a dive into the kernel from user space,
you would have some serious performance issues to deal with. This
might be OK for an app, but doesn't sound very desirable in general.
-- jrj
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.