diff options
Diffstat (limited to 'libc')
| -rw-r--r-- | libc/misc/assert/__assert.c | 8 | ||||
| -rw-r--r-- | libc/misc/sysvipc/msgq.c | 4 | ||||
| -rw-r--r-- | libc/stdlib/realpath.c | 22 | ||||
| -rw-r--r-- | libc/sysdeps/linux/common/_exit.c | 1 | ||||
| -rw-r--r-- | libc/sysdeps/linux/common/bits/mathcalls.h | 2 | ||||
| -rw-r--r-- | libc/sysdeps/linux/common/bits/uClibc_ctype.h | 2 | ||||
| -rw-r--r-- | libc/sysdeps/linux/common/futimens.c | 23 | ||||
| -rw-r--r-- | libc/sysdeps/linux/common/ppoll.c | 5 | ||||
| -rw-r--r-- | libc/sysdeps/linux/common/utimensat.c | 2 | ||||
| -rw-r--r-- | libc/sysdeps/linux/mips/bits/termios.h | 1 | 
10 files changed, 46 insertions, 24 deletions
diff --git a/libc/misc/assert/__assert.c b/libc/misc/assert/__assert.c index ff9e47dcf..8afde52ff 100644 --- a/libc/misc/assert/__assert.c +++ b/libc/misc/assert/__assert.c @@ -30,8 +30,6 @@  #include <stdio.h>  #include <stdlib.h>  #include <unistd.h> -#include <bits/uClibc_uintmaxtostr.h> -  /* Get the prototype from assert.h as a double-check. */  #undef NDEBUG @@ -43,8 +41,8 @@  static smallint in_assert;			/* bss inits to 0. */ -void attribute_noreturn __assert(const char *assertion, const char * filename, -			  int linenumber, register const char * function) +void __assert(const char *assertion, const char * filename, +	      unsigned int linenumber, register const char * function)  {  	if (!in_assert) {  		in_assert = 1; @@ -62,7 +60,7 @@ void attribute_noreturn __assert(const char *assertion, const char * filename,  				assertion  				);  	} +	/* shouldn't we? fflush(stderr); */  	abort();  } -  libc_hidden_def(__assert) diff --git a/libc/misc/sysvipc/msgq.c b/libc/misc/sysvipc/msgq.c index d67645a4d..e20e3ca64 100644 --- a/libc/misc/sysvipc/msgq.c +++ b/libc/misc/sysvipc/msgq.c @@ -49,10 +49,10 @@ struct new_msg_buf{  #ifdef L_msgrcv  #ifdef __NR_msgrcv  #define __NR___syscall_msgrcv __NR_msgrcv -static inline _syscall5(int, __syscall_msgrcv, int, msqid, void *, msgp, +static inline _syscall5(ssize_t, __syscall_msgrcv, int, msqid, void *, msgp,  			size_t, msgsz, long int, msgtyp, int, msgflg)  #endif -static inline int do_msgrcv (int msqid, void *msgp, size_t msgsz, +static inline ssize_t do_msgrcv (int msqid, void *msgp, size_t msgsz,  			    long int msgtyp, int msgflg)  {  #ifdef __NR_msgrcv diff --git a/libc/stdlib/realpath.c b/libc/stdlib/realpath.c index 1a00c3112..80c25f098 100644 --- a/libc/stdlib/realpath.c +++ b/libc/stdlib/realpath.c @@ -36,19 +36,10 @@  #define MAX_READLINKS 32 -#ifdef __STDC__  char *realpath(const char *path, char got_path[]) -#else -char *realpath(path, got_path) -const char *path; -char got_path[]; -#endif  {  	char copy_path[PATH_MAX]; -	/* use user supplied buffer directly - reduces stack usage */ -	/* char got_path[PATH_MAX]; */ -	char *max_path; -	char *new_path; +	char *max_path, *new_path, *allocated_path;  	size_t path_len;  	int readlinks = 0;  #ifdef S_IFLNK @@ -72,12 +63,13 @@ char got_path[];  	/* Copy so that path is at the end of copy_path[] */  	strcpy(copy_path + (PATH_MAX-1) - path_len, path);  	path = copy_path + (PATH_MAX-1) - path_len; +	allocated_path = got_path ? NULL : (got_path = malloc(PATH_MAX));  	max_path = got_path + PATH_MAX - 2; /* points to last non-NUL char */  	new_path = got_path;  	if (*path != '/') {  		/* If it's a relative pathname use getcwd for starters. */  		if (!getcwd(new_path, PATH_MAX - 1)) -			return NULL; +			goto err;  		new_path += strlen(new_path);  		if (new_path[-1] != '/')  			*new_path++ = '/'; @@ -114,6 +106,8 @@ char got_path[];  		while (*path != '\0' && *path != '/') {  			if (new_path > max_path) {  				__set_errno(ENAMETOOLONG); + err: +				free(allocated_path);  				return NULL;  			}  			*new_path++ = *path++; @@ -122,7 +116,7 @@ char got_path[];  		/* Protect against infinite loops. */  		if (readlinks++ > MAX_READLINKS) {  			__set_errno(ELOOP); -			return NULL; +			goto err;  		}  		path_len = strlen(path);  		/* See if last (so far) pathname component is a symlink. */ @@ -133,13 +127,13 @@ char got_path[];  			if (link_len < 0) {  				/* EINVAL means the file exists but isn't a symlink. */  				if (errno != EINVAL) { -					return NULL; +					goto err;  				}  			} else {  				/* Safe sex check. */  				if (path_len + link_len >= PATH_MAX - 2) {  					__set_errno(ENAMETOOLONG); -					return NULL; +					goto err;  				}  				/* Note: readlink doesn't add the null byte. */  				/* copy_path[link_len] = '\0'; - we don't need it too */ diff --git a/libc/sysdeps/linux/common/_exit.c b/libc/sysdeps/linux/common/_exit.c index a36927d0c..51117d109 100644 --- a/libc/sysdeps/linux/common/_exit.c +++ b/libc/sysdeps/linux/common/_exit.c @@ -31,3 +31,4 @@ void attribute_noreturn _exit(int status)  	}  }  libc_hidden_def(_exit) +weak_alias(_exit,_Exit) diff --git a/libc/sysdeps/linux/common/bits/mathcalls.h b/libc/sysdeps/linux/common/bits/mathcalls.h index 811738238..df2e21cc8 100644 --- a/libc/sysdeps/linux/common/bits/mathcalls.h +++ b/libc/sysdeps/linux/common/bits/mathcalls.h @@ -244,6 +244,7 @@ __END_NAMESPACE_C99  /* Return nonzero if VALUE is not a number.  */  __MATHDECL_PRIV (int,isnan,, (_Mdouble_ __value), (__const__)) +# ifdef __DO_XSI_MATH__  /* Bessel functions.  */  __MATHCALL (j0,, (_Mdouble_))  __MATHCALL (j1,, (_Mdouble_)) @@ -251,6 +252,7 @@ __MATHCALL (jn,, (int, _Mdouble_))  __MATHCALL (y0,, (_Mdouble_))  __MATHCALL (y1,, (_Mdouble_))  __MATHCALL (yn,, (int, _Mdouble_)) +# endif  #endif diff --git a/libc/sysdeps/linux/common/bits/uClibc_ctype.h b/libc/sysdeps/linux/common/bits/uClibc_ctype.h index 43371286b..22d2df03a 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_ctype.h +++ b/libc/sysdeps/linux/common/bits/uClibc_ctype.h @@ -103,12 +103,14 @@ __BEGIN_DECLS  /* Now some non-ansi/iso c99 macros. */ +#ifndef __UCLIBC_SUSV4_LEGACY__  #define __isascii(c) (((c) & ~0x7f) == 0)  #define __toascii(c) ((c) & 0x7f)  /* Works correctly *only* on lowercase letters! */  #define _toupper(c) ((c) ^ 0x20)  /* Works correctly *only* on letters (of any case) and numbers */  #define _tolower(c) ((c) | 0x20) +#endif  __END_DECLS diff --git a/libc/sysdeps/linux/common/futimens.c b/libc/sysdeps/linux/common/futimens.c new file mode 100644 index 000000000..090dfa69c --- /dev/null +++ b/libc/sysdeps/linux/common/futimens.c @@ -0,0 +1,23 @@ +/* vi: set sw=4 ts=4: */ +/* + * futimens() implementation for uClibc + * + * Copyright (C) 2009 Bernhard Reutner-Fischer <uclibc@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include <sys/syscall.h> +#define __need_timespec +#include <time.h> +#ifdef __NR_utimensat +extern int utimensat (int __fd, __const char *__path, +	__const struct timespec __times[2], +	int __flags) __THROW; +libc_hidden_proto(utimensat) + +int futimens (int fd, __const struct timespec ts[2]) +{ +	return utimensat(fd, 0, ts, 0); +} +#endif diff --git a/libc/sysdeps/linux/common/ppoll.c b/libc/sysdeps/linux/common/ppoll.c index c9efe8d08..02c8013a5 100644 --- a/libc/sysdeps/linux/common/ppoll.c +++ b/libc/sysdeps/linux/common/ppoll.c @@ -20,10 +20,10 @@  #include <signal.h>  #include <sys/syscall.h>  #include <sys/poll.h> +#define __need_NULL +#include <stddef.h>  #if defined __NR_ppoll && defined __UCLIBC_LINUX_SPECIFIC__ - -  int  ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,         const sigset_t *sigmask) @@ -39,5 +39,4 @@ ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,  	return INLINE_SYSCALL(ppoll, 5, fds, nfds, timeout, sigmask, _NSIG / 8);  }  libc_hidden_def(ppoll) -  #endif diff --git a/libc/sysdeps/linux/common/utimensat.c b/libc/sysdeps/linux/common/utimensat.c index 3c5af8586..2cfb8247d 100644 --- a/libc/sysdeps/linux/common/utimensat.c +++ b/libc/sysdeps/linux/common/utimensat.c @@ -11,6 +11,8 @@  #ifdef __NR_utimensat  _syscall4(int, utimensat, int, fd, const char *, path, const struct timespec *, times, int, flags) +libc_hidden_def(utimensat)  #else  /* should add emulation with utimens() and /proc/self/fd/ ... */  #endif + diff --git a/libc/sysdeps/linux/mips/bits/termios.h b/libc/sysdeps/linux/mips/bits/termios.h index 546faa020..fb351995c 100644 --- a/libc/sysdeps/linux/mips/bits/termios.h +++ b/libc/sysdeps/linux/mips/bits/termios.h @@ -73,6 +73,7 @@ struct termios  #define IXANY	0004000		/* Any character will restart after stop.  */  #define IXOFF	0010000		/* Enable start/stop input control.  */  #define IMAXBEL 0020000		/* Ring bell when input queue is full.  */ +#define IUTF8   0040000		/* Input is UTF8.  */  /* c_oflag bits */  #define OPOST	0000001		/* Perform output processing.  */  | 
