Subject: Re: ntoh{l,s}, hton{l,s} not in libc for ns32k, powerpc.
To: Phil Nelson <philnelson@home.com>
From: Simon Burge <simonb@wasabisystems.com>
List: tech-userlevel
Date: 09/21/2001 14:02:29
Phil Nelson wrote:

> >For the ns32k and powerpc architectures, there's no network byte order
> >functions in libc itself.  In fact, ns32k has a byte_swap_4.S and a
> 
> For the ns32k, you can see they are defined in a different way.
> 
> ---->~/netbsd/src/sys/arch/pc532/include
> shark[23]$ grep ntohl *.h
> endian_machdep.h:#define        ntohl(x)        __byte_swap_long(x)

Note that that only helps if <machine/endian_machdep.h> is included
(either directly or indirectly).  For a contrived example, you can't
have something like:

	int ntohl(int);

	int
	myntohl(int val)
	{
		return (ntohl(val));
	}

because there is no ntohl symbol in libc.a.  For ns32k, it looks as
simple as adding

	SRCS+= byte_swap_2.S byte_swap_4.S

to lib/libc/arch/ns32k/gen/Makefile.inc.

Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD CDs, Support and Service:    http://www.wasabisystems.com/