Index | Thread | Search

From:
Mark Kettenis <mark.kettenis@xs4all.nl>
Subject:
Re: Cruft: drop htonl() etc. from libc
To:
Christian Weisgerber <naddy@mips.inka.de>
Cc:
tech@openbsd.org
Date:
Fri, 12 Apr 2024 07:17:09 +0200

Download raw body.

Thread
> Date: Fri, 12 Apr 2024 01:21:41 +0200
> From: Christian Weisgerber <naddy@mips.inka.de>
> 
> Userland code compiled in a normal fashion picks up the htonl(),
> htons(), ntohl(), ntohs() inline functions from endian.h.
> 
> The implementations in libc are effectively unused.  We can drop
> the MD functions.  I chose to keep the MI functions on the off
> chance that something looks for the symbols in libc or plays games
> with "#undef htonl", but I changed them so they now also pick up
> the implementation from endian.h.

There are all kinds of subtleties with inline functions, but in
general you'll need to provide a non-inline implementation as well in
case someone tries to take the address of the function.

> This passed a release build on amd64.
> 
> No symbol changes.  aarch64 and arm have this:
> /usr/lib/libc.so.99.0 --> obj/libc.so.99.0
> Dynamic export changes:
> strengthened:
>         htonl
>         htons
>         ntohl
>         ntohs
> 
> Comments?  OK?
> 
> 
> diffstat refs/heads/master refs/heads/hton
>  M  lib/libc/arch/aarch64/gen/byte_swap_2.S   |  0+   6-
>  M  lib/libc/arch/aarch64/gen/byte_swap_4.S   |  0+   6-
>  D  lib/libc/arch/aarch64/net/Makefile.inc    |  0+   5-
>  D  lib/libc/arch/alpha/net/Makefile.inc      |  0+   4-
>  D  lib/libc/arch/alpha/net/byte_swap_2.S     |  0+  48-
>  D  lib/libc/arch/alpha/net/byte_swap_4.S     |  0+  54-
>  D  lib/libc/arch/alpha/net/htonl.S           |  0+  33-
>  D  lib/libc/arch/alpha/net/htons.S           |  0+  33-
>  D  lib/libc/arch/alpha/net/ntohl.S           |  0+  33-
>  D  lib/libc/arch/alpha/net/ntohs.S           |  0+  33-
>  D  lib/libc/arch/amd64/net/Makefile.inc      |  0+   3-
>  D  lib/libc/arch/amd64/net/htonl.S           |  0+  13-
>  D  lib/libc/arch/amd64/net/htons.S           |  0+  13-
>  D  lib/libc/arch/amd64/net/ntohl.S           |  0+  13-
>  D  lib/libc/arch/amd64/net/ntohs.S           |  0+  13-
>  M  lib/libc/arch/arm/gen/byte_swap_2.S       |  0+   6-
>  M  lib/libc/arch/arm/gen/byte_swap_4.S       |  0+   6-
>  D  lib/libc/arch/arm/net/Makefile.inc        |  0+   5-
>  D  lib/libc/arch/hppa/net/Makefile.inc       |  0+   3-
>  D  lib/libc/arch/i386/net/Makefile.inc       |  0+   3-
>  D  lib/libc/arch/i386/net/htonl.S            |  0+  41-
>  D  lib/libc/arch/i386/net/htons.S            |  0+  39-
>  D  lib/libc/arch/i386/net/ntohl.S            |  0+  41-
>  D  lib/libc/arch/i386/net/ntohs.S            |  0+  39-
>  D  lib/libc/arch/m88k/net/Makefile.inc       |  0+   3-
>  D  lib/libc/arch/m88k/net/htonl.S            |  0+  42-
>  D  lib/libc/arch/m88k/net/htons.S            |  0+  43-
>  D  lib/libc/arch/m88k/net/ntohl.S            |  0+  42-
>  D  lib/libc/arch/m88k/net/ntohs.S            |  0+  43-
>  D  lib/libc/arch/mips64/net/Makefile.inc     |  0+   3-
>  D  lib/libc/arch/mips64/net/htonl.S          |  0+  60-
>  D  lib/libc/arch/mips64/net/htons.S          |  0+  56-
>  D  lib/libc/arch/powerpc/net/Makefile.inc    |  0+   1-
>  D  lib/libc/arch/powerpc64/net/Makefile.inc  |  0+   1-
>  D  lib/libc/arch/riscv64/net/Makefile.inc    |  0+   1-
>  D  lib/libc/arch/sh/net/Makefile.inc         |  0+   4-
>  D  lib/libc/arch/sh/net/htonl.c              |  0+  58-
>  D  lib/libc/arch/sh/net/htons.c              |  0+  52-
>  D  lib/libc/arch/sh/net/ntohl.c              |  0+  58-
>  D  lib/libc/arch/sh/net/ntohs.c              |  0+  52-
>  D  lib/libc/arch/sparc64/net/Makefile.inc    |  0+   3-
>  D  lib/libc/arch/sparc64/net/htonl.S         |  0+  45-
>  D  lib/libc/arch/sparc64/net/htons.S         |  0+  45-
>  D  lib/libc/arch/sparc64/net/ntohl.S         |  0+  43-
>  D  lib/libc/arch/sparc64/net/ntohs.S         |  0+  48-
>  M  lib/libc/net/Makefile.inc                 |  4+   9-
>  M  lib/libc/net/htonl.c                      |  1+   7-
>  M  lib/libc/net/htons.c                      |  1+   7-
>  M  lib/libc/net/ntohl.c                      |  1+   7-
>  M  lib/libc/net/ntohs.c                      |  1+   7-
> 
> 50 files changed, 8 insertions(+), 1233 deletions(-)
> 
> diff refs/heads/master refs/heads/hton
> commit - 4733ced31b52279ffbbb7a95a03079ab09f79d05
> commit + d97c94c3e9da4601edf4de1219f87b32d4bd221e
> blob - 306b40c0e3b6b9729b50ef7fdecafb1cf3d8a66f
> blob + 1ca15676a229e04e44fb897a91df43e45f6f76a5
> --- lib/libc/arch/aarch64/gen/byte_swap_2.S
> +++ lib/libc/arch/aarch64/gen/byte_swap_2.S
> @@ -33,16 +33,10 @@
>  #include "DEFS.h"
>  
>  _ENTRY(__bswap16)
> -_ENTRY_NB(ntohs)
> -ENTRY_NB(htons)
>  	RETGUARD_SETUP(__bswap16, x15)
>  	and     w8, w0, #0xffff
>          ubfx    w0, w0, #8, #8
>  	bfi     w0, w8, #8, #16
>  	RETGUARD_CHECK(__bswap16, x15)
>  	ret
> -END(htons)
> -_END(ntohs)
>  _END(__bswap16)
> -	.weak	htons
> -	.weak	ntohs
> blob - 4d285b87c8676d24194fbd07b8d2872d64cbaf19
> blob + 3b555baaee5eb111abb4125d94b2d26000b0c1a8
> --- lib/libc/arch/aarch64/gen/byte_swap_4.S
> +++ lib/libc/arch/aarch64/gen/byte_swap_4.S
> @@ -33,14 +33,8 @@
>  #include "DEFS.h"
>  
>  _ENTRY(__bswap32)
> -_ENTRY_NB(ntohl)
> -ENTRY_NB(htonl)
>  	RETGUARD_SETUP(__bswap32, x15)
>  	rev	w0, w0
>  	RETGUARD_CHECK(__bswap32, x15)
>  	ret
> -END(htonl)
> -_END(ntohl)
>  _END(__bswap32)
> -	.weak	htonl
> -	.weak	ntohl
> blob - f88d6126c4ecc9c1b32313ee76b72444c712d75d (mode 644)
> blob + /dev/null
> --- lib/libc/arch/aarch64/net/Makefile.inc
> +++ /dev/null
> @@ -1,5 +0,0 @@
> -# $OpenBSD: Makefile.inc,v 1.1 2017/01/11 18:09:24 patrick Exp $
> -# $NetBSD: Makefile.inc,v 1.1 2000/12/29 20:13:53 bjh21 Exp $
> -
> -# hton* and nto* functions provided by ../gen/byte_swap_*.S
> -SRCS+= 
> blob - c3becef9618925b3665ebdfdf23ba45e0bce3d80 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/alpha/net/Makefile.inc
> +++ /dev/null
> @@ -1,4 +0,0 @@
> -#	$OpenBSD: Makefile.inc,v 1.4 1996/11/13 22:05:02 niklas Exp $
> -#	$NetBSD: Makefile.inc,v 1.2 1996/04/17 22:36:42 cgd Exp $
> -
> -SRCS+=  htonl.S htons.S ntohl.S ntohs.S
> blob - 6a509642d6fe978afd7386d2a1563083c8c57107 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/alpha/net/byte_swap_2.S
> +++ /dev/null
> @@ -1,48 +0,0 @@
> -/*	$OpenBSD: byte_swap_2.S,v 1.4 2009/10/28 06:49:54 deraadt Exp $	*/
> -/*	$NetBSD: byte_swap_2.S,v 1.2 1996/10/17 03:08:08 cgd Exp $	*/
> -
> -/*
> - * Copyright (c) 1996 Carnegie-Mellon University.
> - * All rights reserved.
> - *
> - * Author: Chris G. Demetriou
> - *
> - * Permission to use, copy, modify and distribute this software and
> - * its documentation is hereby granted, provided that both the copyright
> - * notice and this permission notice appear in all copies of the
> - * software, derivative works or modified versions, and any portions
> - * thereof, and that both notices appear in supporting documentation.
> - *
> - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
> - * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
> - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
> - *
> - * Carnegie Mellon requests users of this software to return to
> - *
> - *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
> - *  School of Computer Science
> - *  Carnegie Mellon University
> - *  Pittsburgh PA 15213-3890
> - *
> - * any improvements or extensions that they make and grant Carnegie the
> - * rights to redistribute these changes.
> - */
> -
> -#include <machine/asm.h>
> -
> -#ifndef NAME
> -#define	NAME byte_swap_2
> -#endif
> -
> -/*
> - * Byte-swap a 2-byte quantity.  (Convert 0x0123 to 0x2301.)
> - *
> - * Argument is an unsigned 2-byte integer (u_int16_t).
> - */
> -LEAF(NAME, 1)			/* a0 contains 0x0123 */
> -	extbl	a0, 0, t0	/* t0 = 0x  23 */
> -	extbl	a0, 1, t1	/* t1 = 0x  01 */
> -	sll	t0, 8, t0	/* t1 = 0x23   */
> -	or	t0, t1, v0	/* v0 = 0x2301 */
> -	RET
> -END(NAME)
> blob - 3d10a1b828af88ae9cc30443fc36faa0ac5351ff (mode 644)
> blob + /dev/null
> --- lib/libc/arch/alpha/net/byte_swap_4.S
> +++ /dev/null
> @@ -1,54 +0,0 @@
> -/*	$OpenBSD: byte_swap_4.S,v 1.4 2009/10/28 06:49:54 deraadt Exp $	*/
> -/*	$NetBSD: byte_swap_4.S,v 1.2 1996/10/17 03:08:09 cgd Exp $	*/
> -
> -/*
> - * Copyright (c) 1996 Carnegie-Mellon University.
> - * All rights reserved.
> - *
> - * Author: Chris G. Demetriou
> - *
> - * Permission to use, copy, modify and distribute this software and
> - * its documentation is hereby granted, provided that both the copyright
> - * notice and this permission notice appear in all copies of the
> - * software, derivative works or modified versions, and any portions
> - * thereof, and that both notices appear in supporting documentation.
> - *
> - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
> - * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
> - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
> - *
> - * Carnegie Mellon requests users of this software to return to
> - *
> - *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
> - *  School of Computer Science
> - *  Carnegie Mellon University
> - *  Pittsburgh PA 15213-3890
> - *
> - * any improvements or extensions that they make and grant Carnegie the
> - * rights to redistribute these changes.
> - */
> -
> -#include <machine/asm.h>
> -
> -#ifndef NAME
> -#define	NAME byte_swap_4
> -#endif
> -
> -/*
> - * Byte-swap a 4-byte quantity.  (Convert 0x01234567 to 0x67452301.)
> - *
> - * Argument is an unsigned 4-byte integer (u_int32_t).
> - */
> -LEAF(NAME, 1)			/* a0 contains 0x01234567 */
> -	extbl	a0, 0, t0	/* t0 = 0x      67 */
> -	extbl	a0, 1, t1	/* t1 = 0x      45 */
> -	extbl	a0, 2, t2	/* t2 = 0x      23 */
> -	extbl	a0, 3, t3	/* t3 = 0x      01 */
> -	sll	t0, 24, t0	/* t0 = 0x67       */
> -	sll	t1, 16, t1	/* t1 = 0x  45     */
> -	sll	t2, 8, t2	/* t2 = 0x    23   */
> -	or	t3, t0, v0	/* v0 = 0x67    01 */
> -	or	t1, t2, t1	/* t1 = 0x  4523   */
> -	or	t1, v0, v0	/* v0 = 0x67452301 */
> -	RET
> -END(NAME)
> blob - 22db4560bb49eec84017094eeaf950e04b54ee33 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/alpha/net/htonl.S
> +++ /dev/null
> @@ -1,33 +0,0 @@
> -/*	$OpenBSD: htonl.S,v 1.4 2009/10/28 06:49:54 deraadt Exp $	*/
> -/*	$NetBSD: htonl.S,v 1.1 1996/04/17 22:36:52 cgd Exp $	*/
> -
> -/*
> - * Copyright (c) 1996 Carnegie-Mellon University.
> - * All rights reserved.
> - *
> - * Author: Chris G. Demetriou
> - *
> - * Permission to use, copy, modify and distribute this software and
> - * its documentation is hereby granted, provided that both the copyright
> - * notice and this permission notice appear in all copies of the
> - * software, derivative works or modified versions, and any portions
> - * thereof, and that both notices appear in supporting documentation.
> - *
> - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
> - * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
> - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
> - *
> - * Carnegie Mellon requests users of this software to return to
> - *
> - *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
> - *  School of Computer Science
> - *  Carnegie Mellon University
> - *  Pittsburgh PA 15213-3890
> - *
> - * any improvements or extensions that they make and grant Carnegie the
> - * rights to redistribute these changes.
> - */
> -
> -#define	NAME	htonl
> -
> -#include "byte_swap_4.S"
> blob - a8074a157ba76e50767b40fa02fcb95ad3213693 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/alpha/net/htons.S
> +++ /dev/null
> @@ -1,33 +0,0 @@
> -/*	$OpenBSD: htons.S,v 1.4 2009/10/28 06:49:54 deraadt Exp $	*/
> -/*	$NetBSD: htons.S,v 1.1 1996/04/17 22:36:54 cgd Exp $	*/
> -
> -/*
> - * Copyright (c) 1996 Carnegie-Mellon University.
> - * All rights reserved.
> - *
> - * Author: Chris G. Demetriou
> - *
> - * Permission to use, copy, modify and distribute this software and
> - * its documentation is hereby granted, provided that both the copyright
> - * notice and this permission notice appear in all copies of the
> - * software, derivative works or modified versions, and any portions
> - * thereof, and that both notices appear in supporting documentation.
> - *
> - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
> - * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
> - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
> - *
> - * Carnegie Mellon requests users of this software to return to
> - *
> - *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
> - *  School of Computer Science
> - *  Carnegie Mellon University
> - *  Pittsburgh PA 15213-3890
> - *
> - * any improvements or extensions that they make and grant Carnegie the
> - * rights to redistribute these changes.
> - */
> -
> -#define	NAME	htons
> -
> -#include "byte_swap_2.S"
> blob - 14a87f640400c523c5cdf303fda32f75cb7f4774 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/alpha/net/ntohl.S
> +++ /dev/null
> @@ -1,33 +0,0 @@
> -/*	$OpenBSD: ntohl.S,v 1.4 2009/10/28 06:49:54 deraadt Exp $	*/
> -/*	$NetBSD: ntohl.S,v 1.1 1996/04/17 22:36:57 cgd Exp $	*/
> -
> -/*
> - * Copyright (c) 1996 Carnegie-Mellon University.
> - * All rights reserved.
> - *
> - * Author: Chris G. Demetriou
> - *
> - * Permission to use, copy, modify and distribute this software and
> - * its documentation is hereby granted, provided that both the copyright
> - * notice and this permission notice appear in all copies of the
> - * software, derivative works or modified versions, and any portions
> - * thereof, and that both notices appear in supporting documentation.
> - *
> - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
> - * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
> - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
> - *
> - * Carnegie Mellon requests users of this software to return to
> - *
> - *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
> - *  School of Computer Science
> - *  Carnegie Mellon University
> - *  Pittsburgh PA 15213-3890
> - *
> - * any improvements or extensions that they make and grant Carnegie the
> - * rights to redistribute these changes.
> - */
> -
> -#define	NAME	ntohl
> -
> -#include "byte_swap_4.S"
> blob - 376aeb73c3a8c891505f4c7858b0169e911d74b9 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/alpha/net/ntohs.S
> +++ /dev/null
> @@ -1,33 +0,0 @@
> -/*	$OpenBSD: ntohs.S,v 1.4 2009/10/28 06:49:54 deraadt Exp $	*/
> -/*	$NetBSD: ntohs.S,v 1.1 1996/04/17 22:37:02 cgd Exp $	*/
> -
> -/*
> - * Copyright (c) 1996 Carnegie-Mellon University.
> - * All rights reserved.
> - *
> - * Author: Chris G. Demetriou
> - *
> - * Permission to use, copy, modify and distribute this software and
> - * its documentation is hereby granted, provided that both the copyright
> - * notice and this permission notice appear in all copies of the
> - * software, derivative works or modified versions, and any portions
> - * thereof, and that both notices appear in supporting documentation.
> - *
> - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
> - * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
> - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
> - *
> - * Carnegie Mellon requests users of this software to return to
> - *
> - *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
> - *  School of Computer Science
> - *  Carnegie Mellon University
> - *  Pittsburgh PA 15213-3890
> - *
> - * any improvements or extensions that they make and grant Carnegie the
> - * rights to redistribute these changes.
> - */
> -
> -#define	NAME	ntohs
> -
> -#include "byte_swap_2.S"
> blob - 8adcf1267d0a47df37a6cdf3fc7570bb414fdb53 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/amd64/net/Makefile.inc
> +++ /dev/null
> @@ -1,3 +0,0 @@
> -#	$OpenBSD: Makefile.inc,v 1.2 2012/09/04 03:10:42 okan Exp $
> -
> -SRCS+=  htonl.S htons.S ntohl.S ntohs.S
> blob - 2895aa4e612e70117b99d5d733579e5f054cb8b7 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/amd64/net/htonl.S
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -/*	$OpenBSD: htonl.S,v 1.3 2018/07/03 23:14:05 mortimer Exp $	*/
> -
> -/* Written by Artur Grabowski. Public Domain */
> -
> -#include <machine/asm.h>
> -
> -ENTRY(htonl)
> -	RETGUARD_SETUP(htonl, r11)
> -	movl    %edi,%eax
> -	bswapl  %eax
> -	RETGUARD_CHECK(htonl, r11)
> -	ret
> -END(htonl)
> blob - 51a268d4e4eea5e1f177e1e7f8cfd386944deb46 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/amd64/net/htons.S
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -/*	$OpenBSD: htons.S,v 1.4 2018/07/03 23:14:05 mortimer Exp $	*/
> -
> -/* Written by Artur Grabowski. Public Domain */
> -
> -#include <machine/asm.h>
> -
> -ENTRY(htons)
> -	RETGUARD_SETUP(htons, r11)
> -	movl    %edi,%eax
> -	xchgb   %ah,%al
> -	RETGUARD_CHECK(htons, r11)
> -	ret
> -END(htons)
> blob - cd4c34cc492052837047bfbe1c5d8b175b0bd360 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/amd64/net/ntohl.S
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -/*	$OpenBSD: ntohl.S,v 1.4 2018/07/03 23:14:05 mortimer Exp $	*/
> -
> -/* Written by Artur Grabowski. Public Domain */
> -
> -#include <machine/asm.h>
> -
> -ENTRY(ntohl)
> -	RETGUARD_SETUP(ntohl, r11)
> -	movl    %edi,%eax
> -	bswapl  %eax
> -	RETGUARD_CHECK(ntohl, r11)
> -	ret
> -END(ntohl)
> blob - c5d740fd64ced7b92e6aa2a21e36f3fc0adadd89 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/amd64/net/ntohs.S
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -/*	$OpenBSD: ntohs.S,v 1.4 2018/07/03 23:14:05 mortimer Exp $	*/
> -
> -/* Written by Artur Grabowski. Public Domain */
> -
> -#include <machine/asm.h>
> -
> -ENTRY(ntohs)
> -	RETGUARD_SETUP(ntohs, r11)
> -	movl    %edi,%eax
> -	xchgb   %ah,%al
> -	RETGUARD_CHECK(ntohs, r11)
> -	ret
> -END(ntohs)
> blob - 3429741ed9eb11d76b61956593f173c1a3ef3677
> blob + ac4e78b14b543f904c18a2a738c23f31ec7e7507
> --- lib/libc/arch/arm/gen/byte_swap_2.S
> +++ lib/libc/arch/arm/gen/byte_swap_2.S
> @@ -33,14 +33,8 @@
>  #include "DEFS.h"
>  
>  _ENTRY(__bswap16)
> -_ENTRY_NB(ntohs)
> -ENTRY_NB(htons)
>  	and		r1, r0, #0xff
>  	mov		r0, r0, lsr #8
>  	orr		r0, r0, r1, lsl #8
>  	mov		pc, lr  
> -END(htons)
> -_END(ntohs)
>  _END(__bswap16)
> -	.weak	htons
> -	.weak	ntohs
> blob - 408e95448ae66fe23767b3e25c94249877acbe2d
> blob + 82f037452a4f3f52ce94801d4aab208039257492
> --- lib/libc/arch/arm/gen/byte_swap_4.S
> +++ lib/libc/arch/arm/gen/byte_swap_4.S
> @@ -33,15 +33,9 @@
>  #include "DEFS.h"
>  
>  _ENTRY(__bswap32)
> -_ENTRY_NB(ntohl)
> -ENTRY_NB(htonl)
>  	eor		r1, r0, r0, ror #16
>  	bic		r1, r1, #0x00FF0000
>  	mov		r0, r0, ror #8
>  	eor		r0, r0, r1, lsr #8
>  	mov		pc, lr
> -END(htonl)
> -_END(ntohl)
>  _END(__bswap32)
> -	.weak	htonl
> -	.weak	ntohl
> blob - 0a10862171bdb91225ce4605b7f57635995c0b1c (mode 644)
> blob + /dev/null
> --- lib/libc/arch/arm/net/Makefile.inc
> +++ /dev/null
> @@ -1,5 +0,0 @@
> -# $OpenBSD: Makefile.inc,v 1.2 2004/02/01 05:40:52 drahn Exp $
> -# $NetBSD: Makefile.inc,v 1.1 2000/12/29 20:13:53 bjh21 Exp $
> -
> -# hton* and nto* functions provided by ../gen/byte_swap_*.S
> -SRCS+= 
> blob - 597df911f24220474ed5843cac5ff7e6f7598f74 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/hppa/net/Makefile.inc
> +++ /dev/null
> @@ -1,3 +0,0 @@
> -#	$OpenBSD: Makefile.inc,v 1.2 2004/10/26 04:49:58 mickey Exp $
> -
> -SRCS+=	ntohl.c ntohs.c htons.c htonl.c
> blob - 80584144bcc468c0cc7163e0b7a44b0270cfd9f3 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/i386/net/Makefile.inc
> +++ /dev/null
> @@ -1,3 +0,0 @@
> -#	$OpenBSD: Makefile.inc,v 1.4 2012/09/04 03:10:42 okan Exp $
> -
> -SRCS+=  htonl.S htons.S ntohl.S ntohs.S
> blob - 02dee68072b6968acf1de24c5639ae27d7015a06 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/i386/net/htonl.S
> +++ /dev/null
> @@ -1,41 +0,0 @@
> -/*-
> - * Copyright (c) 1990 The Regents of the University of California.
> - * All rights reserved.
> - *
> - * This code is derived from software contributed to Berkeley by
> - * William Jolitz.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - * 1. Redistributions of source code must retain the above copyright
> - *    notice, this list of conditions and the following disclaimer.
> - * 2. Redistributions in binary form must reproduce the above copyright
> - *    notice, this list of conditions and the following disclaimer in the
> - *    documentation and/or other materials provided with the distribution.
> - * 3. Neither the name of the University nor the names of its contributors
> - *    may be used to endorse or promote products derived from this software
> - *    without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
> - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - */
> -
> -#include <machine/asm.h>
> -
> -/* netorder = htonl(hostorder) */
> -ENTRY(htonl)
> -	movl	4(%esp),%eax
> -	rorw	$8,%ax
> -	roll	$16,%eax
> -	rorw	$8,%ax
> -	ret
> blob - 20c516253bfc86c8a9dac09c376693a0a211714e (mode 644)
> blob + /dev/null
> --- lib/libc/arch/i386/net/htons.S
> +++ /dev/null
> @@ -1,39 +0,0 @@
> -/*-
> - * Copyright (c) 1990 The Regents of the University of California.
> - * All rights reserved.
> - *
> - * This code is derived from software contributed to Berkeley by
> - * William Jolitz.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - * 1. Redistributions of source code must retain the above copyright
> - *    notice, this list of conditions and the following disclaimer.
> - * 2. Redistributions in binary form must reproduce the above copyright
> - *    notice, this list of conditions and the following disclaimer in the
> - *    documentation and/or other materials provided with the distribution.
> - * 3. Neither the name of the University nor the names of its contributors
> - *    may be used to endorse or promote products derived from this software
> - *    without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
> - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - */
> -
> -#include <machine/asm.h>
> -
> -/* netorder = htons(hostorder) */
> -ENTRY(htons)
> -	movzwl	4(%esp),%eax
> -	rorw	$8,%ax
> -	ret
> blob - 7b5a45067d8738d23102c43739ede4d34b8856db (mode 644)
> blob + /dev/null
> --- lib/libc/arch/i386/net/ntohl.S
> +++ /dev/null
> @@ -1,41 +0,0 @@
> -/*-
> - * Copyright (c) 1990 The Regents of the University of California.
> - * All rights reserved.
> - *
> - * This code is derived from software contributed to Berkeley by
> - * William Jolitz.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - * 1. Redistributions of source code must retain the above copyright
> - *    notice, this list of conditions and the following disclaimer.
> - * 2. Redistributions in binary form must reproduce the above copyright
> - *    notice, this list of conditions and the following disclaimer in the
> - *    documentation and/or other materials provided with the distribution.
> - * 3. Neither the name of the University nor the names of its contributors
> - *    may be used to endorse or promote products derived from this software
> - *    without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
> - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - */
> -
> -#include <machine/asm.h>
> -
> -/* hostorder = ntohl(netorder) */
> -ENTRY(ntohl)
> -	movl	4(%esp),%eax
> -	rorw	$8,%ax
> -	roll	$16,%eax
> -	rorw	$8,%ax
> -	ret
> blob - b6dd406b5f530c6fce8dc0c0a2ceda28a9bb2af6 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/i386/net/ntohs.S
> +++ /dev/null
> @@ -1,39 +0,0 @@
> -/*-
> - * Copyright (c) 1990 The Regents of the University of California.
> - * All rights reserved.
> - *
> - * This code is derived from software contributed to Berkeley by
> - * William Jolitz.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - * 1. Redistributions of source code must retain the above copyright
> - *    notice, this list of conditions and the following disclaimer.
> - * 2. Redistributions in binary form must reproduce the above copyright
> - *    notice, this list of conditions and the following disclaimer in the
> - *    documentation and/or other materials provided with the distribution.
> - * 3. Neither the name of the University nor the names of its contributors
> - *    may be used to endorse or promote products derived from this software
> - *    without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
> - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - */
> -
> -#include <machine/asm.h>
> -
> -/* hostorder = ntohs(netorder) */
> -ENTRY(ntohs)
> -	movzwl	4(%esp),%eax
> -	rorw	$8,%ax
> -	ret
> blob - dc2ddf344cca2c44d8c677141f925c00798d1a2a (mode 644)
> blob + /dev/null
> --- lib/libc/arch/m88k/net/Makefile.inc
> +++ /dev/null
> @@ -1,3 +0,0 @@
> -#	$NetBSD: Makefile.inc,v 1.1 1995/02/25 14:58:55 cgd Exp $
> -
> -SRCS+=  htonl.S htons.S ntohl.S ntohs.S
> blob - be6ca8d9d3a9133ab2f81b3b5108585053860c2c (mode 644)
> blob + /dev/null
> --- lib/libc/arch/m88k/net/htonl.S
> +++ /dev/null
> @@ -1,42 +0,0 @@
> -/*	$OpenBSD: htonl.S,v 1.7 2013/01/11 21:23:24 miod Exp $	*/
> -
> -/*-
> - * Copyright (c) 1990 The Regents of the University of California.
> - * All rights reserved.
> - *
> - * This code is derived from software contributed to Berkeley by
> - * the Systems Programming Group of the University of Utah Computer
> - * Science Department.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - * 1. Redistributions of source code must retain the above copyright
> - *    notice, this list of conditions and the following disclaimer.
> - * 2. Redistributions in binary form must reproduce the above copyright
> - *    notice, this list of conditions and the following disclaimer in the
> - *    documentation and/or other materials provided with the distribution.
> - * 3. Neither the name of the University nor the names of its contributors
> - *    may be used to endorse or promote products derived from this software
> - *    without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
> - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - */
> -
> -#include "DEFS.h"
> -
> -/* netorder = htonl(hostorder) */
> -
> -ENTRY(htonl)
> -	jmp	%r1
> -END(htonl)
> blob - 02bad3e12b26bd6a44f79399174ce0f6c0926f33 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/m88k/net/htons.S
> +++ /dev/null
> @@ -1,43 +0,0 @@
> -/*	$OpenBSD: htons.S,v 1.7 2013/01/11 21:23:24 miod Exp $	*/
> -
> -/*-
> - * Copyright (c) 1990 The Regents of the University of California.
> - * All rights reserved.
> - *
> - * This code is derived from software contributed to Berkeley by
> - * the Systems Programming Group of the University of Utah Computer
> - * Science Department.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - * 1. Redistributions of source code must retain the above copyright
> - *    notice, this list of conditions and the following disclaimer.
> - * 2. Redistributions in binary form must reproduce the above copyright
> - *    notice, this list of conditions and the following disclaimer in the
> - *    documentation and/or other materials provided with the distribution.
> - * 3. Neither the name of the University nor the names of its contributors
> - *    may be used to endorse or promote products derived from this software
> - *    without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
> - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - */
> -
> -#include "DEFS.h"
> -
> -/* hostorder = htons(netorder) */
> -
> -ENTRY(htons)
> -	jmp.n	%r1
> -	 clr	%r2,%r2,16<16> /* clear the top 16 bits */
> -END(htons)
> blob - 0df158020bde8b122cc63459b14385526b0ecbb4 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/m88k/net/ntohl.S
> +++ /dev/null
> @@ -1,42 +0,0 @@
> -/*	$OpenBSD: ntohl.S,v 1.7 2013/01/11 21:23:24 miod Exp $	*/
> -
> -/*-
> - * Copyright (c) 1990 The Regents of the University of California.
> - * All rights reserved.
> - *
> - * This code is derived from software contributed to Berkeley by
> - * the Systems Programming Group of the University of Utah Computer
> - * Science Department.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - * 1. Redistributions of source code must retain the above copyright
> - *    notice, this list of conditions and the following disclaimer.
> - * 2. Redistributions in binary form must reproduce the above copyright
> - *    notice, this list of conditions and the following disclaimer in the
> - *    documentation and/or other materials provided with the distribution.
> - * 3. Neither the name of the University nor the names of its contributors
> - *    may be used to endorse or promote products derived from this software
> - *    without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
> - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - */
> -
> -#include "DEFS.h"
> -
> -/* hostorder = ntohl(netorder) */
> -
> -ENTRY(ntohl)
> -	jmp	%r1
> -END(ntohl)
> blob - 63dd922e8190bff3c7bef87d36b0df635e34f2ed (mode 644)
> blob + /dev/null
> --- lib/libc/arch/m88k/net/ntohs.S
> +++ /dev/null
> @@ -1,43 +0,0 @@
> -/*	$OpenBSD: ntohs.S,v 1.7 2013/01/11 21:23:24 miod Exp $	*/
> -
> -/*-
> - * Copyright (c) 1990 The Regents of the University of California.
> - * All rights reserved.
> - *
> - * This code is derived from software contributed to Berkeley by
> - * the Systems Programming Group of the University of Utah Computer
> - * Science Department.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - * 1. Redistributions of source code must retain the above copyright
> - *    notice, this list of conditions and the following disclaimer.
> - * 2. Redistributions in binary form must reproduce the above copyright
> - *    notice, this list of conditions and the following disclaimer in the
> - *    documentation and/or other materials provided with the distribution.
> - * 3. Neither the name of the University nor the names of its contributors
> - *    may be used to endorse or promote products derived from this software
> - *    without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
> - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - */
> -
> -#include "DEFS.h"
> -
> -/* hostorder = ntohs(netorder) */
> -
> -ENTRY(ntohs)
> -	jmp.n	%r1
> -	 clr	%r2,%r2,16<16>	/* clear the top 16 bits */
> -END(ntohs)
> blob - 6e3a837c949392903690d80f29165e58edcf88c9 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/mips64/net/Makefile.inc
> +++ /dev/null
> @@ -1,3 +0,0 @@
> -#	$OpenBSD: Makefile.inc,v 1.2 2012/09/04 03:10:42 okan Exp $
> -
> -SRCS+=  htonl.S htons.S
> blob - 22a1d35ca8613b54dcfe0a3308075142e91edc2c (mode 644)
> blob + /dev/null
> --- lib/libc/arch/mips64/net/htonl.S
> +++ /dev/null
> @@ -1,60 +0,0 @@
> -/*-
> - * Copyright (c) 1991, 1993
> - *	The Regents of the University of California.  All rights reserved.
> - *
> - * This code is derived from software contributed to Berkeley by
> - * Ralph Campbell.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - * 1. Redistributions of source code must retain the above copyright
> - *    notice, this list of conditions and the following disclaimer.
> - * 2. Redistributions in binary form must reproduce the above copyright
> - *    notice, this list of conditions and the following disclaimer in the
> - *    documentation and/or other materials provided with the distribution.
> - * 3. Neither the name of the University nor the names of its contributors
> - *    may be used to endorse or promote products derived from this software
> - *    without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
> - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - */
> -
> -#include <machine/asm.h>
> -
> -/*
> - * netorder = htonl(hostorder)
> - * hostorder = ntohl(netorder)
> - */
> -ALEAF(ntohl)
> -NLEAF(htonl, 0)				# a0 = 0x11223344, return 0x44332211
> -	.set	reorder
> -#ifdef __MIPSEL__
> -	srl	v1, a0, 24		# v1 = 0x00000011
> -	sll	v0, a0, 24		# v0 = 0x44000000
> -	or	v0, v0, v1
> -	and	v1, a0, 0xff00
> -	sll	v1, v1, 8		# v1 = 0x00330000
> -	or	v0, v0, v1
> -	srl	v1, a0, 8
> -	and	v1, v1, 0xff00		# v1 = 0x00002200
> -	or	v0, v0, v1
> -#else
> -#ifdef __MIPSEB__
> -	move	v0, a0
> -#else
> -	ERROR
> -#endif
> -#endif
> -	j	ra
> -END(htonl)
> blob - c936aae033823914a068a592787e9c2af18fc0be (mode 644)
> blob + /dev/null
> --- lib/libc/arch/mips64/net/htons.S
> +++ /dev/null
> @@ -1,56 +0,0 @@
> -/*-
> - * Copyright (c) 1991, 1993
> - *	The Regents of the University of California.  All rights reserved.
> - *
> - * This code is derived from software contributed to Berkeley by
> - * Ralph Campbell.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - * 1. Redistributions of source code must retain the above copyright
> - *    notice, this list of conditions and the following disclaimer.
> - * 2. Redistributions in binary form must reproduce the above copyright
> - *    notice, this list of conditions and the following disclaimer in the
> - *    documentation and/or other materials provided with the distribution.
> - * 3. Neither the name of the University nor the names of its contributors
> - *    may be used to endorse or promote products derived from this software
> - *    without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
> - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - */
> -
> -#include <machine/asm.h>
> -
> -/*
> - * netorder = htons(hostorder)
> - * hostorder = ntohs(netorder)
> - */
> -ALEAF(ntohs)
> -NLEAF(htons, 0)
> -	.set	reorder
> -#ifdef __MIPSEL__
> -	srl	v0, a0, 8
> -	and	v0, v0, 0xff
> -	sll	v1, a0, 8
> -	and	v1, v1, 0xff00
> -	or	v0, v0, v1
> -#else
> -#ifdef __MIPSEB__
> -	move	v0, a0
> -#else
> -	ERROR
> -#endif
> -#endif
> -	j	ra
> -END(htons)
> blob - 1b8cd45dafb0a8223457ebcfb8049c177ea050a3 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/powerpc/net/Makefile.inc
> +++ /dev/null
> @@ -1 +0,0 @@
> -SRCS += ntohl.c ntohs.c htons.c htonl.c
> blob - 1b8cd45dafb0a8223457ebcfb8049c177ea050a3 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/powerpc64/net/Makefile.inc
> +++ /dev/null
> @@ -1 +0,0 @@
> -SRCS += ntohl.c ntohs.c htons.c htonl.c
> blob - 1b8cd45dafb0a8223457ebcfb8049c177ea050a3 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/riscv64/net/Makefile.inc
> +++ /dev/null
> @@ -1 +0,0 @@
> -SRCS += ntohl.c ntohs.c htons.c htonl.c
> blob - 13bfad7c42fd9d7dc2ffc0d7d2fddc9eba8c09c0 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/sh/net/Makefile.inc
> +++ /dev/null
> @@ -1,4 +0,0 @@
> -#	$OpenBSD: Makefile.inc,v 1.1.1.1 2006/10/10 22:07:10 miod Exp $
> -#	$NetBSD: Makefile.inc,v 1.1 2000/01/05 14:07:36 msaitoh Exp $
> -
> -SRCS+=	htonl.c htons.c ntohl.c ntohs.c
> blob - a515606f67e9025c258829a82569be641679da90 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/sh/net/htonl.c
> +++ /dev/null
> @@ -1,58 +0,0 @@
> -/*	$OpenBSD: htonl.c,v 1.2 2014/07/21 01:51:10 guenther Exp $	*/
> -/*	$NetBSD: htonl.c,v 1.3 2005/12/24 23:10:08 perry Exp $	*/
> -
> -/*-
> - * Copyright (c) 1990 The Regents of the University of California.
> - * All rights reserved.
> - *
> - * This code is derived from software contributed to Berkeley by
> - * William Jolitz.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - * 1. Redistributions of source code must retain the above copyright
> - *    notice, this list of conditions and the following disclaimer.
> - * 2. Redistributions in binary form must reproduce the above copyright
> - *    notice, this list of conditions and the following disclaimer in the
> - *    documentation and/or other materials provided with the distribution.
> - * 3. Neither the name of the University nor the names of its contributors
> - *    may be used to endorse or promote products derived from this software
> - *    without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
> - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - *
> - *	from: @(#)htonl.s	5.2 (Berkeley) 12/17/90
> - */
> -
> -#include <sys/types.h>
> -#include <endian.h>
> -
> -#undef htonl
> -
> -/* hostorder = htonl(netorder) */
> -u_int32_t
> -htonl(x)
> -	u_int32_t x;
> -{
> -#if BYTE_ORDER == LITTLE_ENDIAN
> -	u_int32_t y = 0;
> -
> -	__asm("swap.b %1, %0" : "=r" (y) : "r" (x));
> -	__asm("swap.w %1, %0" : "=r" (y) : "r" (y));
> -	__asm("swap.b %1, %0" : "=r" (y) : "r" (y));
> -	return y;
> -#else
> -	return x;
> -#endif
> -}
> blob - 1d7a7de297c7387913d2fe5aaf80441a87a70dff (mode 644)
> blob + /dev/null
> --- lib/libc/arch/sh/net/htons.c
> +++ /dev/null
> @@ -1,52 +0,0 @@
> -/*	$OpenBSD: htons.c,v 1.2 2014/07/21 01:51:10 guenther Exp $	*/
> -/*	$NetBSD: htons.c,v 1.3 2005/12/24 23:10:08 perry Exp $	*/
> -
> -/*-
> - * Copyright (c) 1990 The Regents of the University of California.
> - * All rights reserved.
> - *
> - * This code is derived from software contributed to Berkeley by
> - * William Jolitz.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - * 1. Redistributions of source code must retain the above copyright
> - *    notice, this list of conditions and the following disclaimer.
> - * 2. Redistributions in binary form must reproduce the above copyright
> - *    notice, this list of conditions and the following disclaimer in the
> - *    documentation and/or other materials provided with the distribution.
> - * 3. Neither the name of the University nor the names of its contributors
> - *    may be used to endorse or promote products derived from this software
> - *    without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
> - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - *
> - *	from: @(#)htonl.s	5.2 (Berkeley) 12/17/90
> - */
> -
> -#include <sys/types.h>
> -#include <endian.h>
> -
> -#undef htons
> -
> -/* netorder = htons(hostorder) */
> -u_int16_t
> -htons(x)
> -	u_int16_t x;
> -{
> -#if BYTE_ORDER == LITTLE_ENDIAN
> -	__asm("swap.b %1, %0" : "=r" (x) :  "r" (x));
> -#endif
> -	return x;
> -}
> blob - 78ca2462f15b457680d121ab3be54f3ddf2650fa (mode 644)
> blob + /dev/null
> --- lib/libc/arch/sh/net/ntohl.c
> +++ /dev/null
> @@ -1,58 +0,0 @@
> -/*	$OpenBSD: ntohl.c,v 1.2 2014/07/21 01:51:10 guenther Exp $	*/
> -/*	$NetBSD: ntohl.c,v 1.3 2005/12/24 23:10:08 perry Exp $	*/
> -
> -/*-
> - * Copyright (c) 1990 The Regents of the University of California.
> - * All rights reserved.
> - *
> - * This code is derived from software contributed to Berkeley by
> - * William Jolitz.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - * 1. Redistributions of source code must retain the above copyright
> - *    notice, this list of conditions and the following disclaimer.
> - * 2. Redistributions in binary form must reproduce the above copyright
> - *    notice, this list of conditions and the following disclaimer in the
> - *    documentation and/or other materials provided with the distribution.
> - * 3. Neither the name of the University nor the names of its contributors
> - *    may be used to endorse or promote products derived from this software
> - *    without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
> - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - *
> - *	from: @(#)ntohl.s	5.2 (Berkeley) 12/17/90
> - */
> -
> -#include <sys/types.h>
> -#include <endian.h>
> -
> -#undef ntohl
> -
> -/* netorder = ntohl(hostorder) */
> -u_int32_t
> -ntohl(x)
> -	u_int32_t x;
> -{
> -#if BYTE_ORDER == LITTLE_ENDIAN
> -	u_int32_t y = 0;
> -
> -	__asm("swap.b %1, %0" : "=r" (y) : "r" (x));
> -	__asm("swap.w %1, %0" : "=r" (y) : "r" (y));
> -	__asm("swap.b %1, %0" : "=r" (y) : "r" (y));
> -	return y;
> -#else
> -	return x;
> -#endif
> -}
> blob - f57c8a90d575c942cdb3c1b124154a0af7f1354a (mode 644)
> blob + /dev/null
> --- lib/libc/arch/sh/net/ntohs.c
> +++ /dev/null
> @@ -1,52 +0,0 @@
> -/*	$OpenBSD: ntohs.c,v 1.2 2014/07/21 01:51:10 guenther Exp $	*/
> -/*	$NetBSD: ntohs.c,v 1.3 2005/12/24 23:10:08 perry Exp $	*/
> -
> -/*-
> - * Copyright (c) 1990 The Regents of the University of California.
> - * All rights reserved.
> - *
> - * This code is derived from software contributed to Berkeley by
> - * William Jolitz.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - * 1. Redistributions of source code must retain the above copyright
> - *    notice, this list of conditions and the following disclaimer.
> - * 2. Redistributions in binary form must reproduce the above copyright
> - *    notice, this list of conditions and the following disclaimer in the
> - *    documentation and/or other materials provided with the distribution.
> - * 3. Neither the name of the University nor the names of its contributors
> - *    may be used to endorse or promote products derived from this software
> - *    without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
> - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - *
> - *	from: @(#)ntohl.s	5.2 (Berkeley) 12/17/90
> - */
> -
> -#include <sys/types.h>
> -#include <endian.h>
> -
> -#undef ntohs
> -
> -/* hostorder = ntohs(netorder) */
> -u_int16_t
> -ntohs(x)
> -	u_int16_t x;
> -{
> -#if BYTE_ORDER == LITTLE_ENDIAN
> -	__asm("swap.b %1, %0" : "=r" (x) :  "r" (x));
> -#endif
> -	return x;
> -}
> blob - c6229ffbd2c19850ae83cbeac4a7fb512682a7df (mode 644)
> blob + /dev/null
> --- lib/libc/arch/sparc64/net/Makefile.inc
> +++ /dev/null
> @@ -1,3 +0,0 @@
> -#	$OpenBSD: Makefile.inc,v 1.1 2001/08/28 22:06:44 art Exp $
> -
> -SRCS+=  htonl.S htons.S ntohl.S ntohs.S
> blob - 10ffa2de22bf87722131a11556f3432b7151bec1 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/sparc64/net/htonl.S
> +++ /dev/null
> @@ -1,45 +0,0 @@
> -/*	$OpenBSD: htonl.S,v 1.2 2003/06/02 20:18:32 millert Exp $	*/
> -
> -/*
> - * Copyright (c) 1992, 1993
> - *	The Regents of the University of California.  All rights reserved.
> - *
> - * This software was developed by the Computer Systems Engineering group
> - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
> - * contributed to Berkeley.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - * 1. Redistributions of source code must retain the above copyright
> - *    notice, this list of conditions and the following disclaimer.
> - * 2. Redistributions in binary form must reproduce the above copyright
> - *    notice, this list of conditions and the following disclaimer in the
> - *    documentation and/or other materials provided with the distribution.
> - * 3. Neither the name of the University nor the names of its contributors
> - *    may be used to endorse or promote products derived from this software
> - *    without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
> - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - *
> - * from: Header: htonl.s,v 1.1 92/06/25 12:47:05 torek Exp
> - */
> -
> -#include <machine/asm.h>
> -
> -/* netorder = htonl(hostorder) */
> -
> -
> -ENTRY(htonl)
> -	retl
> -	 srl	%o0, 0, %o0	/* zero extend -- or do we sign extend? */
> blob - 334f090418ccb7f2a103deb7eeba068191cf603b (mode 644)
> blob + /dev/null
> --- lib/libc/arch/sparc64/net/htons.S
> +++ /dev/null
> @@ -1,45 +0,0 @@
> -/*	$OpenBSD: htons.S,v 1.2 2003/06/02 20:18:32 millert Exp $	*/
> -
> -/*
> - * Copyright (c) 1992, 1993
> - *	The Regents of the University of California.  All rights reserved.
> - *
> - * This software was developed by the Computer Systems Engineering group
> - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
> - * contributed to Berkeley.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - * 1. Redistributions of source code must retain the above copyright
> - *    notice, this list of conditions and the following disclaimer.
> - * 2. Redistributions in binary form must reproduce the above copyright
> - *    notice, this list of conditions and the following disclaimer in the
> - *    documentation and/or other materials provided with the distribution.
> - * 3. Neither the name of the University nor the names of its contributors
> - *    may be used to endorse or promote products derived from this software
> - *    without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
> - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - *
> - * from: Header: htons.s,v 1.1 92/06/25 12:47:05 torek Exp
> - */
> -
> -#include <machine/asm.h>
> -
> -/* netorder = htons(hostorder) */
> -ENTRY(htons)
> -	sethi	%hi(0xffff0000), %o1
> -	signx	%o1, %o1
> -	retl
> -	 andn	%o0, %o1, %o0
> blob - 9bc42b4ac5897f5edc96edde8a524dae1b37eaa6 (mode 644)
> blob + /dev/null
> --- lib/libc/arch/sparc64/net/ntohl.S
> +++ /dev/null
> @@ -1,43 +0,0 @@
> -/*	$OpenBSD: ntohl.S,v 1.2 2003/06/02 20:18:32 millert Exp $	*/
> -/*	$NetBSD: ntohl.S,v 1.1 1998/09/11 04:56:31 eeh Exp $	*/
> -/*
> - * Copyright (c) 1992, 1993
> - *	The Regents of the University of California.  All rights reserved.
> - *
> - * This software was developed by the Computer Systems Engineering group
> - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
> - * contributed to Berkeley.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - * 1. Redistributions of source code must retain the above copyright
> - *    notice, this list of conditions and the following disclaimer.
> - * 2. Redistributions in binary form must reproduce the above copyright
> - *    notice, this list of conditions and the following disclaimer in the
> - *    documentation and/or other materials provided with the distribution.
> - * 3. Neither the name of the University nor the names of its contributors
> - *    may be used to endorse or promote products derived from this software
> - *    without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
> - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - *
> - * from: Header: ntohl.s,v 1.1 92/06/25 12:47:06 torek Exp
> - */
> -
> -#include <machine/asm.h>
> -
> -/* hostorder = ntohl(netorder) */
> -ENTRY(ntohl)
> -	retl
> -	 signx	%o0, %o0
> blob - 7a9b18215d9ea183b1303b4c8730a57a8bf1407e (mode 644)
> blob + /dev/null
> --- lib/libc/arch/sparc64/net/ntohs.S
> +++ /dev/null
> @@ -1,48 +0,0 @@
> -/*	$OpenBSD: ntohs.S,v 1.3 2009/10/28 06:49:55 deraadt Exp $	*/
> -/*	$NetBSD: ntohs.S,v 1.1 1998/09/11 04:56:31 eeh Exp $	*/
> -
> -/*
> - * Copyright (c) 1992, 1993
> - *	The Regents of the University of California.  All rights reserved.
> - *
> - * This software was developed by the Computer Systems Engineering group
> - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
> - * contributed to Berkeley.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - * 1. Redistributions of source code must retain the above copyright
> - *    notice, this list of conditions and the following disclaimer.
> - * 2. Redistributions in binary form must reproduce the above copyright
> - *    notice, this list of conditions and the following disclaimer in the
> - *    documentation and/or other materials provided with the distribution.
> - * 3. Neither the name of the University nor the names of its contributors
> - *    may be used to endorse or promote products derived from this software
> - *    without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
> - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - *
> - * from: Header: ntohs.s,v 1.1 92/06/25 12:47:07 torek Exp
> - */
> -
> -#include <machine/asm.h>
> -
> -/* hostorder = ntohs(netorder) */
> -
> -ENTRY(ntohs)
> -	sethi	%hi(0xffff0000), %o1
> -	signx	%o1, %o1
> -	retl
> -	 andn	%o0, %o1, %o0
> -
> blob - 41a3164d6a95af2b5816be01f85df43776f5a5ff
> blob + b8ff0fb931a32a54c00fbade18b0e6d551047c23
> --- lib/libc/net/Makefile.inc
> +++ lib/libc/net/Makefile.inc
> @@ -1,7 +1,7 @@
>  #	$OpenBSD: Makefile.inc,v 1.60 2019/08/30 18:33:17 deraadt Exp $
>  
>  # net sources
> -.PATH: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/net ${LIBCSRCDIR}/net
> +.PATH: ${LIBCSRCDIR}/net
>  
>  CFLAGS+=-DRESOLVSORT
>  
> @@ -10,10 +10,11 @@ SRCS+=	base64.c ethers.c freeaddrinfo.c \
>  	getifaddrs.c getnameinfo.c getnetent.c \
>  	getnetnamadr.c getpeereid.c getproto.c getprotoent.c getprotoname.c \
>  	getservbyname.c getservbyport.c getservent.c getrrsetbyname.c \
> -	herror.c if_indextoname.c if_nameindex.c if_nametoindex.c inet_addr.c \
> +	herror.c htonl.c htons.c \
> +	if_indextoname.c if_nameindex.c if_nametoindex.c inet_addr.c \
>  	inet_lnaof.c inet_makeaddr.c inet_neta.c inet_netof.c inet_network.c \
>  	inet_net_ntop.c inet_net_pton.c inet_ntoa.c inet_ntop.c inet_pton.c \
> -	linkaddr.c rcmd.c rcmdsh.c ruserok.c \
> +	linkaddr.c ntohl.c ntohs.c rcmd.c rcmdsh.c ruserok.c \
>  	rresvport.c recv.c res_comp.c res_data.c \
>  	res_debug.c res_debug_syms.c res_init.c res_mkquery.c res_query.c \
>  	res_random.c res_send.c \
> @@ -22,12 +23,6 @@ SRCS+=	base64.c ethers.c freeaddrinfo.c \
>  # IPv6
>  SRCS+=	ip6opt.c rthdr.c vars6.c
>  
> -# machine-dependent net sources
> -# m-d Makefile.inc must include sources for:
> -#	htonl() htons() ntohl() ntohs()
> -
> -.include "${LIBCSRCDIR}/arch/${MACHINE_CPU}/net/Makefile.inc"
> -
>  MAN+=	htobe64.3 ether_aton.3 gai_strerror.3 getaddrinfo.3 gethostbyname.3 \
>  	getifaddrs.3 getnameinfo.3 getnetent.3 getpeereid.3 getprotoent.3 \
>  	getrrsetbyname.3 getservent.3 htonl.3 if_indextoname.3 \
> blob - 6ee6e7efbf38908a62438ae4860e913c8e38ae7d
> blob + 00d75af9d0f543f2436c26b1f5b89c336b377c4f
> --- lib/libc/net/htonl.c
> +++ lib/libc/net/htonl.c
> @@ -1,6 +1,5 @@
>  /*	$OpenBSD: htonl.c,v 1.7 2014/07/21 01:51:10 guenther Exp $ */
>  /*
> - * Written by J.T. Conklin <jtc@netbsd.org>.
>   * Public domain.
>   */
>  
> @@ -12,10 +11,5 @@
>  u_int32_t
>  htonl(u_int32_t x)
>  {
> -#if BYTE_ORDER == LITTLE_ENDIAN
> -	u_char *s = (u_char *)&x;
> -	return (u_int32_t)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]);
> -#else
> -	return x;
> -#endif
> +	return __htobe32(x);
>  }
> blob - f48d91ee0358d09486f356c927b2df7217652ab2
> blob + feaa7594172236f3fdd3c318d3456c94bb8ba9ea
> --- lib/libc/net/htons.c
> +++ lib/libc/net/htons.c
> @@ -1,6 +1,5 @@
>  /*	$OpenBSD: htons.c,v 1.9 2014/07/21 01:51:10 guenther Exp $ */
>  /*
> - * Written by J.T. Conklin <jtc@netbsd.org>.
>   * Public domain.
>   */
>  
> @@ -12,10 +11,5 @@
>  u_int16_t
>  htons(u_int16_t x)
>  {
> -#if BYTE_ORDER == LITTLE_ENDIAN
> -	u_char *s = (u_char *) &x;
> -	return (u_int16_t)(s[0] << 8 | s[1]);
> -#else
> -	return x;
> -#endif
> +	return __htobe16(x);
>  }
> blob - 0d05bac78a1c9ad61f7a7418022914c6704adfb4
> blob + a9b2c86f5ca31081bf66ca627122a96570846b2b
> --- lib/libc/net/ntohl.c
> +++ lib/libc/net/ntohl.c
> @@ -1,6 +1,5 @@
>  /*	$OpenBSD: ntohl.c,v 1.7 2014/07/21 01:51:10 guenther Exp $ */
>  /*
> - * Written by J.T. Conklin <jtc@netbsd.org>.
>   * Public domain.
>   */
>  
> @@ -12,10 +11,5 @@
>  u_int32_t
>  ntohl(u_int32_t x)
>  {
> -#if BYTE_ORDER == LITTLE_ENDIAN
> -	u_char *s = (u_char *)&x;
> -	return (u_int32_t)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]);
> -#else
> -	return x;
> -#endif
> +	return __htobe32(x);
>  }
> blob - b5ea361f8304c322f46bc564e0e74a9a135d69c4
> blob + 8a39f68a0ae5960d8ea4cbc046d157210985bad2
> --- lib/libc/net/ntohs.c
> +++ lib/libc/net/ntohs.c
> @@ -1,6 +1,5 @@
>  /*	$OpenBSD: ntohs.c,v 1.9 2014/07/21 01:51:10 guenther Exp $ */
>  /*
> - * Written by J.T. Conklin <jtc@netbsd.org>.
>   * Public domain.
>   */
>  
> @@ -12,10 +11,5 @@
>  u_int16_t
>  ntohs(u_int16_t x)
>  {
> -#if BYTE_ORDER == LITTLE_ENDIAN
> -	u_char *s = (u_char *) &x;
> -	return (u_int16_t)(s[0] << 8 | s[1]);
> -#else
> -	return x;
> -#endif
> +	return __htobe16(x);
>  }
> -- 
> Christian "naddy" Weisgerber                          naddy@mips.inka.de
> 
>