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:
2012-11-15 12:06:41 +01:00
parent f6aac1c3b5
commit f14fb60209
1285 changed files with 44244 additions and 14308 deletions

View File

@@ -1,4 +1,4 @@
/* $NetBSD: stdio.c,v 1.16 2009/10/25 20:44:13 christos Exp $ */
/* $NetBSD: stdio.c,v 1.21 2012/03/27 15:05:42 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)stdio.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: stdio.c,v 1.16 2009/10/25 20:44:13 christos Exp $");
__RCSID("$NetBSD: stdio.c,v 1.21 2012/03/27 15:05:42 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -56,71 +56,68 @@ __RCSID("$NetBSD: stdio.c,v 1.16 2009/10/25 20:44:13 christos Exp $");
* Small standard I/O/seek/close functions.
* These maintain the `known seek offset' for seek optimisation.
*/
int
__sread(cookie, buf, n)
void *cookie;
char *buf;
int n;
ssize_t
__sread(void *cookie, void *buf, size_t n)
{
FILE *fp = cookie;
int ret;
ssize_t ret;
_DIAGASSERT(fp != NULL);
_DIAGASSERT(cookie != NULL);
_DIAGASSERT(cookie == fp->_cookie);
_DIAGASSERT(buf != NULL);
ret = read(__sfileno(fp), buf, (size_t)n);
ret = read(__sfileno(fp), buf, n);
/* if the read succeeded, update the current offset */
if (ret >= 0)
fp->_offset += ret;
else
fp->_flags &= ~__SOFF; /* paranoia */
return (ret);
return ret;
}
int
__swrite(cookie, buf, n)
void *cookie;
char const *buf;
int n;
ssize_t
__swrite(void *cookie, const void *buf, size_t n)
{
FILE *fp = cookie;
_DIAGASSERT(cookie != NULL);
_DIAGASSERT(cookie == fp->_cookie);
_DIAGASSERT(buf != NULL);
if (fp->_flags & __SAPP)
(void) lseek(__sfileno(fp), (off_t)0, SEEK_END);
if (lseek(__sfileno(fp), (off_t)0, SEEK_END) == (off_t)-1)
return -1;
fp->_flags &= ~__SOFF; /* in case FAPPEND mode is set */
return write(__sfileno(fp), buf, (size_t)n);
return write(__sfileno(fp), buf, n);
}
fpos_t
__sseek(cookie, offset, whence)
void *cookie;
fpos_t offset;
int whence;
off_t
__sseek(void *cookie, off_t offset, int whence)
{
FILE *fp = cookie;
off_t ret;
_DIAGASSERT(fp != NULL);
_DIAGASSERT(cookie != NULL);
_DIAGASSERT(cookie == fp->_cookie);
ret = lseek(__sfileno(fp), (off_t)offset, whence);
if (ret == -1L)
ret = lseek(__sfileno(fp), offset, whence);
if (ret == (off_t)-1L)
fp->_flags &= ~__SOFF;
else {
fp->_flags |= __SOFF;
fp->_offset = ret;
}
return (ret);
return ret;
}
int
__sclose(cookie)
void *cookie;
__sclose(void *cookie)
{
FILE *fp = cookie;
_DIAGASSERT(cookie != NULL);
_DIAGASSERT(cookie == fp->_cookie);
return close(__sfileno((FILE *)cookie));
return close(__sfileno(fp));
}