diff options
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/Makefile | 4 | ||||
-rw-r--r-- | lib/libc/alpha/gen/setjmp.S | 11 | ||||
-rw-r--r-- | lib/libc/amd64/gen/_setjmp.S | 4 | ||||
-rw-r--r-- | lib/libc/amd64/gen/setjmp.S | 30 | ||||
-rw-r--r-- | lib/libc/amd64/gen/sigsetjmp.S | 39 | ||||
-rw-r--r-- | lib/libc/amd64/sys/Makefile.inc | 7 | ||||
-rw-r--r-- | lib/libc/compat-43/sigcompat.c | 32 | ||||
-rw-r--r-- | lib/libc/gen/sigsetops.c | 33 | ||||
-rw-r--r-- | lib/libc/i386/gen/_setjmp.S | 4 | ||||
-rw-r--r-- | lib/libc/i386/gen/setjmp.S | 30 | ||||
-rw-r--r-- | lib/libc/i386/gen/sigsetjmp.S | 39 | ||||
-rw-r--r-- | lib/libc/i386/sys/Makefile.inc | 7 |
12 files changed, 149 insertions, 91 deletions
diff --git a/lib/libc/Makefile b/lib/libc/Makefile index 023da6b..8a2afa8 100644 --- a/lib/libc/Makefile +++ b/lib/libc/Makefile @@ -7,8 +7,8 @@ # from CFLAGS below. To remove these strings from just the system call # stubs, remove just -DSYSLIBC_RCS from CFLAGS. LIB=c -SHLIB_MAJOR= 3 -SHLIB_MINOR= 1 +SHLIB_MAJOR= 4 +SHLIB_MINOR= 0 CFLAGS+=-DLIBC_RCS -DSYSLIBC_RCS -I${.CURDIR}/include AINC= -I${.CURDIR}/${MACHINE_ARCH} CLEANFILES+=tags diff --git a/lib/libc/alpha/gen/setjmp.S b/lib/libc/alpha/gen/setjmp.S index a6d1083..ee56d9d 100644 --- a/lib/libc/alpha/gen/setjmp.S +++ b/lib/libc/alpha/gen/setjmp.S @@ -25,6 +25,8 @@ * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. + * + * $FreeBSD$ */ #include "SYS.h" @@ -61,9 +63,10 @@ LEAF(setjmp, 1) mov a0, s0 /* squirrel away ptr to sc */ /* see what's blocked */ - mov zero, a0 - PCALL(sigblock) /* see what's blocked */ - stq v0, (1 * 8)(s0) /* and remember it in sc_mask */ + lda a2, (71 * 8)(a0) /* oset: sc_reserved */ + mov zero, a1 /* set: NULL */ + add a1, 1, a0 /* how: SIG_BLOCK */ + PCALL(sigprocmask) /* see what's blocked */ lda sp, -24(sp) /* sizeof struct sigaltstack */ mov zero, a0 @@ -115,7 +118,7 @@ END(setjmp) LEAF(longjmp, 2) LDGP(pv) stq a1, (( 0 + 4) * 8)(a0) /* save return value */ - PCALL(sigreturn) /* use sigreturn to return */ + PCALL(osigreturn) /* use sigreturn to return */ botch: CALL(longjmperror) diff --git a/lib/libc/amd64/gen/_setjmp.S b/lib/libc/amd64/gen/_setjmp.S index 39ad5ac..c8a1d21 100644 --- a/lib/libc/amd64/gen/_setjmp.S +++ b/lib/libc/amd64/gen/_setjmp.S @@ -62,7 +62,7 @@ ENTRY(_setjmp) movl %ebp,12(%eax) movl %esi,16(%eax) movl %edi,20(%eax) - fnstcw 28(%eax) + fnstcw 24(%eax) xorl %eax,%eax ret @@ -76,7 +76,7 @@ ENTRY(_longjmp) movl 16(%edx),%esi movl 20(%edx),%edi fninit - fldcw 28(%edx) + fldcw 24(%edx) testl %eax,%eax jnz 1f incl %eax diff --git a/lib/libc/amd64/gen/setjmp.S b/lib/libc/amd64/gen/setjmp.S index 0dfdde9..e70879a 100644 --- a/lib/libc/amd64/gen/setjmp.S +++ b/lib/libc/amd64/gen/setjmp.S @@ -56,15 +56,19 @@ ENTRY(setjmp) PIC_PROLOGUE - pushl $0 + movl 4(%esp),%ecx + leal 28(%ecx), %eax + pushl %eax /* (sigset_t*)oset */ + pushl $0 /* (sigset_t*)set */ + pushl $1 /* SIG_BLOCK */ #ifdef _THREAD_SAFE - call PIC_PLT(CNAME(_thread_sys_sigblock)) + call PIC_PLT(CNAME(_thread_sys_sigprocmask)) #else - call PIC_PLT(CNAME(sigblock)) + call PIC_PLT(CNAME(sigprocmask)) #endif - popl %edx + addl $12,%esp PIC_EPILOGUE - movl 4(%esp),%ecx + movl 4(%esp),%ecx movl 0(%esp),%edx movl %edx, 0(%ecx) movl %ebx, 4(%ecx) @@ -72,21 +76,23 @@ ENTRY(setjmp) movl %ebp,12(%ecx) movl %esi,16(%ecx) movl %edi,20(%ecx) - movl %eax,24(%ecx) - fnstcw 28(%ecx) + fnstcw 24(%ecx) xorl %eax,%eax ret ENTRY(longjmp) movl 4(%esp),%edx PIC_PROLOGUE - pushl 24(%edx) + pushl $0 /* (sigset_t*)oset */ + leal 28(%edx), %eax + pushl %eax /* (sigset_t*)set */ + pushl $3 /* SIG_SETMASK */ #ifdef _THREAD_SAFE - call PIC_PLT(CNAME(_thread_sys_sigsetmask)) + call PIC_PLT(CNAME(_thread_sys_sigprocmask)) #else - call PIC_PLT(CNAME(sigsetmask)) /* XXX this is not reentrant */ + call PIC_PLT(CNAME(sigprocmask)) #endif - popl %eax + addl $12,%esp PIC_EPILOGUE movl 4(%esp),%edx movl 8(%esp),%eax @@ -97,7 +103,7 @@ ENTRY(longjmp) movl 16(%edx),%esi movl 20(%edx),%edi fninit - fldcw 28(%edx) + fldcw 24(%edx) testl %eax,%eax jnz 1f incl %eax diff --git a/lib/libc/amd64/gen/sigsetjmp.S b/lib/libc/amd64/gen/sigsetjmp.S index c3f98ff..9aa32f4 100644 --- a/lib/libc/amd64/gen/sigsetjmp.S +++ b/lib/libc/amd64/gen/sigsetjmp.S @@ -61,21 +61,23 @@ ENTRY(sigsetjmp) movl 8(%esp),%eax - movl 4(%esp),%ecx - movl %eax,32(%ecx) + movl 4(%esp),%ecx + movl %eax,44(%ecx) testl %eax,%eax jz 2f PIC_PROLOGUE - pushl $0 + leal 28(%ecx), %eax + pushl %eax /* (sigset_t*)oset */ + pushl $0 /* (sigset_t*)set */ + pushl $1 /* SIG_BLOCK */ #ifdef _THREAD_SAFE - call PIC_PLT(CNAME(_thread_sys_sigblock)) + call PIC_PLT(CNAME(_thread_sys_sigprocmask)) #else - call PIC_PLT(CNAME(sigblock)) + call PIC_PLT(CNAME(sigprocmask)) #endif - addl $4,%esp + addl $12,%esp PIC_EPILOGUE - movl 4(%esp),%ecx - movl %eax,24(%ecx) + movl 4(%esp),%ecx 2: movl 0(%esp),%edx movl %edx, 0(%ecx) movl %ebx, 4(%ecx) @@ -83,25 +85,28 @@ ENTRY(sigsetjmp) movl %ebp,12(%ecx) movl %esi,16(%ecx) movl %edi,20(%ecx) - fnstcw 28(%ecx) + fnstcw 24(%ecx) xorl %eax,%eax ret ENTRY(siglongjmp) movl 4(%esp),%edx - cmpl $0,32(%edx) + cmpl $0,44(%edx) jz 2f PIC_PROLOGUE - pushl 24(%edx) + pushl $0 /* (sigset_t*)oset */ + leal 28(%edx), %eax + pushl %eax /* (sigset_t*)set */ + pushl $3 /* SIG_SETMASK */ #ifdef _THREAD_SAFE - call PIC_PLT(CNAME(_thread_sys_sigsetmask)) + call PIC_PLT(CNAME(_thread_sys_sigprocmask)) #else - call PIC_PLT(CNAME(sigsetmask)) + call PIC_PLT(CNAME(sigprocmask)) #endif - addl $4,%esp + addl $12,%esp PIC_EPILOGUE -2: movl 4(%esp),%edx - movl 8(%esp),%eax + movl 4(%esp),%edx +2: movl 8(%esp),%eax movl 0(%edx),%ecx movl 4(%edx),%ebx movl 8(%edx),%esp @@ -109,7 +114,7 @@ ENTRY(siglongjmp) movl 16(%edx),%esi movl 20(%edx),%edi fninit - fldcw 28(%edx) + fldcw 24(%edx) testl %eax,%eax jnz 1f incl %eax diff --git a/lib/libc/amd64/sys/Makefile.inc b/lib/libc/amd64/sys/Makefile.inc index 30081e8..734e15a 100644 --- a/lib/libc/amd64/sys/Makefile.inc +++ b/lib/libc/amd64/sys/Makefile.inc @@ -5,15 +5,16 @@ SRCS+= i386_get_ioperm.c i386_get_ldt.c i386_set_ioperm.c i386_set_ldt.c \ i386_vm86.c MDASM= Ovfork.S brk.S cerror.S exect.S fork.S pipe.S \ - ptrace.S reboot.S rfork.S sbrk.S setlogin.S sigpending.S \ - sigprocmask.S sigreturn.S sigsuspend.S syscall.S + ptrace.S reboot.S rfork.S sbrk.S setlogin.S sigreturn.S syscall.S +# sigpending.S sigprocmask.S sigsuspend.S # Don't generate default code for these syscalls: NOASM= __semctl.o break.o exit.o ftruncate.o getdomainname.o getlogin.o \ lseek.o mlockall.o mmap.o msgctl.o msgget.o msgrcv.o msgsnd.o \ munlockall.o openbsd_poll.o pread.o pwrite.o semconfig.o semget.o \ semop.o setdomainname.o shmat.o shmctl.o shmdt.o shmget.o sstk.o \ - thr_sleep.o thr_wakeup.o truncate.o uname.o vfork.o yield.o + thr_sleep.o thr_wakeup.o truncate.o uname.o vfork.o yield.o \ + osigpending.o osigprocmask.o osigsuspend.o PSEUDO= _getlogin.o diff --git a/lib/libc/compat-43/sigcompat.c b/lib/libc/compat-43/sigcompat.c index 56550d2..fa25e50 100644 --- a/lib/libc/compat-43/sigcompat.c +++ b/lib/libc/compat-43/sigcompat.c @@ -29,6 +29,8 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * $FreeBSD$ */ #if defined(LIBC_SCCS) && !defined(lint) @@ -47,7 +49,8 @@ sigvec(signo, sv, osv) if (sv) sv->sv_flags ^= SV_INTERRUPT; /* !SA_INTERRUPT */ - ret = sigaction(signo, (struct sigaction *)sv, (struct sigaction *)osv); + ret = osigaction(signo, (struct osigaction *)sv, + (struct osigaction *)osv); if (ret == 0 && osv) osv->sv_flags ^= SV_INTERRUPT; /* !SA_INTERRUPT */ return (ret); @@ -57,29 +60,34 @@ int sigsetmask(mask) int mask; { - int omask, n; + sigset_t set, oset; - n = sigprocmask(SIG_SETMASK, (sigset_t *) &mask, (sigset_t *) &omask); - if (n) - return (n); - return (omask); + sigemptyset(&set); + set.__bits[0] = mask; + (void)sigprocmask(SIG_SETMASK, &set, &oset); + return (oset.__bits[0]); } int sigblock(mask) int mask; { - int omask, n; + sigset_t set, oset; + + sigemptyset(&set); + set.__bits[0] = mask; - n = sigprocmask(SIG_BLOCK, (sigset_t *) &mask, (sigset_t *) &omask); - if (n) - return (n); - return (omask); + (void)sigprocmask(SIG_BLOCK, &set, &oset); + return (oset.__bits[0]); } int sigpause(mask) int mask; { - return (sigsuspend((sigset_t *)&mask)); + sigset_t set; + + sigemptyset(&set); + set.__bits[0] = mask; + return (sigsuspend(&set)); } diff --git a/lib/libc/gen/sigsetops.c b/lib/libc/gen/sigsetops.c index 7ac903b..7206b7a 100644 --- a/lib/libc/gen/sigsetops.c +++ b/lib/libc/gen/sigsetops.c @@ -31,6 +31,8 @@ * SUCH DAMAGE. * * @(#)sigsetops.c 8.1 (Berkeley) 6/4/93 + * + * $FreeBSD$ */ #if defined(LIBC_SCCS) && !defined(lint) @@ -49,7 +51,10 @@ int sigemptyset(set) sigset_t *set; { - *set = 0; + int i; + + for (i = 0; i < _SIG_WORDS; i++) + set->__bits[i] = 0; return (0); } @@ -57,7 +62,10 @@ int sigfillset(set) sigset_t *set; { - *set = ~(sigset_t)0; + int i; + + for (i = 0; i < _SIG_WORDS; i++) + set->__bits[i] = ~(unsigned int)0; return (0); } @@ -66,7 +74,12 @@ sigaddset(set, signo) sigset_t *set; int signo; { - *set |= sigmask(signo); + + if (signo <= 0 || signo > _SIG_MAXSIG) { + /* errno = EINVAL; */ + return (-1); + } + set->__bits[_SIG_WORD(signo)] |= _SIG_BIT(signo); return (0); } @@ -75,7 +88,12 @@ sigdelset(set, signo) sigset_t *set; int signo; { - *set &= ~sigmask(signo); + + if (signo <= 0 || signo > _SIG_MAXSIG) { + /* errno = EINVAL; */ + return (-1); + } + set->__bits[_SIG_WORD(signo)] &= ~_SIG_BIT(signo); return (0); } @@ -84,5 +102,10 @@ sigismember(set, signo) const sigset_t *set; int signo; { - return ((*set & sigmask(signo)) != 0); + + if (signo <= 0 || signo > _SIG_MAXSIG) { + /* errno = EINVAL; */ + return (-1); + } + return ((set->__bits[_SIG_WORD(signo)] & _SIG_BIT(signo)) ? 1 : 0); } diff --git a/lib/libc/i386/gen/_setjmp.S b/lib/libc/i386/gen/_setjmp.S index 39ad5ac..c8a1d21 100644 --- a/lib/libc/i386/gen/_setjmp.S +++ b/lib/libc/i386/gen/_setjmp.S @@ -62,7 +62,7 @@ ENTRY(_setjmp) movl %ebp,12(%eax) movl %esi,16(%eax) movl %edi,20(%eax) - fnstcw 28(%eax) + fnstcw 24(%eax) xorl %eax,%eax ret @@ -76,7 +76,7 @@ ENTRY(_longjmp) movl 16(%edx),%esi movl 20(%edx),%edi fninit - fldcw 28(%edx) + fldcw 24(%edx) testl %eax,%eax jnz 1f incl %eax diff --git a/lib/libc/i386/gen/setjmp.S b/lib/libc/i386/gen/setjmp.S index 0dfdde9..e70879a 100644 --- a/lib/libc/i386/gen/setjmp.S +++ b/lib/libc/i386/gen/setjmp.S @@ -56,15 +56,19 @@ ENTRY(setjmp) PIC_PROLOGUE - pushl $0 + movl 4(%esp),%ecx + leal 28(%ecx), %eax + pushl %eax /* (sigset_t*)oset */ + pushl $0 /* (sigset_t*)set */ + pushl $1 /* SIG_BLOCK */ #ifdef _THREAD_SAFE - call PIC_PLT(CNAME(_thread_sys_sigblock)) + call PIC_PLT(CNAME(_thread_sys_sigprocmask)) #else - call PIC_PLT(CNAME(sigblock)) + call PIC_PLT(CNAME(sigprocmask)) #endif - popl %edx + addl $12,%esp PIC_EPILOGUE - movl 4(%esp),%ecx + movl 4(%esp),%ecx movl 0(%esp),%edx movl %edx, 0(%ecx) movl %ebx, 4(%ecx) @@ -72,21 +76,23 @@ ENTRY(setjmp) movl %ebp,12(%ecx) movl %esi,16(%ecx) movl %edi,20(%ecx) - movl %eax,24(%ecx) - fnstcw 28(%ecx) + fnstcw 24(%ecx) xorl %eax,%eax ret ENTRY(longjmp) movl 4(%esp),%edx PIC_PROLOGUE - pushl 24(%edx) + pushl $0 /* (sigset_t*)oset */ + leal 28(%edx), %eax + pushl %eax /* (sigset_t*)set */ + pushl $3 /* SIG_SETMASK */ #ifdef _THREAD_SAFE - call PIC_PLT(CNAME(_thread_sys_sigsetmask)) + call PIC_PLT(CNAME(_thread_sys_sigprocmask)) #else - call PIC_PLT(CNAME(sigsetmask)) /* XXX this is not reentrant */ + call PIC_PLT(CNAME(sigprocmask)) #endif - popl %eax + addl $12,%esp PIC_EPILOGUE movl 4(%esp),%edx movl 8(%esp),%eax @@ -97,7 +103,7 @@ ENTRY(longjmp) movl 16(%edx),%esi movl 20(%edx),%edi fninit - fldcw 28(%edx) + fldcw 24(%edx) testl %eax,%eax jnz 1f incl %eax diff --git a/lib/libc/i386/gen/sigsetjmp.S b/lib/libc/i386/gen/sigsetjmp.S index c3f98ff..9aa32f4 100644 --- a/lib/libc/i386/gen/sigsetjmp.S +++ b/lib/libc/i386/gen/sigsetjmp.S @@ -61,21 +61,23 @@ ENTRY(sigsetjmp) movl 8(%esp),%eax - movl 4(%esp),%ecx - movl %eax,32(%ecx) + movl 4(%esp),%ecx + movl %eax,44(%ecx) testl %eax,%eax jz 2f PIC_PROLOGUE - pushl $0 + leal 28(%ecx), %eax + pushl %eax /* (sigset_t*)oset */ + pushl $0 /* (sigset_t*)set */ + pushl $1 /* SIG_BLOCK */ #ifdef _THREAD_SAFE - call PIC_PLT(CNAME(_thread_sys_sigblock)) + call PIC_PLT(CNAME(_thread_sys_sigprocmask)) #else - call PIC_PLT(CNAME(sigblock)) + call PIC_PLT(CNAME(sigprocmask)) #endif - addl $4,%esp + addl $12,%esp PIC_EPILOGUE - movl 4(%esp),%ecx - movl %eax,24(%ecx) + movl 4(%esp),%ecx 2: movl 0(%esp),%edx movl %edx, 0(%ecx) movl %ebx, 4(%ecx) @@ -83,25 +85,28 @@ ENTRY(sigsetjmp) movl %ebp,12(%ecx) movl %esi,16(%ecx) movl %edi,20(%ecx) - fnstcw 28(%ecx) + fnstcw 24(%ecx) xorl %eax,%eax ret ENTRY(siglongjmp) movl 4(%esp),%edx - cmpl $0,32(%edx) + cmpl $0,44(%edx) jz 2f PIC_PROLOGUE - pushl 24(%edx) + pushl $0 /* (sigset_t*)oset */ + leal 28(%edx), %eax + pushl %eax /* (sigset_t*)set */ + pushl $3 /* SIG_SETMASK */ #ifdef _THREAD_SAFE - call PIC_PLT(CNAME(_thread_sys_sigsetmask)) + call PIC_PLT(CNAME(_thread_sys_sigprocmask)) #else - call PIC_PLT(CNAME(sigsetmask)) + call PIC_PLT(CNAME(sigprocmask)) #endif - addl $4,%esp + addl $12,%esp PIC_EPILOGUE -2: movl 4(%esp),%edx - movl 8(%esp),%eax + movl 4(%esp),%edx +2: movl 8(%esp),%eax movl 0(%edx),%ecx movl 4(%edx),%ebx movl 8(%edx),%esp @@ -109,7 +114,7 @@ ENTRY(siglongjmp) movl 16(%edx),%esi movl 20(%edx),%edi fninit - fldcw 28(%edx) + fldcw 24(%edx) testl %eax,%eax jnz 1f incl %eax diff --git a/lib/libc/i386/sys/Makefile.inc b/lib/libc/i386/sys/Makefile.inc index 30081e8..734e15a 100644 --- a/lib/libc/i386/sys/Makefile.inc +++ b/lib/libc/i386/sys/Makefile.inc @@ -5,15 +5,16 @@ SRCS+= i386_get_ioperm.c i386_get_ldt.c i386_set_ioperm.c i386_set_ldt.c \ i386_vm86.c MDASM= Ovfork.S brk.S cerror.S exect.S fork.S pipe.S \ - ptrace.S reboot.S rfork.S sbrk.S setlogin.S sigpending.S \ - sigprocmask.S sigreturn.S sigsuspend.S syscall.S + ptrace.S reboot.S rfork.S sbrk.S setlogin.S sigreturn.S syscall.S +# sigpending.S sigprocmask.S sigsuspend.S # Don't generate default code for these syscalls: NOASM= __semctl.o break.o exit.o ftruncate.o getdomainname.o getlogin.o \ lseek.o mlockall.o mmap.o msgctl.o msgget.o msgrcv.o msgsnd.o \ munlockall.o openbsd_poll.o pread.o pwrite.o semconfig.o semget.o \ semop.o setdomainname.o shmat.o shmctl.o shmdt.o shmget.o sstk.o \ - thr_sleep.o thr_wakeup.o truncate.o uname.o vfork.o yield.o + thr_sleep.o thr_wakeup.o truncate.o uname.o vfork.o yield.o \ + osigpending.o osigprocmask.o osigsuspend.o PSEUDO= _getlogin.o |