> >
> >uggh.. do you not know? did you not put it there?
> >
> No. I didnt put it there. I am writing a library function as follows:
> void log_string(char *in_str)
> {
> ..... open file, write string, close file
> ..... write '\0' to *in_str to clear the log msg if in data seg
> }
>
> I agree it's ugly, but it needs to be done for backward compatablity
> reasons.
>
> Under QNX I had a function _ispermitw(void *addr) to test write access.
>
short of adding a system call I can't think of a nice clean way to do it
.. I've got three methods all of which are ugly and slow !!
1. do the /proc/self/maps check - I suppose you could do this once and
cache the results and then just compare against them..probably the
fastest..
2. catch SIGSEGV and probably use setjmp/longjmp or something like that,
fast but horrible..
3. fork, waitpid if it exits normally cool.. if not it segfaulted don't
write it .. (sounds slow .. but might not be...)..
Dave.
> Regards,
>
> Andy
>
>
>
>
--
David Airlie, Software Engineer
http://www.skynet.ie/~airlied / [EMAIL PROTECTED]
pam_smb / Linux DecStation / Linux VAX / ILUG person
--
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug