diff options
author | Ulrich Drepper <drepper@redhat.com> | 1999-06-13 09:23:55 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1999-06-13 09:23:55 +0000 |
commit | b77ab157d4bbccd7b67fb59e6b22d925be065169 (patch) | |
tree | c0a6e736aa9afe74000c736e96ee7fae5b15ad8d /sysdeps/unix | |
parent | ca0350310e775f12d1f5a5f8b99d32bc6f69f274 (diff) |
Update from main branch.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/sigaction.c | 79 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/if_index.c | 22 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/net/if_arp.h | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sys/sysmacros.h | 6 |
4 files changed, 53 insertions, 55 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/sigaction.c b/sysdeps/unix/sysv/linux/i386/sigaction.c index 142eac6a75..57b2fa836d 100644 --- a/sysdeps/unix/sysv/linux/i386/sigaction.c +++ b/sysdeps/unix/sysv/linux/i386/sigaction.c @@ -1,5 +1,5 @@ /* POSIX.1 `sigaction' call for Linux/i386. - Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1991, 95, 96, 97, 98, 99 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -30,6 +30,8 @@ translate it here. */ #include <kernel_sigaction.h> +/* We do not globally define the SA_RESTORER flag so do it here. */ +#define SA_RESTORER 0x04000000 extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *, struct kernel_sigaction *, size_t); @@ -38,6 +40,8 @@ extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *, functions which have RT equivalents. */ int __libc_missing_rt_sigs; +static void restore_rt (void) asm ("__restore_rt"); +static void restore (void) asm ("__restore"); /* If ACT is not NULL, change the action for SIG to *ACT. If OACT is not NULL, put the old action for SIG in *OACT. */ @@ -58,10 +62,10 @@ __sigaction (int sig, const struct sigaction *act, struct sigaction *oact) { kact.k_sa_handler = act->sa_handler; memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); - kact.sa_flags = act->sa_flags; + kact.sa_flags = act->sa_flags | SA_RESTORER; - kact.sa_restorer = ((act->sa_flags & SA_NOMASK) - ? &&restore_nomask : &&restore); + kact.sa_restorer = ((act->sa_flags & SA_SIGINFO) + ? &restore_rt : &restore); } /* XXX The size argument hopefully will have to be changed to the @@ -90,10 +94,9 @@ __sigaction (int sig, const struct sigaction *act, struct sigaction *oact) { k_newact.k_sa_handler = act->sa_handler; k_newact.sa_mask = act->sa_mask.__val[0]; - k_newact.sa_flags = act->sa_flags; + k_newact.sa_flags = act->sa_flags | SA_RESTORER; - k_newact.sa_restorer = ((act->sa_flags & SA_NOMASK) - ? &&restore_nomask : &&restore); + k_newact.sa_restorer = &restore; } asm volatile ("pushl %%ebx\n" @@ -119,41 +122,33 @@ __sigaction (int sig, const struct sigaction *act, struct sigaction *oact) } return 0; - - restore: - asm ( -#ifdef PIC - " pushl %%ebx\n" - " call 0f\n" - "0: popl %%ebx\n" - " addl $_GLOBAL_OFFSET_TABLE_+[.-0b], %%ebx\n" - " addl $8, %%esp\n" - " call __sigsetmask@PLT\n" - " addl $8, %%esp\n" - " popl %%ebx\n" -#else - " addl $4, %%esp\n" - " call __sigsetmask\n" - " addl $4, %%esp\n" -#endif - " popl %%eax\n" - " popl %%ecx\n" - " popl %%edx\n" - " popf\n" - " ret" - : : ); - - restore_nomask: - asm (" addl $4, %%esp\n" - " popl %%eax\n" - " popl %%ecx\n" - " popl %%edx\n" - " popf\n" - " ret" - : : ); - - /* NOTREACHED */ - return -1; } weak_alias (__sigaction, sigaction) + +#define RESTORE(name, syscall) RESTORE2 (name, syscall) +#define RESTORE2(name, syscall) \ +asm \ + ( \ + ".align 16\n" \ + "__" #name ":\n" \ + " movl $" #syscall ", %eax\n" \ + " int $0x80" \ + ); + +/* The return code for realtime-signals. */ +RESTORE (restore_rt, __NR_rt_sigreturn) + +/* For the boring old signals. */ +# undef RESTORE2 +# define RESTORE2(name, syscall) \ +asm \ + ( \ + ".align 8\n" \ + "__" #name ":\n" \ + " popl %eax\n" \ + " movl $" #syscall ", %eax\n" \ + " int $0x80" \ + ); + +RESTORE (restore, __NR_sigreturn) diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c index 9b3db6abfb..17f93bae33 100644 --- a/sysdeps/unix/sysv/linux/if_index.c +++ b/sysdeps/unix/sysv/linux/if_index.c @@ -27,7 +27,7 @@ #include <bits/libc-lock.h> /* Try to get a socket to talk to the kernel. */ -#if defined SIOGIFINDEX || defined SIOGIFNAME +#if defined SIOCGIFINDEX || defined SIOCGIFNAME static int internal_function opensock (void) @@ -71,7 +71,7 @@ opensock (void) unsigned int if_nametoindex (const char *ifname) { -#ifndef SIOGIFINDEX +#ifndef SIOCGIFINDEX __set_errno (ENOSYS); return 0; #else @@ -82,7 +82,7 @@ if_nametoindex (const char *ifname) return 0; strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); - if (__ioctl (fd, SIOGIFINDEX, &ifr) < 0) + if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0) { int saved_errno = errno; __close (fd); @@ -111,7 +111,7 @@ if_freenameindex (struct if_nameindex *ifn) struct if_nameindex * if_nameindex (void) { -#ifndef SIOGIFINDEX +#ifndef SIOCGIFINDEX __set_errno (ENOSYS); return NULL; #else @@ -172,7 +172,7 @@ if_nameindex (void) struct ifreq *ifr = &ifc.ifc_req[i]; idx[i].if_name = __strdup (ifr->ifr_name); if (idx[i].if_name == NULL - || __ioctl (fd, SIOGIFINDEX, ifr) < 0) + || __ioctl (fd, SIOCGIFINDEX, ifr) < 0) { int saved_errno = errno; unsigned int j; @@ -199,7 +199,7 @@ if_nameindex (void) char * if_indextoname (unsigned int ifindex, char *ifname) { -#ifndef SIOGIFINDEX +#ifndef SIOCGIFINDEX __set_errno (ENOSYS); return NULL; #else @@ -207,14 +207,14 @@ if_indextoname (unsigned int ifindex, char *ifname) struct if_nameindex *p; char *result = NULL; -#ifdef SIOGIFNAME +#ifdef SIOCGIFNAME /* We may be able to do the conversion directly, rather than searching a list. This ioctl is not present in kernels before version 2.1.50. */ struct ifreq ifr; int fd; - static int siogifname_works_not; + static int siocgifname_works_not; - if (!siogifname_works_not) + if (!siocgifname_works_not) { int serrno = errno; @@ -224,10 +224,10 @@ if_indextoname (unsigned int ifindex, char *ifname) return NULL; ifr.ifr_ifindex = ifindex; - if (__ioctl (fd, SIOGIFNAME, &ifr) < 0) + if (__ioctl (fd, SIOCGIFNAME, &ifr) < 0) { if (errno == EINVAL) - siogifname_works_not = 1; /* Don't make the same mistake twice. */ + siocgifname_works_not = 1; /* Don't make the same mistake twice. */ } else { diff --git a/sysdeps/unix/sysv/linux/net/if_arp.h b/sysdeps/unix/sysv/linux/net/if_arp.h index c4ac8e8400..25d65702cd 100644 --- a/sysdeps/unix/sysv/linux/net/if_arp.h +++ b/sysdeps/unix/sysv/linux/net/if_arp.h @@ -92,6 +92,7 @@ struct arphdr #define ARPHRD_PPP 512 #define ARPHRD_HDLC 513 /* (Cisco) HDLC. */ #define ARPHRD_LAPB 516 /* LAPB. */ +#define ARPHRD_DDCMP 517 /* Digital's DDCMP. */ #define ARPHRD_TUNNEL 768 /* IPIP tunnel. */ #define ARPHRD_TUNNEL6 769 /* IPIP6 tunnel. */ diff --git a/sysdeps/unix/sysv/linux/sys/sysmacros.h b/sysdeps/unix/sysv/linux/sys/sysmacros.h index 4c065393a6..63c1343284 100644 --- a/sysdeps/unix/sysv/linux/sys/sysmacros.h +++ b/sysdeps/unix/sysv/linux/sys/sysmacros.h @@ -27,11 +27,13 @@ #if defined __GNUC__ && __GNUC__ >= 2 # define major(dev) ((int)(((dev) >> 8) & 0xff)) # define minor(dev) ((int)((dev) & 0xff)) -# define makedev(major, minor) (((major) << 8) | (minor)) +# define makedev(major, minor) ((((unsigned int) (major)) << 8) \ + | ((unsigned int) (minor))) #else # define major(dev) (((dev).__val[0] >> 8) & 0xff) # define minor(dev) ((dev).__val[0] & 0xff) -# define makedev(major, minor) { (((major) << 8) | (minor)), 0 } +# define makedev(major, minor) { ((((unsigned int) (major)) << 8) \ + | ((unsigned int) (minor))), 0 } #endif #endif /* sys/sysmacros.h */ |