summaryrefslogtreecommitdiff
path: root/libc/misc
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc')
-rw-r--r--libc/misc/Makefile.in2
-rw-r--r--libc/misc/auxvt/Makefile.in23
-rwxr-xr-xlibc/misc/auxvt/getauxval.c48
-rw-r--r--libc/misc/fnmatch/fnmatch_loop.c1
-rw-r--r--libc/misc/getloadavg/getloadavg.c2
-rw-r--r--libc/misc/internals/__uClibc_main.c3
-rw-r--r--libc/misc/internals/reloc_static_pie.c5
-rw-r--r--libc/misc/internals/tempname.c3
-rw-r--r--libc/misc/sysvipc/sem.c18
-rw-r--r--libc/misc/time/time.c11
-rw-r--r--libc/misc/wchar/wchar.c1
11 files changed, 109 insertions, 8 deletions
diff --git a/libc/misc/Makefile.in b/libc/misc/Makefile.in
index 53bb6d6c8..caf7f1391 100644
--- a/libc/misc/Makefile.in
+++ b/libc/misc/Makefile.in
@@ -5,7 +5,9 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+
include $(top_srcdir)libc/misc/assert/Makefile.in
+include $(top_srcdir)libc/misc/auxvt/Makefile.in
include $(top_srcdir)libc/misc/ctype/Makefile.in
include $(top_srcdir)libc/misc/dirent/Makefile.in
include $(top_srcdir)libc/misc/error/Makefile.in
diff --git a/libc/misc/auxvt/Makefile.in b/libc/misc/auxvt/Makefile.in
new file mode 100644
index 000000000..142ade10c
--- /dev/null
+++ b/libc/misc/auxvt/Makefile.in
@@ -0,0 +1,23 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+subdirs += libc/misc/auxvt
+
+CSRC-y := getauxval.c
+
+MISC_AUXVT_DIR := $(top_srcdir)libc/misc/auxvt
+MISC_AUXVT_OUT := $(top_builddir)libc/misc/auxvt
+
+MISC_AUXVT_SRC := $(patsubst %.c,$(MISC_AUXVT_DIR)/%.c,$(CSRC-y))
+MISC_AUXVT_OBJ := $(patsubst %.c,$(MISC_AUXVT_OUT)/%.o,$(CSRC-y))
+
+libc-y += $(MISC_AUXVT_OBJ)
+
+objclean-y += CLEAN_libc/misc/auxvt
+
+CLEAN_libc/misc/auxvt:
+ $(do_rm) $(addprefix $(MISC_AUXVT_OUT)/*., o os)
diff --git a/libc/misc/auxvt/getauxval.c b/libc/misc/auxvt/getauxval.c
new file mode 100755
index 000000000..2bdffaf2c
--- /dev/null
+++ b/libc/misc/auxvt/getauxval.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2022 Ramin Seyed Moussavi
+ * An getauxval() function compatible with the glibc auxv.h
+ * that is used by uClibc-ng.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include "errno.h"
+#include "ldso.h"
+#include "sys/auxv.h"
+
+
+/*
+ *
+ * aarch64 gcc 11 uses __getauxval() in init_have_lse_atomics()
+ *
+ */
+unsigned long int __getauxval (unsigned long int __type)
+{
+ if ( __type >= AUX_MAX_AT_ID ){
+ __set_errno (ENOENT);
+ return 0;
+ }
+
+ if ( _dl_auxvt[__type].a_type == __type){
+ return _dl_auxvt[__type].a_un.a_val;
+ }
+
+ __set_errno (ENOENT);
+ return 0;
+}
+
+unsigned long int getauxval (unsigned long int __type){
+ return __getauxval( __type );
+}
+
diff --git a/libc/misc/fnmatch/fnmatch_loop.c b/libc/misc/fnmatch/fnmatch_loop.c
index 32ee079a3..025510de6 100644
--- a/libc/misc/fnmatch/fnmatch_loop.c
+++ b/libc/misc/fnmatch/fnmatch_loop.c
@@ -917,7 +917,6 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
}
else if (c == L('[') && *p == L('.'))
{
- ++p;
while (1)
{
c = *++p;
diff --git a/libc/misc/getloadavg/getloadavg.c b/libc/misc/getloadavg/getloadavg.c
index 2aee565c0..0d98119a9 100644
--- a/libc/misc/getloadavg/getloadavg.c
+++ b/libc/misc/getloadavg/getloadavg.c
@@ -23,7 +23,9 @@
* Imported from musl C library
*/
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE
+#endif /* _GNU_SOURCE */
#include <stdlib.h>
#include <sys/sysinfo.h>
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c
index affa0ce0a..64a9c8214 100644
--- a/libc/misc/internals/__uClibc_main.c
+++ b/libc/misc/internals/__uClibc_main.c
@@ -109,7 +109,7 @@ void internal_function _dl_aux_init (ElfW(auxv_t) *av);
* in or linker will disregard these weaks.
*/
-static int __pthread_return_0 (pthread_mutex_t *unused) { return 0; }
+static int __pthread_return_0 (pthread_mutex_t *unused) { (void)unused; return 0; }
weak_alias (__pthread_return_0, __pthread_mutex_lock)
weak_alias (__pthread_return_0, __pthread_mutex_trylock)
weak_alias (__pthread_return_0, __pthread_mutex_unlock)
@@ -117,6 +117,7 @@ weak_alias (__pthread_return_0, __pthread_mutex_unlock)
int weak_function
__pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
{
+ (void)mutex; (void)attr;
return 0;
}
diff --git a/libc/misc/internals/reloc_static_pie.c b/libc/misc/internals/reloc_static_pie.c
index ab1923024..cb2c4df87 100644
--- a/libc/misc/internals/reloc_static_pie.c
+++ b/libc/misc/internals/reloc_static_pie.c
@@ -21,7 +21,7 @@
#include <dl-elf.h>
#include <ldso.h>
-#if defined(__mips__) || defined(__xtensa__)
+#if defined(__m68k__) || defined(__mips__) || defined(__xtensa__)
#include <dl-startup.h>
#endif
@@ -53,6 +53,9 @@ reloc_static_pie(ElfW(Addr) load_addr)
PERFORM_BOOTSTRAP_GOT(tpnt);
#endif
+#if !defined(__FDPIC__)
+ DL_RELOCATE_RELR(tpnt);
+#endif
#if defined(ELF_MACHINE_PLTREL_OVERLAP)
# define INDX_MAX 1
diff --git a/libc/misc/internals/tempname.c b/libc/misc/internals/tempname.c
index d3a8ccbd8..f9b714a68 100644
--- a/libc/misc/internals/tempname.c
+++ b/libc/misc/internals/tempname.c
@@ -218,7 +218,8 @@ int attribute_hidden __gen_tempname (char *tmpl, int kind, int flags,
/* Give up now. */
return -1;
} else
- fd = 0;
+ /* File already exists, so return with non-zero value */
+ return -1;
}
case __GT_FILE:
fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL | flags, mode);
diff --git a/libc/misc/sysvipc/sem.c b/libc/misc/sysvipc/sem.c
index 64be1cae0..07076eff7 100644
--- a/libc/misc/sysvipc/sem.c
+++ b/libc/misc/sysvipc/sem.c
@@ -23,6 +23,9 @@
#include "ipc.h"
+#if defined(__UCLIBC_USE_TIME64__)
+#include "internal/time64_helpers.h"
+#endif
#ifdef L_semctl
/* Return identifier for array of NSEMS semaphores associated with
@@ -53,7 +56,12 @@ int semctl(int semid, int semnum, int cmd, ...)
arg = va_arg (ap, union semun);
va_end (ap);
#ifdef __NR_semctl
- return __semctl(semid, semnum, cmd | __IPC_64, arg.__pad);
+ int __ret = __semctl(semid, semnum, cmd | __IPC_64, arg.__pad);
+#if defined(__UCLIBC_USE_TIME64__)
+ arg.buf->sem_otime = (__time_t)arg.buf->__sem_otime_internal_1 | (__time_t)(arg.buf->__sem_otime_internal_2) << 32;
+ arg.buf->sem_ctime = (__time_t)arg.buf->__sem_ctime_internal_1 | (__time_t)(arg.buf->__sem_ctime_internal_2) << 32;
+#endif
+ return __ret;
#else
return __syscall_ipc(IPCOP_semctl, semid, semnum, cmd|__IPC_64, &arg, NULL);
#endif
@@ -90,7 +98,13 @@ int semop (int semid, struct sembuf *sops, size_t nsops)
#ifdef L_semtimedop
-#ifdef __NR_semtimedop
+#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_semtimedop_time64)
+int semtimedop(int semid, struct sembuf *sops, size_t nsops, const struct timespec *timeout)
+{
+ return INLINE_SYSCALL(semtimedop_time64, 4, semid, sops, nsops, TO_TS64_P(timeout));
+}
+
+#elif defined(__NR_semtimedop)
_syscall4(int, semtimedop, int, semid, struct sembuf *, sops, size_t, nsops, const struct timespec *, timeout)
#else
diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c
index cd189169a..b6a5b097d 100644
--- a/libc/misc/time/time.c
+++ b/libc/misc/time/time.c
@@ -1311,7 +1311,7 @@ ISO_LOOP:
j = (i & 128) ? 100: 12;
if (i & 64) {
- field_val /= j;;
+ field_val /= j;
}
if (i & 32) {
field_val %= j;
@@ -2478,9 +2478,16 @@ DST_CORRECT:
+ p[3]) + p[7])));
DST_CORRECT:
+#if defined(__UCLIBC_USE_TIME64__)
+ if (((unsigned long long)(secs - LLONG_MIN))
+ > (((unsigned long long)LLONG_MAX) - LLONG_MIN)
+ )
+#else
if (((unsigned long long)(secs - LONG_MIN))
> (((unsigned long long)LONG_MAX) - LONG_MIN)
- ) {
+ )
+#endif
+ {
t = ((time_t)(-1));
goto DONE;
}
diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c
index 201f30772..2714d47d7 100644
--- a/libc/misc/wchar/wchar.c
+++ b/libc/misc/wchar/wchar.c
@@ -781,6 +781,7 @@ size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src,
size_t count;
int incr;
char buf[MB_LEN_MAX];
+ (void)ps;
#ifdef __CTYPE_HAS_UTF_8_LOCALES
if (ENCODING == __ctype_encoding_utf8) {