Libraries updates and cleanup
* Updating common/lib * Updating lib/csu * Updating lib/libc * Updating libexec/ld.elf_so * Corrected test on __minix in featuretest to actually follow the meaning of the comment. * Cleaned up _REENTRANT-related defintions. * Disabled -D_REENTRANT for libfetch * Removing some unneeded __NBSD_LIBC defines and tests Change-Id: Ic1394baef74d11b9f86b312f5ff4bbc3cbf72ce2
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/* $NetBSD: compat___semctl13.c,v 1.2 2009/01/11 02:46:26 christos Exp $ */
|
||||
/* $NetBSD: compat___semctl13.c,v 1.3 2011/01/31 22:51:39 christos Exp $ */
|
||||
|
||||
/* $NetBSD: compat___semctl13.c,v 1.2 2009/01/11 02:46:26 christos Exp $ */
|
||||
/* $NetBSD: compat___semctl13.c,v 1.3 2011/01/31 22:51:39 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
@@ -39,7 +39,7 @@
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: compat___semctl13.c,v 1.2 2009/01/11 02:46:26 christos Exp $");
|
||||
__RCSID("$NetBSD: compat___semctl13.c,v 1.3 2011/01/31 22:51:39 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "namespace.h"
|
||||
@@ -77,14 +77,25 @@ __semctl13(int semid, int semnum, int cmd, ...)
|
||||
#else
|
||||
semun = va_arg(ap, union __semun);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
ds13 = (struct semid_ds13 *)(void *)semun.buf;
|
||||
semun.buf = &ds;
|
||||
switch (cmd) {
|
||||
case IPC_SET:
|
||||
case IPC_STAT:
|
||||
ds13 = (void *)semun.buf;
|
||||
semun.buf = &ds;
|
||||
if (cmd == IPC_SET)
|
||||
__semid_ds13_to_native(ds13, &ds);
|
||||
break;
|
||||
default:
|
||||
ds13 = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (cmd == IPC_SET)
|
||||
__semid_ds13_to_native(ds13, &ds);
|
||||
|
||||
error = ____semctl50(semid, semnum, cmd, &semun);
|
||||
if (error)
|
||||
@@ -92,7 +103,5 @@ __semctl13(int semid, int semnum, int cmd, ...)
|
||||
|
||||
if (cmd == IPC_STAT)
|
||||
__native_to_semid_ds13(&ds, ds13);
|
||||
|
||||
semun.buf = (struct semid_ds *)(void *)ds13;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: compat_getdents.c,v 1.3 2008/04/28 20:22:59 martin Exp $ */
|
||||
/* $NetBSD: compat_getdents.c,v 1.6 2012/03/13 22:24:48 joerg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005 The NetBSD Foundation, Inc.
|
||||
@@ -31,14 +31,16 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: compat_getdents.c,v 1.3 2008/04/28 20:22:59 martin Exp $");
|
||||
__RCSID("$NetBSD: compat_getdents.c,v 1.6 2012/03/13 22:24:48 joerg Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/types.h>
|
||||
#include <assert.h>
|
||||
#include <dirent.h>
|
||||
#include <stddef.h>
|
||||
#include <compat/include/dirent.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -50,7 +52,9 @@ getdents(int fd, char *buf, size_t nbytes)
|
||||
{
|
||||
struct dirent *ndp, *nndp, *endp;
|
||||
struct dirent12 *odp;
|
||||
ino_t ino;
|
||||
int rv;
|
||||
size_t len;
|
||||
|
||||
if ((rv = __getdents30(fd, buf, nbytes)) == -1)
|
||||
return rv;
|
||||
@@ -67,7 +71,9 @@ getdents(int fd, char *buf, size_t nbytes)
|
||||
for (; ndp < endp; ndp = nndp) {
|
||||
nndp = _DIRENT_NEXT(ndp);
|
||||
/* XXX: avoid unaligned 64-bit access on sparc64 */
|
||||
odp->d_ino = ((u_int32_t *)(void *)&ndp->d_ino)[_QUAD_LOWWORD];
|
||||
/* XXX: does this work? */
|
||||
memcpy(&ino, &ndp->d_ino, sizeof(ino_t));
|
||||
odp->d_ino = (uint32_t)ino;
|
||||
if (ndp->d_namlen >= sizeof(odp->d_name))
|
||||
odp->d_namlen = sizeof(odp->d_name) - 1;
|
||||
else
|
||||
@@ -75,8 +81,12 @@ getdents(int fd, char *buf, size_t nbytes)
|
||||
odp->d_type = ndp->d_type;
|
||||
(void)memcpy(odp->d_name, ndp->d_name, (size_t)odp->d_namlen);
|
||||
odp->d_name[odp->d_namlen] = '\0';
|
||||
odp->d_reclen = _DIRENT_SIZE(odp);
|
||||
len = _DIRENT_SIZE(odp);
|
||||
_DIAGASSERT(__type_fit(uint16_t, len));
|
||||
odp->d_reclen = (uint16_t)len;
|
||||
odp = _DIRENT_NEXT(odp);
|
||||
}
|
||||
return ((char *)(void *)odp) - buf;
|
||||
ptrdiff_t td = (((char *)(void *)odp) - buf);
|
||||
_DIAGASSERT(__type_fit(int, td));
|
||||
return (int)td;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: compat_getdirentries.c,v 1.2 2009/02/22 06:33:38 dholland Exp $ */
|
||||
/* $NetBSD: compat_getdirentries.c,v 1.3 2012/03/20 17:06:00 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Frank van der Linden
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: compat_getdirentries.c,v 1.2 2009/02/22 06:33:38 dholland Exp $");
|
||||
__RCSID("$NetBSD: compat_getdirentries.c,v 1.3 2012/03/20 17:06:00 matt Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
@@ -48,10 +48,7 @@ __warn_references(getdirentries,
|
||||
"reference to compatibility-only getdirentries(); this will break; use getdents() or readdir() instead")
|
||||
|
||||
int
|
||||
getdirentries(fd, buf, nbytes, basep)
|
||||
int fd, nbytes;
|
||||
char *buf;
|
||||
long *basep;
|
||||
getdirentries(int fd, char *buf, int nbytes, long *basep)
|
||||
{
|
||||
*basep = (long)lseek(fd, (off_t)0, SEEK_CUR);
|
||||
return getdents(fd, buf, (size_t)nbytes);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: compat_msync.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
/* $NetBSD: compat_msync.c,v 1.2 2012/03/20 17:06:00 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Frank van der Linden
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: compat_msync.c,v 1.1 2005/09/13 01:44:09 christos Exp $");
|
||||
__RCSID("$NetBSD: compat_msync.c,v 1.2 2012/03/20 17:06:00 matt Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
@@ -46,9 +46,7 @@ __warn_references(msync,
|
||||
"warning: reference to compatibility msync(); include <sys/mman.h> for correct reference")
|
||||
|
||||
int
|
||||
msync(addr, size)
|
||||
void *addr;
|
||||
size_t size;
|
||||
msync(void *addr, size_t size)
|
||||
{
|
||||
return __msync13(addr, size, MS_SYNC|MS_INVALIDATE);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: compat_semctl.c,v 1.2 2009/01/11 02:46:26 christos Exp $ */
|
||||
/* $NetBSD: compat_semctl.c,v 1.3 2011/01/31 22:51:39 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Christopher G. Demetriou
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: compat_semctl.c,v 1.2 2009/01/11 02:46:26 christos Exp $");
|
||||
__RCSID("$NetBSD: compat_semctl.c,v 1.3 2011/01/31 22:51:39 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
@@ -53,7 +53,7 @@ semctl(int semid, int semnum, int cmd, ...)
|
||||
va_list ap;
|
||||
union __semun semun;
|
||||
struct semid_ds ds;
|
||||
struct semid_ds14 *ds14 = NULL;
|
||||
struct semid_ds14 *ds14;
|
||||
int error;
|
||||
|
||||
va_start(ap, cmd);
|
||||
@@ -68,27 +68,30 @@ semctl(int semid, int semnum, int cmd, ...)
|
||||
#else
|
||||
semun = va_arg(ap, union __semun);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
switch (cmd) {
|
||||
case IPC_SET:
|
||||
case IPC_STAT:
|
||||
ds14 = (struct semid_ds14 *)(void *)semun.buf;
|
||||
ds14 = (void *)semun.buf;
|
||||
if (cmd == IPC_SET)
|
||||
__semid_ds14_to_native(ds14, &ds);
|
||||
semun.buf = &ds;
|
||||
break;
|
||||
default:
|
||||
ds14 = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
error = __semctl50(semid, semnum, cmd, &semun);
|
||||
switch (cmd) {
|
||||
case IPC_SET:
|
||||
case IPC_STAT:
|
||||
semun.buf = (struct semid_ds *)(void *)ds14;
|
||||
if (cmd == IPC_STAT && error == 0)
|
||||
__native_to_semid_ds14(&ds, ds14);
|
||||
break;
|
||||
}
|
||||
return error;
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (cmd == IPC_STAT)
|
||||
__native_to_semid_ds14(&ds, ds14);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: compat_sigaltstack.c,v 1.3 2009/01/11 02:46:26 christos Exp $ */
|
||||
/* $NetBSD: compat_sigaltstack.c,v 1.5 2012/03/20 17:06:00 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: compat_sigaltstack.c,v 1.3 2009/01/11 02:46:26 christos Exp $");
|
||||
__RCSID("$NetBSD: compat_sigaltstack.c,v 1.5 2012/03/20 17:06:00 matt Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
@@ -44,9 +44,7 @@ __RCSID("$NetBSD: compat_sigaltstack.c,v 1.3 2009/01/11 02:46:26 christos Exp $"
|
||||
#include <stddef.h>
|
||||
|
||||
int
|
||||
sigaltstack(onss, ooss)
|
||||
const struct sigaltstack13 *onss;
|
||||
struct sigaltstack13 *ooss;
|
||||
sigaltstack(const struct sigaltstack13 *onss, struct sigaltstack13 *ooss)
|
||||
{
|
||||
stack_t nss, oss;
|
||||
int error;
|
||||
@@ -62,7 +60,7 @@ sigaltstack(onss, ooss)
|
||||
if (oss.ss_size > INT_MAX)
|
||||
ooss->ss_size = INT_MAX;
|
||||
else
|
||||
ooss->ss_size = oss.ss_size;
|
||||
ooss->ss_size = (int)oss.ss_size;
|
||||
ooss->ss_flags = oss.ss_flags;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user