This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: _REENT->_errno v. extern int errno


2005/12/6, Jeff Johnston <jjohnstn@redhat.com>:
...
> - Modify the reent functions to add a new scenario (__SINGLE_THREAD__
>    and __SYSCALLS_USE_ERRNO_H__).  You would have to set these flags
>    for arm and the new scenario would have to be documented in
>    libc/include/reent.h.  (In the case of __DYNAMIC_REENT__
>    described earlier, one would go with MISSING_SYSCALL_NAMES
>    since the _r routines aren't needed).
...

I put together a quick hack to pass the _xxx_r call through to the
_xxx system call transparently. I suppose if this were wrapped in a
	#if defined __SINGLE_THREAD__ &&
		defined __SYSCALLS_USE_ERRNO_H__
armour, this could potentially be the actual solution. It's
unfortunate that the reentrancy pointer is the first argument, and not
the last. If the reentrancy pointer were the last argument, the _xxx_r
functions could simply be aliases to the _xxx functions.

Cheers,
Shaun

#define reentrant_definition(f) \
int _ ## f ## _r(void *ptr, int arg0, int arg1, int arg2) \
{ \
	(void)ptr; \
	return _ ## f (arg0, arg1, arg2); \
}

reentrant_definition(close)
reentrant_definition(fstat)
reentrant_definition(getpid)
reentrant_definition(gettimeofday)
reentrant_definition(kill)
reentrant_definition(link)
reentrant_definition(lseek)
reentrant_definition(open)
reentrant_definition(read)
reentrant_definition(sbrk)
reentrant_definition(unlink)
reentrant_definition(write)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]