summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2007-05-04 21:44:08 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2007-05-04 21:44:08 +0000
commitdf22bccbe4dda082a723358f43579297259d8caa (patch)
tree8ff1e7c09f70062538c9b7a46d7fdf804e72476d
parent9d56f7842b0b4f202ce5786f418e2b54823a32fa (diff)
remove strcpy and strcat from the kernel; they are dead and unused code.
(OpenBSD does not use strcat/strcpy in the kernel, if people do it in external modules they should update their code) ok deraadt@
-rw-r--r--sys/lib/libkern/arch/amd64/Makefile.inc4
-rw-r--r--sys/lib/libkern/arch/amd64/strcat.S65
-rw-r--r--sys/lib/libkern/arch/amd64/strcpy.S57
-rw-r--r--sys/lib/libkern/arch/i386/strcat.S67
-rw-r--r--sys/lib/libkern/arch/i386/strcpy.S57
-rw-r--r--sys/lib/libkern/arch/m68k/strcat.S58
-rw-r--r--sys/lib/libkern/arch/m68k/strcpy.S51
-rw-r--r--sys/lib/libkern/strcat.c55
-rw-r--r--sys/lib/libkern/strcpy.c54
-rw-r--r--sys/lib/libsa/stand.h3
10 files changed, 3 insertions, 468 deletions
diff --git a/sys/lib/libkern/arch/amd64/Makefile.inc b/sys/lib/libkern/arch/amd64/Makefile.inc
index ed61f7015e9..be83971422a 100644
--- a/sys/lib/libkern/arch/amd64/Makefile.inc
+++ b/sys/lib/libkern/arch/amd64/Makefile.inc
@@ -5,8 +5,8 @@ SRCS+= imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
bcmp.S bcopy.S bzero.S ffs.S \
memchr.S memcmp.S memcpy.S memmove.S memset.S \
ovbcopy.S \
- strcat.S strchr.S strcmp.S \
- strcpy.S strlcpy.c strlcat.c strlen.S \
+ strchr.S strcmp.S \
+ strlcpy.c strlcat.c strlen.S \
strncasecmp.c strncmp.c strncpy.c strrchr.S \
scanc.S skpc.S random.c
# bswap64.c strcasecmp.c strncasecmp.c \ strtoul.c \
diff --git a/sys/lib/libkern/arch/amd64/strcat.S b/sys/lib/libkern/arch/amd64/strcat.S
deleted file mode 100644
index 7dc71244312..00000000000
--- a/sys/lib/libkern/arch/amd64/strcat.S
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Public domain.
- * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com>
- */
-
-#include <machine/asm.h>
-
-#if defined(LIBC_SCCS)
- RCSID("$NetBSD: strcat.S,v 1.1 2001/06/19 00:22:47 fvdl Exp $")
-#endif
-
-/*
- * NOTE: I've unrolled the loop eight times: large enough to make a
- * significant difference, and small enough not to totally trash the
- * cache.
- */
-
-ENTRY(strcat)
- movq %rdi,%r11
-
- cld /* set search forward */
- xorl %eax,%eax /* set search for null terminator */
- movq $-1,%rcx /* set search for lots of characters */
- repne /* search! */
- scasb
-
- decq %rdi
-
-L1: movb (%rsi),%al /* unroll loop, but not too much */
- movb %al,(%rdi)
- testb %al,%al
- jz L2
- movb 1(%rsi),%al
- movb %al,1(%rdi)
- testb %al,%al
- jz L2
- movb 2(%rsi),%al
- movb %al,2(%rdi)
- testb %al,%al
- jz L2
- movb 3(%rsi),%al
- movb %al,3(%rdi)
- testb %al,%al
- jz L2
- movb 4(%rsi),%al
- movb %al,4(%rdi)
- testb %al,%al
- jz L2
- movb 5(%rsi),%al
- movb %al,5(%rdi)
- testb %al,%al
- jz L2
- movb 6(%rsi),%al
- movb %al,6(%rdi)
- testb %al,%al
- jz L2
- movb 7(%rsi),%al
- movb %al,7(%rdi)
- addq $8,%rsi
- addq $8,%rdi
- testb %al,%al
- jnz L1
-L2: movq %r11,%rax
- ret
diff --git a/sys/lib/libkern/arch/amd64/strcpy.S b/sys/lib/libkern/arch/amd64/strcpy.S
deleted file mode 100644
index 924dfffd5be..00000000000
--- a/sys/lib/libkern/arch/amd64/strcpy.S
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Public domain.
- * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com>
- */
-
-#include <machine/asm.h>
-
-#if defined(LIBC_SCCS)
- RCSID("$NetBSD: strcpy.S,v 1.1 2001/06/19 00:22:47 fvdl Exp $")
-#endif
-
-/*
- * NOTE: I've unrolled the loop eight times: large enough to make a
- * significant difference, and small enough not to totally trash the
- * cache.
- */
-
-ENTRY(strcpy)
- movq %rdi,%r11
-
-L1: movb (%rsi),%al /* unroll loop, but not too much */
- movb %al,(%rdi)
- testb %al,%al
- jz L2
- movb 1(%rsi),%al
- movb %al,1(%rdi)
- testb %al,%al
- jz L2
- movb 2(%rsi),%al
- movb %al,2(%rdi)
- testb %al,%al
- jz L2
- movb 3(%rsi),%al
- movb %al,3(%rdi)
- testb %al,%al
- jz L2
- movb 4(%rsi),%al
- movb %al,4(%rdi)
- testb %al,%al
- jz L2
- movb 5(%rsi),%al
- movb %al,5(%rdi)
- testb %al,%al
- jz L2
- movb 6(%rsi),%al
- movb %al,6(%rdi)
- testb %al,%al
- jz L2
- movb 7(%rsi),%al
- movb %al,7(%rdi)
- addq $8,%rsi
- addq $8,%rdi
- testb %al,%al
- jnz L1
-L2: movq %r11,%rax
- ret
diff --git a/sys/lib/libkern/arch/i386/strcat.S b/sys/lib/libkern/arch/i386/strcat.S
deleted file mode 100644
index bbf19431fd8..00000000000
--- a/sys/lib/libkern/arch/i386/strcat.S
+++ /dev/null
@@ -1,67 +0,0 @@
-/* $OpenBSD: strcat.S,v 1.2 1996/09/27 06:47:49 mickey Exp $ */
-
-/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Public domain.
- */
-
-#include <machine/asm.h>
-
-/*
- * NOTE: I've unrolled the loop eight times: large enough to make a
- * significant difference, and small enough not to totally trash the
- * cache.
- */
-
-ENTRY(strcat)
- pushl %edi /* save edi */
- movl 8(%esp),%edi /* dst address */
- movl 12(%esp),%edx /* src address */
- pushl %edi /* push destination address */
-
- cld /* set search forward */
- xorl %eax,%eax /* set search for null terminator */
- movl $-1,%ecx /* set search for lots of characters */
- repne /* search! */
- scasb
-
- leal -1(%edi),%ecx /* correct dst address */
-
- .align 2,0x90
-L1: movb (%edx),%al /* unroll loop, but not too much */
- movb %al,(%ecx)
- testb %al,%al
- jz L2
- movb 1(%edx),%al
- movb %al,1(%ecx)
- testb %al,%al
- jz L2
- movb 2(%edx),%al
- movb %al,2(%ecx)
- testb %al,%al
- jz L2
- movb 3(%edx),%al
- movb %al,3(%ecx)
- testb %al,%al
- jz L2
- movb 4(%edx),%al
- movb %al,4(%ecx)
- testb %al,%al
- jz L2
- movb 5(%edx),%al
- movb %al,5(%ecx)
- testb %al,%al
- jz L2
- movb 6(%edx),%al
- movb %al,6(%ecx)
- testb %al,%al
- jz L2
- movb 7(%edx),%al
- movb %al,7(%ecx)
- addl $8,%edx
- addl $8,%ecx
- testb %al,%al
- jnz L1
-L2: popl %eax /* pop destination address */
- popl %edi /* restore edi */
- ret
diff --git a/sys/lib/libkern/arch/i386/strcpy.S b/sys/lib/libkern/arch/i386/strcpy.S
deleted file mode 100644
index bbf7f295404..00000000000
--- a/sys/lib/libkern/arch/i386/strcpy.S
+++ /dev/null
@@ -1,57 +0,0 @@
-/* $OpenBSD: strcpy.S,v 1.2 1996/09/27 06:47:50 mickey Exp $ */
-
-/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Public domain.
- */
-
-#include <machine/asm.h>
-
-/*
- * NOTE: I've unrolled the loop eight times: large enough to make a
- * significant difference, and small enough not to totally trash the
- * cache.
- */
-
-ENTRY(strcpy)
- movl 4(%esp),%ecx /* dst address */
- movl 8(%esp),%edx /* src address */
- pushl %ecx /* push dst address */
-
- .align 2,0x90
-L1: movb (%edx),%al /* unroll loop, but not too much */
- movb %al,(%ecx)
- testb %al,%al
- jz L2
- movb 1(%edx),%al
- movb %al,1(%ecx)
- testb %al,%al
- jz L2
- movb 2(%edx),%al
- movb %al,2(%ecx)
- testb %al,%al
- jz L2
- movb 3(%edx),%al
- movb %al,3(%ecx)
- testb %al,%al
- jz L2
- movb 4(%edx),%al
- movb %al,4(%ecx)
- testb %al,%al
- jz L2
- movb 5(%edx),%al
- movb %al,5(%ecx)
- testb %al,%al
- jz L2
- movb 6(%edx),%al
- movb %al,6(%ecx)
- testb %al,%al
- jz L2
- movb 7(%edx),%al
- movb %al,7(%ecx)
- addl $8,%edx
- addl $8,%ecx
- testb %al,%al
- jnz L1
-L2: popl %eax /* pop dst address */
- ret
diff --git a/sys/lib/libkern/arch/m68k/strcat.S b/sys/lib/libkern/arch/m68k/strcat.S
deleted file mode 100644
index 9efa50420f0..00000000000
--- a/sys/lib/libkern/arch/m68k/strcat.S
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $OpenBSD: strcat.S,v 1.3 2003/06/02 23:28:08 millert Exp $ */
-/* $NetBSD: strcat.S,v 1.1 1996/04/18 01:53:06 cgd 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"
-
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
- RCSID("from: @(#)strcpy.s 5.1 (Berkeley) 5/12/90")
-#else
- RCSID("$OpenBSD: strcat.S,v 1.3 2003/06/02 23:28:08 millert Exp $")
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-ENTRY(strcat)
- movl sp@(8),a0 | a0 = fromaddr
- movl sp@(4),d0 | return value is toaddr
- movl d0,a1 | a1 = toaddr
-slloop:
- tstb a1@+ | null?
- bne slloop | no, keep going
- subql #1,a1
-scloop:
- movb a0@+,a1@+ | copy a byte
- bne scloop | copied non-null, keep going
- rts
diff --git a/sys/lib/libkern/arch/m68k/strcpy.S b/sys/lib/libkern/arch/m68k/strcpy.S
deleted file mode 100644
index beabba8ef01..00000000000
--- a/sys/lib/libkern/arch/m68k/strcpy.S
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $OpenBSD: strcpy.S,v 1.3 2003/06/02 23:28:08 millert 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
- .text
- /*.asciz "from: @(#)strcpy.s 5.1 (Berkeley) 5/12/90"*/
- .asciz "$OpenBSD: strcpy.S,v 1.3 2003/06/02 23:28:08 millert Exp $"
-#endif /* LIBC_SCCS and not lint */
-
-#include "DEFS.h"
-
-ENTRY(strcpy)
- movl sp@(8),a0 | a0 = fromaddr
- movl sp@(4),d0 | return value is toaddr
- movl d0,a1 | a1 = toaddr
-scloop:
- movb a0@+,a1@+ | copy a byte
- bne scloop | copied non-null, keep going
- rts
diff --git a/sys/lib/libkern/strcat.c b/sys/lib/libkern/strcat.c
deleted file mode 100644
index 7d058e9e68f..00000000000
--- a/sys/lib/libkern/strcat.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $OpenBSD: strcat.c,v 1.9 2004/11/28 07:23:41 mickey Exp $ */
-
-/*
- * Copyright (c) 1988 Regents of the University of California.
- * All rights reserved.
- *
- * 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: strcat.c,v 1.9 2004/11/28 07:23:41 mickey Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#if !defined(_KERNEL) && !defined(_STANDALONE)
-#include <string.h>
-#else
-#include <lib/libkern/libkern.h>
-#endif
-
-#if defined(APIWARN)
-__warn_references(strcat,
- "warning: strcat() is almost always misused, please use strlcat()");
-#endif
-
-char *
-strcat(char *s, const char *append)
-{
- char *save = s;
-
- for (; *s; ++s);
- while ((*s++ = *append++) != '\0');
- return(save);
-}
diff --git a/sys/lib/libkern/strcpy.c b/sys/lib/libkern/strcpy.c
deleted file mode 100644
index 8ff5dcbbae2..00000000000
--- a/sys/lib/libkern/strcpy.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* $OpenBSD: strcpy.c,v 1.9 2004/11/28 07:23:41 mickey Exp $ */
-
-/*
- * Copyright (c) 1988 Regents of the University of California.
- * All rights reserved.
- *
- * 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: strcpy.c,v 1.9 2004/11/28 07:23:41 mickey Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#if !defined(_KERNEL) && !defined(_STANDALONE)
-#include <string.h>
-#else
-#include <lib/libkern/libkern.h>
-#endif
-
-#if defined(APIWARN)
-__warn_references(strcpy,
- "warning: strcpy() is almost always misused, please use strlcpy()");
-#endif
-
-char *
-strcpy(char *to, const char *from)
-{
- char *save = to;
-
- for (; (*to = *from) != '\0'; ++from, ++to);
- return(save);
-}
diff --git a/sys/lib/libsa/stand.h b/sys/lib/libsa/stand.h
index c054d2753bb..29dfbaf0db1 100644
--- a/sys/lib/libsa/stand.h
+++ b/sys/lib/libsa/stand.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: stand.h,v 1.45 2006/09/18 21:12:57 mpf Exp $ */
+/* $OpenBSD: stand.h,v 1.46 2007/05/04 21:44:07 reyk Exp $ */
/* $NetBSD: stand.h,v 1.18 1996/11/30 04:35:51 gwr Exp $ */
/*-
@@ -147,7 +147,6 @@ __dead void _rtt(void) __attribute__((noreturn));
void *memcpy(void *, const void *, size_t);
int memcmp(const void *, const void *, size_t);
char *strncpy(char *, const char *, size_t);
-char *strcpy(char *, const char *);
int strncmp(const char *, const char *, size_t);
int strcmp(const char *, const char *);
size_t strlen(const char *);