Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC)
- Fix for possible unset uid/gid in toproto
- Fix for default mtree style
- Update libelf
- Importing libexecinfo
- Resynchronize GCC, mpc, gmp, mpfr
- build.sh: Replace params with show-params.
This has been done as the make target has been renamed in the same
way, while a new target named params has been added. This new
target generates a file containing all the parameters, instead of
printing it on the console.
- Update test48 with new etc/services (Fix by Ben Gras <ben@minix3.org)
get getservbyport() out of the inner loop
Change-Id: Ie6ad5226fa2621ff9f0dee8782ea48f9443d2091
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
/* $NetBSD: consttime_bcmp.c,v 1.1 2012/08/30 12:16:49 drochner Exp $ */
|
||||
|
||||
#if !defined(_KERNEL) && !defined(_STANDALONE)
|
||||
#include <string.h>
|
||||
#define consttime_bcmp __consttime_bcmp
|
||||
#else
|
||||
#include <lib/libkern/libkern.h>
|
||||
#endif
|
||||
|
||||
int
|
||||
consttime_bcmp(const void *b1, const void *b2, size_t len)
|
||||
{
|
||||
const char *c1 = b1, *c2 = b2;
|
||||
int res = 0;
|
||||
|
||||
while (len --)
|
||||
res |= *c1++ ^ *c2++;
|
||||
return res;
|
||||
}
|
||||
32
common/lib/libc/string/consttime_memequal.c
Normal file
32
common/lib/libc/string/consttime_memequal.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/* $NetBSD: consttime_memequal.c,v 1.4 2013/08/28 19:31:14 riastradh Exp $ */
|
||||
|
||||
#if !defined(_KERNEL) && !defined(_STANDALONE)
|
||||
#include "namespace.h"
|
||||
#include <string.h>
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(consttime_memequal,_consttime_memequal)
|
||||
#endif
|
||||
#else
|
||||
#include <lib/libkern/libkern.h>
|
||||
#endif
|
||||
|
||||
int
|
||||
consttime_memequal(const void *b1, const void *b2, size_t len)
|
||||
{
|
||||
const char *c1 = b1, *c2 = b2;
|
||||
int res = 0;
|
||||
|
||||
while (len --)
|
||||
res |= *c1++ ^ *c2++;
|
||||
|
||||
/*
|
||||
* If the compiler for your favourite architecture generates a
|
||||
* conditional branch for `!res', it will be a data-dependent
|
||||
* branch, in which case this should be replaced by
|
||||
*
|
||||
* return (1 - (1 & ((res - 1) >> 8)));
|
||||
*
|
||||
* or rewritten in assembly.
|
||||
*/
|
||||
return !res;
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
/* $NetBSD: explicit_bzero.c,v 1.1 2012/08/30 12:16:49 drochner Exp $ */
|
||||
/* $NetBSD: explicit_memset.c,v 1.3 2013/08/28 17:47:07 riastradh Exp $ */
|
||||
|
||||
#if !defined(_KERNEL) && !defined(_STANDALONE)
|
||||
#include "namespace.h"
|
||||
#include <string.h>
|
||||
#define explicit_bzero __explicit_bzero
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(explicit_memset,_explicit_memset)
|
||||
#endif
|
||||
#define explicit_memset_impl __explicit_memset_impl
|
||||
#else
|
||||
#include <lib/libkern/libkern.h>
|
||||
@@ -14,9 +17,9 @@
|
||||
*/
|
||||
void *(* volatile explicit_memset_impl)(void *, int, size_t) = memset;
|
||||
|
||||
void
|
||||
explicit_bzero(void *b, size_t len)
|
||||
void *
|
||||
explicit_memset(void *b, int c, size_t len)
|
||||
{
|
||||
|
||||
(*explicit_memset_impl)(b, 0, len);
|
||||
return (*explicit_memset_impl)(b, c, len);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: strcmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $ */
|
||||
/* $NetBSD: strcmp.c,v 1.3 2013/07/01 20:51:59 joerg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
@@ -37,7 +37,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)strcmp.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: strcmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $");
|
||||
__RCSID("$NetBSD: strcmp.c,v 1.3 2013/07/01 20:51:59 joerg Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
@@ -48,6 +48,8 @@ __RCSID("$NetBSD: strcmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $");
|
||||
#include <lib/libkern/libkern.h>
|
||||
#endif
|
||||
|
||||
#undef strcmp
|
||||
|
||||
/*
|
||||
* Compare strings.
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: strlcat.c,v 1.3 2007/06/04 18:19:27 christos Exp $ */
|
||||
/* $NetBSD: strlcat.c,v 1.4 2013/01/23 07:57:27 matt Exp $ */
|
||||
/* $OpenBSD: strlcat.c,v 1.10 2003/04/12 21:56:39 millert Exp $ */
|
||||
|
||||
/*
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: strlcat.c,v 1.3 2007/06/04 18:19:27 christos Exp $");
|
||||
__RCSID("$NetBSD: strlcat.c,v 1.4 2013/01/23 07:57:27 matt Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#ifdef _LIBC
|
||||
@@ -55,6 +55,7 @@ __weak_alias(strlcat, _strlcat)
|
||||
size_t
|
||||
strlcat(char *dst, const char *src, size_t siz)
|
||||
{
|
||||
#if 1
|
||||
char *d = dst;
|
||||
const char *s = src;
|
||||
size_t n = siz;
|
||||
@@ -81,5 +82,20 @@ strlcat(char *dst, const char *src, size_t siz)
|
||||
*d = '\0';
|
||||
|
||||
return(dlen + (s - src)); /* count does not include NUL */
|
||||
#else
|
||||
_DIAGASSERT(dst != NULL);
|
||||
_DIAGASSERT(src != NULL);
|
||||
|
||||
/*
|
||||
* Find length of string in dst (maxing out at siz).
|
||||
*/
|
||||
size_t dlen = strnlen(dst, siz);
|
||||
|
||||
/*
|
||||
* Copy src into any remaining space in dst (truncating if needed).
|
||||
* Note strlcpy(dst, src, 0) returns strlen(src).
|
||||
*/
|
||||
return dlen + strlcpy(dst + dlen, src, siz - dlen);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user