Thomas Moestl t.moestl at
Tue Jan 13 09:41:40 PST 2004

On Tue, 2004/01/13 at 08:44:37 -0600, Jacques A. Vidrine wrote:
> While cleaning up libc warnings, I noticed the following while compiling
> on sparc64:
> .../libc/sparc64/sys/__sparc_utrap.c:114: warning: implicit declaration of function `__sys_write'
> .../libc/sparc64/sys/__sparc_utrap.c:124: warning: implicit declaration of function `__sys_kill'
> .../libc/sparc64/sys/__sparc_utrap.c:124: warning: implicit declaration of function `__sys_getpid'
> I'm not sure of the best way to resolve these.  It's not clear to me
> where these are defined, nor whether or not they could be replaced by
> calls to the usual stubs (_write, ...)--- I assume not.

We can enter the user trap handlers from anywhere, so we want to use
the syscalls directly. The single and double underscored versions are
weak references, and could be overridden from another library. libc_r
does this with _write() and __write(), for example, and using those
versions could lead to a deadlock when the trap happened while a
lock was already held by this thread.
__utrap_write() is only used to write fatal (or mostly fatal) error
messages, so failing to lock properly is preferable to not reporting
an error at all. Likewise, it is important that can reliably send
signals to the process to indicate errors, and there are no reasons
why wrapper versions would need to be used.
> So before I added function declarations for them to shut up the
> compiler, I thought I'd ask.
> (With these `fixed', I believe libc will be WARNS=2 clean on all
> platforms.)

Thanks for cleaning this up!

	- Thomas

Thomas Moestl <t.moestl at>
              <tmm at>
PGP fingerprint: 1C97 A604 2BD0 E492 51D0  9C0F 1FE6 4F1D 419C 776C

More information about the freebsd-sparc64 mailing list