summaryrefslogtreecommitdiff
path: root/klibc
diff options
context:
space:
mode:
authorGreg KH <greg@press.(none)>2005-06-21 16:36:29 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-21 16:36:29 -0700
commit972d318a3123b00d0ed6b78bbcf70a0965841a8e (patch)
tree8322245ad8e488ad3da9575e2d90b219a99880ea /klibc
parentae8d5e161fe916e39f226ce53f2c5f8b31f582a0 (diff)
parentd27d3bb05288fb5e70bc3f3fc7da1dc8ee5413a8 (diff)
Merge gregkh@ehlo.org:/home/kay/public_html/pub/scm/linux/hotplug/udev-kay
Diffstat (limited to 'klibc')
-rw-r--r--klibc/Makefile5
-rw-r--r--klibc/include/net/route.h1
-rw-r--r--klibc/include/netinet/if_ether.h (renamed from klibc/include/net/if_ether.h)0
-rw-r--r--klibc/include/netpacket/packet.h1
-rw-r--r--klibc/include/signal.h4
-rw-r--r--klibc/klcc.143
-rw-r--r--klibc/klcc.in15
-rw-r--r--klibc/klibc/Kbuild149
-rw-r--r--klibc/klibc/SYSCALLS.def32
-rw-r--r--klibc/klibc/arch/i386/Makefile.inc1
-rw-r--r--klibc/klibc/arch/i386/sigreturn.S15
-rw-r--r--klibc/klibc/arch/x86_64/MCONFIG5
-rw-r--r--klibc/klibc/arch/x86_64/Makefile.inc3
-rw-r--r--klibc/klibc/arch/x86_64/sigreturn.S15
-rw-r--r--klibc/klibc/arch/x86_64/syscall.S6
-rw-r--r--klibc/klibc/fgets.c1
-rw-r--r--klibc/klibc/sigaction.c35
-rw-r--r--klibc/klibc/sigpending.c4
-rw-r--r--klibc/klibc/sigprocmask.c4
-rw-r--r--klibc/klibc/sigsuspend.c4
-rw-r--r--klibc/klibc/strntoumax.c13
-rwxr-xr-x[-rw-r--r--]klibc/makeklcc.pl0
-rw-r--r--klibc/version2
23 files changed, 321 insertions, 37 deletions
diff --git a/klibc/Makefile b/klibc/Makefile
index 5071e60da4..e634aaccb5 100644
--- a/klibc/Makefile
+++ b/klibc/Makefile
@@ -69,4 +69,9 @@ local-install: $(CROSS)klcc
$(INSTALL_DATA) klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1
$(INSTALL_EXEC) $(KCROSS)klcc $(INSTALLROOT)$(bindir)
+# This does all the prep work needed to turn a freshly exported git repository
+# into a release tarball tree
+release: klibc.spec
+ rm -f maketar.sh
+
-include MCONFIG
diff --git a/klibc/include/net/route.h b/klibc/include/net/route.h
new file mode 100644
index 0000000000..a60df24c0a
--- /dev/null
+++ b/klibc/include/net/route.h
@@ -0,0 +1 @@
+#include <linux/route.h>
diff --git a/klibc/include/net/if_ether.h b/klibc/include/netinet/if_ether.h
index 060ef22070..060ef22070 100644
--- a/klibc/include/net/if_ether.h
+++ b/klibc/include/netinet/if_ether.h
diff --git a/klibc/include/netpacket/packet.h b/klibc/include/netpacket/packet.h
new file mode 100644
index 0000000000..b5e8e0e11f
--- /dev/null
+++ b/klibc/include/netpacket/packet.h
@@ -0,0 +1 @@
+#include <linux/if_packet.h>
diff --git a/klibc/include/signal.h b/klibc/include/signal.h
index ab3c98d6e4..05930bdea1 100644
--- a/klibc/include/signal.h
+++ b/klibc/include/signal.h
@@ -82,10 +82,6 @@ __extern int sigaction(int, const struct sigaction *, struct sigaction *);
__extern int sigprocmask(int, const sigset_t *, sigset_t *);
__extern int sigpending(sigset_t *);
__extern int sigsuspend(const sigset_t *);
-__extern int rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t);
-__extern int rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t);
-__extern int rt_sigpending(sigset_t *, size_t);
-__extern int rt_sigsuspend(const sigset_t *, size_t);
__extern int raise(int);
__extern int kill(pid_t, int);
diff --git a/klibc/klcc.1 b/klibc/klcc.1
index a6f979c6c4..76334a3a54 100644
--- a/klibc/klcc.1
+++ b/klibc/klcc.1
@@ -1,4 +1,4 @@
-.\" $Id: klcc.1,v 1.2 2005/03/02 02:24:17 hpa Exp $
+.\" $Id: klcc.1,v 1.3 2005/04/19 23:27:46 hpa Exp $
.\" -----------------------------------------------------------------------
.\"
.\" Copyright 2005 H. Peter Anvin - All Rights Reserved
@@ -39,7 +39,9 @@ klcc \- compile a program against klibc
.B klcc
is a wrapper around
.BR gcc (1)
-to compile a program against the
+and
+.BR ld (1)
+which compiles and links a program against the
.B klibc
tiny C library. It supports most
.B gcc
@@ -63,7 +65,12 @@ or
option to use the default optimization level; this will generally
result in the smallest binaries. You may want to use
.B \-s
-when linking, however.
+when linking, however. Use
+.B \-O0
+to compile without any optimization whatsoever; this may not work depending
+on the version of
+.B gcc
+used.
.PP
Use the
.B \-shared
@@ -72,10 +79,38 @@ or
option to compile for and link against shared or static klibc. Note
that shared klibc only supports running against the exact same klibc
binary as the binary was linked with.
+.PP
+In addition to standard
+.B gcc
+options,
+.B klcc
+supports options of the form \fB\-print-klibc-\fP\fIoption\fP,
+which prints the corresponding klibc configuration option.
.SH AUTHOR
Written by H. Peter Anvin <hpa@zytor.com>.
.SH COPYRIGHT
-Copyright \(co 2005 H. Peter Anvin.
+Copyright \(co 2005 H. Peter Anvin \- All Rights Reserved
+.PP
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom
+the Software is furnished to do so, subject to the following
+conditions:
+.PP
+The above copyright notice and this permission notice shall
+be included in all copies or substantial portions of the Software.
+.PP
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
.SH "SEE ALSO"
.BR gcc (1)
diff --git a/klibc/klcc.in b/klibc/klcc.in
index 36c4d9b3ee..5629f24f1c 100644
--- a/klibc/klcc.in
+++ b/klibc/klcc.in
@@ -1,5 +1,7 @@
# -*- perl -*-
+use IPC::Open3;
+
# Standard includes
@includes = ("-I${prefix}/${KCROSS}include/arch/${ARCH}",
"-I${prefix}/${KCROSS}include/bits${BITSIZE}",
@@ -57,7 +59,7 @@ sub files_with_lang($$) {
# Skip object files
if ( $need ne 'obj' ) {
- unless ( $xopt eq $need ) {
+ unless ( $xopt eq $need || $need eq 'stdin') {
push(@as, '-x', $need);
$xopt = $need;
}
@@ -79,7 +81,11 @@ sub syserr($) {
# Run a program; printing out the command line if $verbose is set
sub mysystem(@) {
print STDERR join(' ', @_), "\n" if ( $verbose );
- return system(@_);
+ my $cmd = shift;
+ open(INPUT, "<&STDIN"); # dup STDIN filehandle to INPUT
+ my $childpid = open3("<&INPUT", ">&STDOUT", ">&STDERR", $cmd, @_);
+ waitpid ($childpid, 0);
+ return $?;
}
#
@@ -117,6 +123,11 @@ while ( defined($a = shift(@ARGV)) ) {
# Not an option. Must be a filename then.
push(@files, $a);
$flang{$a} = $lang || filename2lang($a);
+ } elsif ( $a eq '-' ) {
+ # gcc gets its input from stdin
+ push(@files, $a);
+ # prevent setting -x
+ $flang{$a} = 'stdin'
} elsif ( $a =~ /^-print-klibc-(.*)$/ ) {
# This test must precede -print
if ( defined($conf{$1}) ) {
diff --git a/klibc/klibc/Kbuild b/klibc/klibc/Kbuild
new file mode 100644
index 0000000000..be239a6647
--- /dev/null
+++ b/klibc/klibc/Kbuild
@@ -0,0 +1,149 @@
+#
+# Kbuild file for klibc
+#
+
+libc-y := vsnprintf.o snprintf.o vsprintf.o sprintf.o \
+ asprintf.o vasprintf.o \
+ vsscanf.o sscanf.o ctypes.o \
+ strntoumax.o strntoimax.o \
+ atoi.o atol.o atoll.o \
+ strtol.o strtoll.o strtoul.o strtoull.o \
+ strtoimax.o strtoumax.o \
+ globals.o exitc.o atexit.o onexit.o \
+ execl.o execle.o execv.o execvpe.o execvp.o execlp.o execlpe.o \
+ fork.o wait.o wait3.o waitpid.o system.o setpgrp.o getpgrp.o \
+ daemon.o \
+ printf.o vprintf.o fprintf.o vfprintf.o perror.o \
+ statfs.o fstatfs.o umount.o \
+ open.o fopen.o fread.o fread2.o fgetc.o fgets.o \
+ fwrite.o fwrite2.o fputc.o fputs.o puts.o putchar.o \
+ sleep.o usleep.o strtotimespec.o strtotimeval.o \
+ raise.o abort.o assert.o alarm.o pause.o \
+ __signal.o sysv_signal.o bsd_signal.o siglist.o siglongjmp.o \
+ sigaction.o sigpending.o sigprocmask.o sigsuspend.o \
+ brk.o sbrk.o malloc.o realloc.o calloc.o mmap.o \
+ memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \
+ memmove.o memchr.o memrchr.o \
+ strcasecmp.o strncasecmp.o strndup.o strerror.o \
+ strcat.o strchr.o strcmp.o strcpy.o strdup.o strlen.o strnlen.o \
+ strncat.o strlcpy.o strlcat.o \
+ strstr.o strncmp.o strncpy.o strrchr.o \
+ strxspn.o strspn.o strcspn.o strpbrk.o strsep.o strtok.o \
+ gethostname.o getdomainname.o getcwd.o \
+ seteuid.o setegid.o \
+ getenv.o setenv.o putenv.o __put_env.o unsetenv.o \
+ getopt.o readdir.o \
+ syslog.o closelog.o pty.o getpt.o isatty.o reboot.o \
+ time.o utime.o llseek.o nice.o getpriority.o \
+ qsort.o \
+ lrand48.o jrand48.o mrand48.o nrand48.o srand48.o seed48.o \
+ inet/inet_ntoa.o inet/inet_aton.o inet/inet_addr.o \
+ inet/inet_ntop.o inet/inet_pton.o inet/bindresvport.o \
+ send.o recv.o
+
+libc-$(CONFIG_KLIBC_ERRLIST) += errlist.o
+
+libc-$(CONFIG_KLIBC_ZLIB) += \
+ zlib/adler32.o zlib/compress.o zlib/crc32.o zlib/gzio.o \
+ zlib/uncompr.o zlib/deflate.o zlib/trees.o zlib/zutil.o \
+ zlib/inflate.o zlib/infback.o zlib/inftrees.o zlib/inffast.o
+
+#####
+# Add any architecture-specific rules
+include $(obj)/arch/$(ARCH)/Makefile.inc
+
+#####
+# Shared definitions
+LIB := libc.a
+SOLIB := libc.so
+SOHASH := klibc.so
+CRT0 := arch/$(ARCH)/crt0.o
+INTERP_O := interp.o
+
+always := $(CRT0) $(LIB) $(SOLIB) $(SOHASH) $(INTERP_O)
+LIB := $(call objectify,$(LIB))
+SOLIB := $(call objectify,$(SOLIB))
+SOHASH := $(call objectify,$(SOHASH))
+CRT0 := $(call objectify,$(CRT0))
+INTERP_O := $(call objectify,$(INTERP_O))
+
+targets := arch/$(ARCH)/crt0.o
+targets += $(libc-y) $(ARCHOBJS)
+
+# Generate syscall stubs
+subdir-y += syscalls
+# Generate socket calls stubs
+subdir-y += socketcalls
+
+# Tell make to descend before building libs
+$(obj)/syscalls/syscalls.o: $(obj)/syscalls
+$(obj)/socketcalls/socketcalls.o: $(obj)/socketcalls
+
+#####
+# Readable errormessages extracted from src..
+targets += errlist.c
+quiet_cmd_errlist = GEN $@
+ cmd_errlist = $(PERL) $< $(LINUXINCLUDE) -errlist > $@ || rm -f $@
+
+$(obj)/errlist.c: $(srctree)/$(src)/makeerrlist.pl
+ $(call cmd,errlist)
+
+# full list of dependencies for klibc
+libc-deps = $(call objectify, $(libc-y) $(ARCHOBJS)) \
+ $(call objectify, syscalls/syscalls.o socketcalls/socketcalls.o)
+
+######
+# Build static library: libc.a
+targets += libc.a __static_init.o
+quiet_cmd_libc = USERAR $@
+ cmd_libc = rm -f $@; \
+ $(USERAR) cq $@ $(filter-out FORCE,$^); \
+ $(USERRANLIB) $@
+
+$(LIB): $(call objectify,__static_init.o) $(libc-deps) FORCE
+ $(call if_changed,libc)
+
+######
+# Build shared library
+targets += libc.so __shared_init.o
+
+quiet_cmd_libcso = LD $@
+ cmd_libcso = $(USERLD) $(USERLDFLAGS) $(USERSHAREDFLAGS) \
+ -o $@ $(filter-out FORCE,$^) $(USERLIBGCC)
+
+$(SOLIB): $(CRT0) $(call objectify,__shared_init.o) $(libc-deps) FORCE
+ $(call if_changed,libcso)
+
+
+#####
+# Build sha1 hash values
+targets += klibc.so libc.so.hash
+hostprogs-y := sha1hash
+
+quiet_cmd_solibhash = HASH $@
+ cmd_solibhash = $(USERNM) $< | egrep '^[0-9a-fA-F]+ [ADRTW] ' | \
+ sort | $(obj)/sha1hash > $@
+$(SOLIB).hash: $(SOLIB) $(obj)/sha1hash FORCE
+ $(call if_changed,solibhash)
+
+quiet_cmd_sohash = GEN $@
+ cmd_sohash = cat $< > $@; \
+ $(USERSTRIP) $(USERSTRIPFLAGS) $@; \
+ rm -f $(obj)/klibc-??????????????????????.so; \
+ ln -f $@ $(obj)/klibc-`cat $(SOLIB).hash`.so
+$(SOHASH): $(SOLIB) $(SOLIB).hash
+ $(call cmd,sohash)
+
+
+#####
+# build interp.o
+targets += interp.o
+
+quiet_cmd_interp = BUILD $@
+ cmd_interp = $(USERCC) $(usercflags) -D__ASSEMBLY__ \
+ -DLIBDIR=\"$(SHLIBDIR)\" \
+ -DSOHASH=\"`cat $(SOLIB).hash`\" \
+ -c -o $@ $<
+
+$(INTERP_O): $(obj)/interp.S $(SOLIB).hash
+ $(call if_changed,interp)
diff --git a/klibc/klibc/SYSCALLS.def b/klibc/klibc/SYSCALLS.def
index e8b9a7f176..11d8c9a47e 100644
--- a/klibc/klibc/SYSCALLS.def
+++ b/klibc/klibc/SYSCALLS.def
@@ -145,17 +145,29 @@ ssize_t pwrite64,pwrite::pwrite(int, void *, size_t, off_t)
;
; Signal operations
;
-int kill(pid_t, int)
; We really should get rid of the non-rt_* of these, but that takes
-; sanitizing <signal.h> for all architectures, sigh...
-<?> int sigaction(int, const struct sigaction *, struct sigaction *)
-<?> int sigsuspend(const sigset_t *)
-<?> int sigpending(sigset_t *)
-<?> int sigprocmask(int, const sigset_t *, sigset_t *)
-int rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t)
-int rt_sigsuspend(const sigset_t *, size_t)
-int rt_sigpending(sigset_t *, size_t)
-int rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t)
+; sanitizing <signal.h> for all architectures, sigh.
+#ifdef __NR_sigaction
+int sigaction::__sigaction(int, const struct sigaction *, struct sigaction *)
+#else
+int rt_sigaction::__rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t)
+#endif
+#ifdef __NR_sigsuspend
+int sigsuspend(const sigset_t *)
+#else
+int rt_sigsuspend::__rt_sigsuspend(const sigset_t *, size_t)
+#endif
+#ifdef __NR_sigpending
+int sigpending(sigset_t *)
+#else
+int rt_sigpending::__rt_sigpending(sigset_t *, size_t)
+#endif
+#ifdef __NR_sigprocmask
+int sigprocmask(int, const sigset_t *, sigset_t *)
+#else
+int rt_sigprocmask::__rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t)
+#endif
+int kill(pid_t, int)
<?> unsigned int alarm(unsigned int)
int getitimer(int, struct itimerval *)
int setitimer(int, const struct itimerval *, struct itimerval *)
diff --git a/klibc/klibc/arch/i386/Makefile.inc b/klibc/klibc/arch/i386/Makefile.inc
index 5c320cb453..80344bd0a5 100644
--- a/klibc/klibc/arch/i386/Makefile.inc
+++ b/klibc/klibc/arch/i386/Makefile.inc
@@ -13,6 +13,7 @@ ARCHOBJS = \
arch/$(ARCH)/setjmp.o \
arch/$(ARCH)/syscall.o \
arch/$(ARCH)/open.o \
+ arch/$(ARCH)/sigreturn.o \
arch/$(ARCH)/libgcc/__ashldi3.o \
arch/$(ARCH)/libgcc/__ashrdi3.o \
arch/$(ARCH)/libgcc/__lshrdi3.o \
diff --git a/klibc/klibc/arch/i386/sigreturn.S b/klibc/klibc/arch/i386/sigreturn.S
new file mode 100644
index 0000000000..f2a32419d3
--- /dev/null
+++ b/klibc/klibc/arch/i386/sigreturn.S
@@ -0,0 +1,15 @@
+#
+# arch/i386/sigreturn.S
+#
+
+#include <asm/unistd.h>
+
+ .text
+ .align 4
+ .globl __sigreturn
+ .type __sigreturn,@function
+__sigreturn:
+ pop %eax # Have no idea why this is needed...
+ movl $__NR_sigreturn,%eax
+ int $0x80
+ .size __sigreturn,.-__sigreturn
diff --git a/klibc/klibc/arch/x86_64/MCONFIG b/klibc/klibc/arch/x86_64/MCONFIG
index 13b6e391f9..c9b5da8bd6 100644
--- a/klibc/klibc/arch/x86_64/MCONFIG
+++ b/klibc/klibc/arch/x86_64/MCONFIG
@@ -15,8 +15,13 @@
# debugging using gdb.
#
ARCHREQFLAGS = -m64
+ifeq ($(DEBUG),y)
+OPTFLAGS = -Os -fomit-frame-pointer \
+ -falign-functions=0 -falign-jumps=0 -falign-loops=0
+else
OPTFLAGS = -Os -fno-asynchronous-unwind-tables -fomit-frame-pointer \
-falign-functions=0 -falign-jumps=0 -falign-loops=0
+endif
BITSIZE = 64
LDFLAGS = -m elf_x86_64
diff --git a/klibc/klibc/arch/x86_64/Makefile.inc b/klibc/klibc/arch/x86_64/Makefile.inc
index d6cc1204e4..26d880d7c7 100644
--- a/klibc/klibc/arch/x86_64/Makefile.inc
+++ b/klibc/klibc/arch/x86_64/Makefile.inc
@@ -10,7 +10,8 @@
ARCHOBJS = \
arch/$(ARCH)/exits.o \
arch/$(ARCH)/setjmp.o \
- arch/$(ARCH)/syscall.o
+ arch/$(ARCH)/syscall.o \
+ arch/$(ARCH)/sigreturn.o
ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS))
diff --git a/klibc/klibc/arch/x86_64/sigreturn.S b/klibc/klibc/arch/x86_64/sigreturn.S
new file mode 100644
index 0000000000..66e7152344
--- /dev/null
+++ b/klibc/klibc/arch/x86_64/sigreturn.S
@@ -0,0 +1,15 @@
+/*
+ * arch/x86_64/sigreturn.S
+ */
+
+#include <asm/unistd.h>
+
+ .text
+ .align 4
+ .globl __sigreturn
+ .type __sigreturn,@function
+__sigreturn:
+ movl $__NR_rt_sigreturn,%eax
+ syscall
+
+ .size __sigreturn,.-__sigreturn
diff --git a/klibc/klibc/arch/x86_64/syscall.S b/klibc/klibc/arch/x86_64/syscall.S
index f2c74ae974..17977978b9 100644
--- a/klibc/klibc/arch/x86_64/syscall.S
+++ b/klibc/klibc/arch/x86_64/syscall.S
@@ -15,14 +15,14 @@ __syscall_common:
syscall
cmpq $-4095,%rax
- jb 1f
+ jnb 1f
+ ret
# Error return, must set errno
+1:
negl %eax
movl %eax,errno(%rip) # errno is type int, so 32 bits
orq $-1,%rax # orq $-1 smaller than movq $-1
-
-1:
ret
.size __syscall_common,.-__syscall_common
diff --git a/klibc/klibc/fgets.c b/klibc/klibc/fgets.c
index 88a145a63f..72f8a13cf1 100644
--- a/klibc/klibc/fgets.c
+++ b/klibc/klibc/fgets.c
@@ -20,6 +20,7 @@ char *fgets(char *s, int n, FILE *f)
return NULL;
}
*p++ = ch;
+ n--;
if ( ch == '\n' )
break;
}
diff --git a/klibc/klibc/sigaction.c b/klibc/klibc/sigaction.c
index 819ffd4fe8..85f42a244c 100644
--- a/klibc/klibc/sigaction.c
+++ b/klibc/klibc/sigaction.c
@@ -5,11 +5,40 @@
#include <signal.h>
#include <sys/syscall.h>
-#ifndef __NR_sigaction
+__extern void __sigreturn(void);
+__extern int __sigaction(int, const struct sigaction *, struct sigaction *);
+__extern int __rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t);
int sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
{
- return rt_sigaction(sig, act, oact, sizeof(sigset_t));
-}
+ int rv;
+
+#if defined(__i386__) || defined(__x86_64__)
+ /* x86-64, and the Fedora i386 kernel, are broken without SA_RESTORER */
+ struct sigaction sa;
+
+ if ( act && !(act->sa_flags & SA_RESTORER) ) {
+ sa = *act;
+ act = &sa;
+
+ /* The kernel can't be trusted to have a valid default restorer */
+ sa.sa_flags |= SA_RESTORER;
+ sa.sa_restorer = &__sigreturn;
+ }
+#endif
+#ifdef __NR_sigaction
+ rv = __sigaction(sig, act, oact);
+#else
+ rv = __rt_sigaction(sig, act, oact, sizeof(sigset_t));
#endif
+
+
+#if defined(__i386__) || defined(__x86_64__)
+ if ( oact && (oact->sa_restorer == &__sigreturn) ) {
+ oact->sa_flags &= ~SA_RESTORER;
+ }
+#endif
+
+ return rv;
+}
diff --git a/klibc/klibc/sigpending.c b/klibc/klibc/sigpending.c
index 76d2b1a7f6..decfe32b1b 100644
--- a/klibc/klibc/sigpending.c
+++ b/klibc/klibc/sigpending.c
@@ -7,9 +7,11 @@
#ifndef __NR_sigpending
+__extern __rt_sigpending(sigset_t *, size_t);
+
int sigpending(sigset_t *set)
{
- return rt_sigpending(set, sizeof(sigset_t));
+ return __rt_sigpending(set, sizeof(sigset_t));
}
#endif
diff --git a/klibc/klibc/sigprocmask.c b/klibc/klibc/sigprocmask.c
index b5e58b28b8..372e0fd90d 100644
--- a/klibc/klibc/sigprocmask.c
+++ b/klibc/klibc/sigprocmask.c
@@ -7,9 +7,11 @@
#ifndef __NR_sigprocmask
+__extern __rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t);
+
int sigprocmask(int how, const sigset_t *set, sigset_t *oset)
{
- return rt_sigprocmask(how, set, oset, sizeof(sigset_t));
+ return __rt_sigprocmask(how, set, oset, sizeof(sigset_t));
}
#endif
diff --git a/klibc/klibc/sigsuspend.c b/klibc/klibc/sigsuspend.c
index a927999ae6..22f9a46681 100644
--- a/klibc/klibc/sigsuspend.c
+++ b/klibc/klibc/sigsuspend.c
@@ -7,9 +7,11 @@
#ifndef __NR_sigsuspend
+__extern int __rt_sigsuspend(const sigset_t *, size_t);
+
int sigsuspend(const sigset_t *mask)
{
- return rt_sigsuspend(mask, sizeof *mask);
+ return __rt_sigsuspend(mask, sizeof *mask);
}
#endif
diff --git a/klibc/klibc/strntoumax.c b/klibc/klibc/strntoumax.c
index 4e30637d2c..4c47fe8662 100644
--- a/klibc/klibc/strntoumax.c
+++ b/klibc/klibc/strntoumax.c
@@ -33,12 +33,13 @@ uintmax_t strntoumax(const char *nptr, char **endptr, int base, size_t n)
}
/* Single optional + or - */
- if ( n && *nptr == '-' ) {
- minus = 1;
- nptr++;
- n--;
- } else if ( n && *nptr == '+' ) {
- nptr++;
+ if ( n ) {
+ char c = *nptr;
+ if ( c == '-' || c == '+' ) {
+ minus = (c == '-');
+ nptr++;
+ n--;
+ }
}
if ( base == 0 ) {
diff --git a/klibc/makeklcc.pl b/klibc/makeklcc.pl
index 74045955fd..74045955fd 100644..100755
--- a/klibc/makeklcc.pl
+++ b/klibc/makeklcc.pl
diff --git a/klibc/version b/klibc/version
index 238d6e882a..5b09c67c20 100644
--- a/klibc/version
+++ b/klibc/version
@@ -1 +1 @@
-1.0.7
+1.0.14