diff options
Diffstat (limited to 'libc/ports/sysdeps/unix/sysv/linux')
19 files changed, 273 insertions, 578 deletions
diff --git a/libc/ports/sysdeps/unix/sysv/linux/aarch64/dl-cache.h b/libc/ports/sysdeps/unix/sysv/linux/aarch64/dl-cache.h new file mode 100644 index 000000000..1aa1a84af --- /dev/null +++ b/libc/ports/sysdeps/unix/sysv/linux/aarch64/dl-cache.h @@ -0,0 +1,45 @@ +/* Support for reading /etc/ld.so.cache files written by Linux ldconfig. + Copyright (C) 2003-2012 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + <http://www.gnu.org/licenses/>. */ + +#include <ldconfig.h> + +#define _DL_CACHE_DEFAULT_ID (FLAG_AARCH64_LIB64 | FLAG_ELF_LIBC6) + +#define _dl_cache_check_flags(flags) \ + ((flags) == _DL_CACHE_DEFAULT_ID) + +#define add_system_dir(dir) \ + do \ + { \ + size_t len = strlen (dir); \ + char path[len + 3]; \ + memcpy (path, dir, len + 1); \ + if (len >= 6 && ! memcmp (path + len - 6, "/lib64", 6)) \ + { \ + len -= 2; \ + path[len] = '\0'; \ + } \ + add_dir (path); \ + if (len >= 4 && ! memcmp (path + len - 4, "/lib", 4)) \ + { \ + memcpy (path + len, "64", 3); \ + add_dir (path); \ + } \ + } while (0) + +#include_next <dl-cache.h> diff --git a/libc/ports/sysdeps/unix/sysv/linux/aarch64/nptl/lowlevellock.h b/libc/ports/sysdeps/unix/sysv/linux/aarch64/nptl/lowlevellock.h index e4f0c9427..705cffd35 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/aarch64/nptl/lowlevellock.h +++ b/libc/ports/sysdeps/unix/sysv/linux/aarch64/nptl/lowlevellock.h @@ -96,7 +96,7 @@ __lll_private_flag (__op, private), \ (val), (timespec), NULL /* Unused. */, \ FUTEX_BITSET_MATCH_ANY); \ - INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \ + __ret; \ }) #define lll_futex_wake(futexp, nr, private) \ diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/Makefile b/libc/ports/sysdeps/unix/sysv/linux/arm/Makefile index bda3ea9f7..be7946e96 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/arm/Makefile +++ b/libc/ports/sysdeps/unix/sysv/linux/arm/Makefile @@ -70,25 +70,16 @@ LDFLAGS-tst-rfc3484-2 += $(common-objpfx)csu/libc-do-syscall.o LDFLAGS-tst-rfc3484-3 += $(common-objpfx)csu/libc-do-syscall.o endif -define default-abi-prog -echo '#ifdef __ARM_PCS_VFP'; -echo 'hard'; -echo '#else'; -echo 'soft'; -echo '#endif' -endef -default-abi := $(strip $(shell \ - ($(default-abi-prog)) | $(CC) $(CFLAGS) $(CPPFLAGS) -E -P -)) -ifeq ($(default-abi),hard) -# OK. -else -ifneq ($(default-abi),soft) -Unknown ABI, must be "hard" or "soft". -endif +# Get value of default-abi. +include $(common-objpfx)default-abi.make + +abi-variants := soft hard + +ifeq (,$(filter $(default-abi),$(abi-variants))) +Unknown ABI, must be one of $(abi-variants) endif abi-includes := -abi-variants := soft hard abi-soft-options := -U__ARM_PCS_VFP abi-soft-condition := !defined __ARM_PCS_VFP abi-soft-ld-soname := ld-linux.so.3 diff --git a/libc/ports/sysdeps/unix/sysv/linux/hppa/____longjmp_chk.c b/libc/ports/sysdeps/unix/sysv/linux/hppa/____longjmp_chk.c new file mode 100644 index 000000000..46357ddba --- /dev/null +++ b/libc/ports/sysdeps/unix/sysv/linux/hppa/____longjmp_chk.c @@ -0,0 +1,47 @@ +/* Copyright (C) 2009-2012 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to the Free + Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + +#include <stdio.h> +#include <signal.h> +#include <sysdep.h> +#define __longjmp ____longjmp_chk +#define CHECK_SP(sp) \ + do { \ + register unsigned long this_sp asm ("r30"); \ + /* The stack grows up, therefore frames that were created and then \ + destroyed must all have stack values higher than ours. */ \ + if ((unsigned long) (sp) > this_sp) \ + { \ + struct sigaltstack oss; \ + INTERNAL_SYSCALL_DECL (err); \ + int result = INTERNAL_SYSCALL (sigaltstack, err, 2, NULL, &oss);\ + /* If we aren't using an alternate stack then we have already \ + shown that we are jumping to a frame that doesn't exist so \ + error out. If we are using an alternate stack we must prove \ + that we are jumping *out* of the alternate stack. Note that \ + the check for that is the same as that for _STACK_GROWS_UP \ + as for _STACK_GROWS_DOWN. */ \ + if (!INTERNAL_SYSCALL_ERROR_P (result, err) \ + && ((oss.ss_flags & SS_ONSTACK) == 0 \ + || ((unsigned long) oss.ss_sp + oss.ss_size \ + - (unsigned long) (sp)) < oss.ss_size)) \ + __fortify_fail ("longjmp causes uninitialized stack frame"); \ + } \ + } while (0) + +#include <__longjmp.c> diff --git a/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/socket.h b/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/socket.h deleted file mode 100644 index 7870f751e..000000000 --- a/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/socket.h +++ /dev/null @@ -1,444 +0,0 @@ -/* System-specific socket constants and types. Linux version. - Copyright (C) 1991-2012 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 - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#ifndef __BITS_SOCKET_H -#define __BITS_SOCKET_H - -#ifndef _SYS_SOCKET_H -# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead." -#endif - -#define __need_size_t -#include <stddef.h> - -#include <sys/types.h> - -/* Type for length arguments in socket calls. */ -#ifndef __socklen_t_defined -typedef __socklen_t socklen_t; -# define __socklen_t_defined -#endif - -/* Types of sockets. */ -enum __socket_type -{ - SOCK_STREAM = 1, /* Sequenced, reliable, connection-based - byte streams. */ -#define SOCK_STREAM SOCK_STREAM - SOCK_DGRAM = 2, /* Connectionless, unreliable datagrams - of fixed maximum length. */ -#define SOCK_DGRAM SOCK_DGRAM - SOCK_RAW = 3, /* Raw protocol interface. */ -#define SOCK_RAW SOCK_RAW - SOCK_RDM = 4, /* Reliably-delivered messages. */ -#define SOCK_RDM SOCK_RDM - SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based, - datagrams of fixed maximum length. */ -#define SOCK_SEQPACKET SOCK_SEQPACKET - SOCK_DCCP = 6, /* Datagram Congestion Control Protocol. */ -#define SOCK_DCCP SOCK_DCCP - SOCK_PACKET = 10, /* Linux specific way of getting packets - at the dev level. For writing rarp and - other similar things on the user level. */ -#define SOCK_PACKET SOCK_PACKET - - /* Flags to be ORed into the type parameter of socket and socketpair and - used for the flags parameter of paccept. */ - - SOCK_CLOEXEC = 010000000, /* Atomically set close-on-exec flag for the - new descriptor(s). */ -#define SOCK_CLOEXEC SOCK_CLOEXEC - SOCK_NONBLOCK = 0x40000000 /* Atomically mark descriptor(s) as - non-blocking. */ -#define SOCK_NONBLOCK SOCK_NONBLOCK -}; - -/* Protocol families. */ -#define PF_UNSPEC 0 /* Unspecified. */ -#define PF_LOCAL 1 /* Local to host (pipes and file-domain). */ -#define PF_UNIX PF_LOCAL /* POSIX name for PF_LOCAL. */ -#define PF_FILE PF_LOCAL /* Another non-standard name for PF_LOCAL. */ -#define PF_INET 2 /* IP protocol family. */ -#define PF_AX25 3 /* Amateur Radio AX.25. */ -#define PF_IPX 4 /* Novell Internet Protocol. */ -#define PF_APPLETALK 5 /* Appletalk DDP. */ -#define PF_NETROM 6 /* Amateur radio NetROM. */ -#define PF_BRIDGE 7 /* Multiprotocol bridge. */ -#define PF_ATMPVC 8 /* ATM PVCs. */ -#define PF_X25 9 /* Reserved for X.25 project. */ -#define PF_INET6 10 /* IP version 6. */ -#define PF_ROSE 11 /* Amateur Radio X.25 PLP. */ -#define PF_DECnet 12 /* Reserved for DECnet project. */ -#define PF_NETBEUI 13 /* Reserved for 802.2LLC project. */ -#define PF_SECURITY 14 /* Security callback pseudo AF. */ -#define PF_KEY 15 /* PF_KEY key management API. */ -#define PF_NETLINK 16 -#define PF_ROUTE PF_NETLINK /* Alias to emulate 4.4BSD. */ -#define PF_PACKET 17 /* Packet family. */ -#define PF_ASH 18 /* Ash. */ -#define PF_ECONET 19 /* Acorn Econet. */ -#define PF_ATMSVC 20 /* ATM SVCs. */ -#define PF_RDS 21 /* RDS sockets. */ -#define PF_SNA 22 /* Linux SNA Project */ -#define PF_IRDA 23 /* IRDA sockets. */ -#define PF_PPPOX 24 /* PPPoX sockets. */ -#define PF_WANPIPE 25 /* Wanpipe API sockets. */ -#define PF_LLC 26 /* Linux LLC. */ -#define PF_CAN 29 /* Controller Area Network. */ -#define PF_TIPC 30 /* TIPC sockets. */ -#define PF_BLUETOOTH 31 /* Bluetooth sockets. */ -#define PF_IUCV 32 /* IUCV sockets. */ -#define PF_RXRPC 33 /* RxRPC sockets. */ -#define PF_ISDN 34 /* mISDN sockets. */ -#define PF_PHONET 35 /* Phonet sockets. */ -#define PF_IEEE802154 36 /* IEEE 802.15.4 sockets. */ -#define PF_CAIF 37 /* CAIF sockets. */ -#define PF_ALG 38 /* Algorithm sockets. */ -#define PF_NFC 39 /* NFC sockets. */ -#define PF_MAX 40 /* For now.. */ - -/* Address families. */ -#define AF_UNSPEC PF_UNSPEC -#define AF_LOCAL PF_LOCAL -#define AF_UNIX PF_UNIX -#define AF_FILE PF_FILE -#define AF_INET PF_INET -#define AF_AX25 PF_AX25 -#define AF_IPX PF_IPX -#define AF_APPLETALK PF_APPLETALK -#define AF_NETROM PF_NETROM -#define AF_BRIDGE PF_BRIDGE -#define AF_ATMPVC PF_ATMPVC -#define AF_X25 PF_X25 -#define AF_INET6 PF_INET6 -#define AF_ROSE PF_ROSE -#define AF_DECnet PF_DECnet -#define AF_NETBEUI PF_NETBEUI -#define AF_SECURITY PF_SECURITY -#define AF_KEY PF_KEY -#define AF_NETLINK PF_NETLINK -#define AF_ROUTE PF_ROUTE -#define AF_PACKET PF_PACKET -#define AF_ASH PF_ASH -#define AF_ECONET PF_ECONET -#define AF_ATMSVC PF_ATMSVC -#define AF_RDS PF_RDS -#define AF_SNA PF_SNA -#define AF_IRDA PF_IRDA -#define AF_PPPOX PF_PPPOX -#define AF_WANPIPE PF_WANPIPE -#define AF_LLC PF_LLC -#define AF_CAN PF_CAN -#define AF_TIPC PF_TIPC -#define AF_BLUETOOTH PF_BLUETOOTH -#define AF_IUCV PF_IUCV -#define AF_RXRPC PF_RXRPC -#define AF_ISDN PF_ISDN -#define AF_PHONET PF_PHONET -#define AF_IEEE802154 PF_IEEE802154 -#define AF_CAIF PF_CAIF -#define AF_ALG PF_ALG -#define AF_NFC PF_NFC -#define AF_MAX PF_MAX - -/* Socket level values. Others are defined in the appropriate headers. - - XXX These definitions also should go into the appropriate headers as - far as they are available. */ -#define SOL_RAW 255 -#define SOL_DECNET 261 -#define SOL_X25 262 -#define SOL_PACKET 263 -#define SOL_ATM 264 /* ATM layer (cell level). */ -#define SOL_AAL 265 /* ATM Adaption Layer (packet level). */ -#define SOL_IRDA 266 - -/* Maximum queue length specifiable by listen. */ -#define SOMAXCONN 128 - -/* Get the definition of the macro to define the common sockaddr members. */ -#include <bits/sockaddr.h> - -/* Structure describing a generic socket address. */ -struct sockaddr - { - __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ - char sa_data[14]; /* Address data. */ - }; - - -/* Structure large enough to hold any socket address (with the historical - exception of AF_UNIX). We reserve 128 bytes. */ -#define __ss_aligntype unsigned long int -#define _SS_SIZE 128 -#define _SS_PADSIZE (_SS_SIZE - (2 * sizeof (__ss_aligntype))) - -struct sockaddr_storage - { - __SOCKADDR_COMMON (ss_); /* Address family, etc. */ - __ss_aligntype __ss_align; /* Force desired alignment. */ - char __ss_padding[_SS_PADSIZE]; - }; - - -/* Bits in the FLAGS argument to `send', `recv', et al. */ -enum - { - MSG_OOB = 0x01, /* Process out-of-band data. */ -#define MSG_OOB MSG_OOB - MSG_PEEK = 0x02, /* Peek at incoming messages. */ -#define MSG_PEEK MSG_PEEK - MSG_DONTROUTE = 0x04, /* Don't use local routing. */ -#define MSG_DONTROUTE MSG_DONTROUTE -#ifdef __USE_GNU - /* DECnet uses a different name. */ - MSG_TRYHARD = MSG_DONTROUTE, -# define MSG_TRYHARD MSG_DONTROUTE -#endif - MSG_CTRUNC = 0x08, /* Control data lost before delivery. */ -#define MSG_CTRUNC MSG_CTRUNC - MSG_PROXY = 0x10, /* Supply or ask second address. */ -#define MSG_PROXY MSG_PROXY - MSG_TRUNC = 0x20, -#define MSG_TRUNC MSG_TRUNC - MSG_DONTWAIT = 0x40, /* Nonblocking IO. */ -#define MSG_DONTWAIT MSG_DONTWAIT - MSG_EOR = 0x80, /* End of record. */ -#define MSG_EOR MSG_EOR - MSG_WAITALL = 0x100, /* Wait for a full request. */ -#define MSG_WAITALL MSG_WAITALL - MSG_FIN = 0x200, -#define MSG_FIN MSG_FIN - MSG_SYN = 0x400, -#define MSG_SYN MSG_SYN - MSG_CONFIRM = 0x800, /* Confirm path validity. */ -#define MSG_CONFIRM MSG_CONFIRM - MSG_RST = 0x1000, -#define MSG_RST MSG_RST - MSG_ERRQUEUE = 0x2000, /* Fetch message from error queue. */ -#define MSG_ERRQUEUE MSG_ERRQUEUE - MSG_NOSIGNAL = 0x4000, /* Do not generate SIGPIPE. */ -#define MSG_NOSIGNAL MSG_NOSIGNAL - MSG_MORE = 0x8000, /* Sender will send more. */ -#define MSG_MORE MSG_MORE - MSG_WAITFORONE = 0x10000, /* Wait for at least one packet to return.*/ -#define MSG_WAITFORONE MSG_WAITFORONE - - MSG_CMSG_CLOEXEC = 0x40000000 /* Set close_on_exit for file - descriptor received through - SCM_RIGHTS. */ -#define MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC - }; - - -/* Structure describing messages sent by - `sendmsg' and received by `recvmsg'. */ -struct msghdr - { - void *msg_name; /* Address to send to/receive from. */ - socklen_t msg_namelen; /* Length of address data. */ - - struct iovec *msg_iov; /* Vector of data to send/receive into. */ - size_t msg_iovlen; /* Number of elements in the vector. */ - - void *msg_control; /* Ancillary data (eg BSD filedesc passing). */ - size_t msg_controllen; /* Ancillary data buffer length. - !! The type should be socklen_t but the - definition of the kernel is incompatible - with this. */ - - int msg_flags; /* Flags on received message. */ - }; - -#ifdef __USE_GNU -/* For `recvmmsg'. */ -struct mmsghdr - { - struct msghdr msg_hdr; /* Actual message header. */ - unsigned int msg_len; /* Number of received bytes for the entry. */ - }; -#endif - -/* Structure used for storage of ancillary data object information. */ -struct cmsghdr - { - size_t cmsg_len; /* Length of data in cmsg_data plus length - of cmsghdr structure. - !! The type should be socklen_t but the - definition of the kernel is incompatible - with this. */ - int cmsg_level; /* Originating protocol. */ - int cmsg_type; /* Protocol specific type. */ -#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L - __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data. */ -#endif - }; - -/* Ancillary data object manipulation macros. */ -#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L -# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data) -#else -# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1)) -#endif -#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg) -#define CMSG_FIRSTHDR(mhdr) \ - ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \ - ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0) -#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \ - & (size_t) ~(sizeof (size_t) - 1)) -#define CMSG_SPACE(len) (CMSG_ALIGN (len) \ - + CMSG_ALIGN (sizeof (struct cmsghdr))) -#define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len)) - -extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr, - struct cmsghdr *__cmsg) __THROW; -#ifdef __USE_EXTERN_INLINES -# ifndef _EXTERN_INLINE -# define _EXTERN_INLINE __extern_inline -# endif -_EXTERN_INLINE struct cmsghdr * -__NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)) -{ - if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr)) - /* The kernel header does this so there may be a reason. */ - return (struct cmsghdr *) 0; - - __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg - + CMSG_ALIGN (__cmsg->cmsg_len)); - if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) __mhdr->msg_control - + __mhdr->msg_controllen) - || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len) - > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen))) - /* No more entries. */ - return (struct cmsghdr *) 0; - return __cmsg; -} -#endif /* Use `extern inline'. */ - -/* Socket level message types. This must match the definitions in - <linux/socket.h>. */ -enum - { - SCM_RIGHTS = 0x01 /* Transfer file descriptors. */ -#define SCM_RIGHTS SCM_RIGHTS -#ifdef __USE_GNU - , SCM_CREDENTIALS = 0x02 /* Credentials passing. */ -# define SCM_CREDENTIALS SCM_CREDENTIALS -#endif - }; - -#ifdef __USE_GNU -/* User visible structure for SCM_CREDENTIALS message */ -struct ucred -{ - pid_t pid; /* PID of sending process. */ - uid_t uid; /* UID of sending process. */ - gid_t gid; /* GID of sending process. */ -}; -#endif - -/* Ugly workaround for unclean kernel headers. */ -#if !defined __USE_MISC && !defined __USE_GNU -# ifndef FIOGETOWN -# define __SYS_SOCKET_H_undef_FIOGETOWN -# endif -# ifndef FIOSETOWN -# define __SYS_SOCKET_H_undef_FIOSETOWN -# endif -# ifndef SIOCATMARK -# define __SYS_SOCKET_H_undef_SIOCATMARK -# endif -# ifndef SIOCGPGRP -# define __SYS_SOCKET_H_undef_SIOCGPGRP -# endif -# ifndef SIOCGSTAMP -# define __SYS_SOCKET_H_undef_SIOCGSTAMP -# endif -# ifndef SIOCGSTAMPNS -# define __SYS_SOCKET_H_undef_SIOCGSTAMPNS -# endif -# ifndef SIOCSPGRP -# define __SYS_SOCKET_H_undef_SIOCSPGRP -# endif -#endif - -/* Get socket manipulation related informations from kernel headers. */ -#include <asm/socket.h> - -#if !defined __USE_MISC && !defined __USE_GNU -# ifdef __SYS_SOCKET_H_undef_FIOGETOWN -# undef __SYS_SOCKET_H_undef_FIOGETOWN -# undef FIOGETOWN -# endif -# ifdef __SYS_SOCKET_H_undef_FIOSETOWN -# undef __SYS_SOCKET_H_undef_FIOSETOWN -# undef FIOSETOWN -# endif -# ifdef __SYS_SOCKET_H_undef_SIOCATMARK -# undef __SYS_SOCKET_H_undef_SIOCATMARK -# undef SIOCATMARK -# endif -# ifdef __SYS_SOCKET_H_undef_SIOCGPGRP -# undef __SYS_SOCKET_H_undef_SIOCGPGRP -# undef SIOCGPGRP -# endif -# ifdef __SYS_SOCKET_H_undef_SIOCGSTAMP -# undef __SYS_SOCKET_H_undef_SIOCGSTAMP -# undef SIOCGSTAMP -# endif -# ifdef __SYS_SOCKET_H_undef_SIOCGSTAMPNS -# undef __SYS_SOCKET_H_undef_SIOCGSTAMPNS -# undef SIOCGSTAMPNS -# endif -# ifdef __SYS_SOCKET_H_undef_SIOCSPGRP -# undef __SYS_SOCKET_H_undef_SIOCSPGRP -# undef SIOCSPGRP -# endif -#endif - -/* Structure used to manipulate the SO_LINGER option. */ -struct linger - { - int l_onoff; /* Nonzero to linger on close. */ - int l_linger; /* Time to linger. */ - }; - - -__BEGIN_DECLS - -#ifdef __USE_GNU -/* Receive up to VLEN messages as described by VMESSAGES from socket FD. - Returns the number of bytes read or -1 for errors. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int recvmmsg (int __fd, struct mmsghdr *__vmessages, - unsigned int __vlen, int __flags, - const struct timespec *__tmo); - -/* Send a VLEN messages as described by VMESSAGES to socket FD. - Return the number of datagrams successfully written or -1 for errors. -This function is a cancellation point and therefore not marked with - __THROW. */ -extern int sendmmsg (int __fd, struct mmsghdr *__vmessages, - unsigned int __vlen, int __flags); -#endif - -__END_DECLS - -#endif /* bits/socket.h */ diff --git a/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/socket_type.h b/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/socket_type.h new file mode 100644 index 000000000..ae2df6dd8 --- /dev/null +++ b/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/socket_type.h @@ -0,0 +1,55 @@ +/* Define enum __socket_type for Linux/HP-PARISC. + Copyright (C) 2012 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#ifndef _SYS_SOCKET_H +# error "Never include <bits/socket_type.h> directly; use <sys/socket.h> instead." +#endif + +/* Types of sockets. */ +enum __socket_type +{ + SOCK_STREAM = 1, /* Sequenced, reliable, connection-based + byte streams. */ +#define SOCK_STREAM SOCK_STREAM + SOCK_DGRAM = 2, /* Connectionless, unreliable datagrams + of fixed maximum length. */ +#define SOCK_DGRAM SOCK_DGRAM + SOCK_RAW = 3, /* Raw protocol interface. */ +#define SOCK_RAW SOCK_RAW + SOCK_RDM = 4, /* Reliably-delivered messages. */ +#define SOCK_RDM SOCK_RDM + SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based, + datagrams of fixed maximum length. */ +#define SOCK_SEQPACKET SOCK_SEQPACKET + SOCK_DCCP = 6, /* Datagram Congestion Control Protocol. */ +#define SOCK_DCCP SOCK_DCCP + SOCK_PACKET = 10, /* Linux specific way of getting packets + at the dev level. For writing rarp and + other similar things on the user level. */ +#define SOCK_PACKET SOCK_PACKET + + /* Flags to be ORed into the type parameter of socket and socketpair and + used for the flags parameter of paccept. */ + + SOCK_CLOEXEC = 010000000, /* Atomically set close-on-exec flag for the + new descriptor(s). */ +#define SOCK_CLOEXEC SOCK_CLOEXEC + SOCK_NONBLOCK = 0x40000000 /* Atomically mark descriptor(s) as + non-blocking. */ +#define SOCK_NONBLOCK SOCK_NONBLOCK +}; diff --git a/libc/ports/sysdeps/unix/sysv/linux/hppa/mmap.c b/libc/ports/sysdeps/unix/sysv/linux/hppa/mmap.c index 420d6567a..12e700dcb 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/hppa/mmap.c +++ b/libc/ports/sysdeps/unix/sysv/linux/hppa/mmap.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1994-2012 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 @@ -36,7 +36,7 @@ __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset) __ptr_t ret; - ret = INLINE_SYSCALL(mmap, 6, addr, len, prot, flags, fd, offset); + ret = (__ptr_t) INLINE_SYSCALL (mmap, 6, addr, len, prot, flags, fd, offset); /* check if it's really a negative number */ if(((unsigned long)ret & 0xfffff000) == 0xfffff000) diff --git a/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/pthread_once.c b/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/pthread_once.c index 974819ead..b920ebb22 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/pthread_once.c +++ b/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/pthread_once.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004, 2005, 2007 Free Software Foundation, Inc. +/* Copyright (C) 2003-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2003. @@ -90,4 +90,4 @@ __pthread_once (once_control, init_routine) return 0; } weak_alias (__pthread_once, pthread_once) -strong_alias (__pthread_once, __pthread_once_internal) +hidden_def (__pthread_once) diff --git a/libc/ports/sysdeps/unix/sysv/linux/ia64/clock_getcpuclockid.c b/libc/ports/sysdeps/unix/sysv/linux/ia64/clock_getcpuclockid.c deleted file mode 100644 index 1289d1f74..000000000 --- a/libc/ports/sysdeps/unix/sysv/linux/ia64/clock_getcpuclockid.c +++ /dev/null @@ -1,31 +0,0 @@ -/* clock_getcpuclockid -- Get a clockid_t for process CPU time. Linux/IA64 - Copyright (C) 2000,2001,2003,2004 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 - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <errno.h> -#include <time.h> -#include <unistd.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <fcntl.h> - - -#include "has_cpuclock.c" - -#define HAS_CPUCLOCK (has_cpuclock () > 0) - -#include <sysdeps/unix/sysv/linux/clock_getcpuclockid.c> diff --git a/libc/ports/sysdeps/unix/sysv/linux/m68k/nptl/lowlevellock.h b/libc/ports/sysdeps/unix/sysv/linux/m68k/nptl/lowlevellock.h index 4dbed8d37..73fdaeaaa 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/m68k/nptl/lowlevellock.h +++ b/libc/ports/sysdeps/unix/sysv/linux/m68k/nptl/lowlevellock.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Free Software Foundation, Inc. +/* Copyright (C) 2010-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010. @@ -88,6 +88,18 @@ __ret; \ }) +#define lll_futex_timed_wait_bitset(futexp, val, timespec, clockbit, private) \ + ({ \ + INTERNAL_SYSCALL_DECL (__err); \ + long int __ret; \ + int __op = FUTEX_WAIT_BITSET | clockbit; \ + __ret = INTERNAL_SYSCALL (futex, __err, 6, (long) (futexp), \ + __lll_private_flag (__op, private), \ + (val), (timespec), NULL /* Unused. */, \ + FUTEX_BITSET_MATCH_ANY); \ + __ret; \ + }) + #define lll_futex_wake(futexp, nr, private) \ ({ \ INTERNAL_SYSCALL_DECL (__err); \ diff --git a/libc/ports/sysdeps/unix/sysv/linux/m68k/nptl/sysdep-cancel.h b/libc/ports/sysdeps/unix/sysv/linux/m68k/nptl/sysdep-cancel.h index 249e0e29f..e29589809 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/m68k/nptl/sysdep-cancel.h +++ b/libc/ports/sysdeps/unix/sysv/linux/m68k/nptl/sysdep-cancel.h @@ -69,8 +69,6 @@ # define _DOCARGS_2(n) DOCARGS_0 move.l n+4(%sp), %d2; _DOCARGS_1 (n) # define UNDOCARGS_2 UNDOCARGS_0 -/* TODO: We can optimize DOCARGS_{3, 4} by saving registers to a0 and a1 - instead of pushing them on stack. */ # define DOCARGS_3 _DOCARGS_3 (12) # define _DOCARGS_3(n) move.l %d3, -(%sp); \ cfi_adjust_cfa_offset (4); cfi_rel_offset (%d3, 0); \ @@ -86,9 +84,11 @@ cfi_adjust_cfa_offset (-4); cfi_restore (%d4); # define DOCARGS_5 _DOCARGS_5 (20) -# define _DOCARGS_5(n) move.l %d5, %a1; cfi_register (%d5, a1); \ - move.l n(%sp), %d5; _DOCARGS_4 (n-4) -# define UNDOCARGS_5 UNDOCARGS_4 move.l %a1, %d5; cfi_restore (%d5); +# define _DOCARGS_5(n) move.l %d5, -(%sp); \ + cfi_adjust_cfa_offset (4); cfi_rel_offset (%d5, 0); \ + move.l n+4(%sp), %d5; _DOCARGS_4 (n) +# define UNDOCARGS_5 UNDOCARGS_4 move.l (%sp)+, %d5; \ + cfi_adjust_cfa_offset (-4); cfi_restore (%d5); # define DOCARGS_6 _DOCARGS_6 (24) # define _DOCARGS_6(n) move.l n(%sp), %a0; _DOCARGS_5 (n-4) diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/____longjmp_chk.c b/libc/ports/sysdeps/unix/sysv/linux/mips/____longjmp_chk.c index d8da27024..943b40414 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/mips/____longjmp_chk.c +++ b/libc/ports/sysdeps/unix/sysv/linux/mips/____longjmp_chk.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Free Software Foundation, Inc. +/* Copyright (C) 2009-2012 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 @@ -29,7 +29,7 @@ int ret = __sigaltstack (NULL, &ss); \ if (ret == 0 \ && (!(ss.ss_flags & SS_ONSTACK) \ - || ((unsigned sp_type) ((sp_type) ss.ss_sp \ + || ((unsigned sp_type) ((sp_type) (long) ss.ss_sp \ + (sp_type) ss.ss_size \ - sp_saved) \ < ss.ss_size))) \ diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h index 8c024b024..2b683a986 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h +++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h @@ -60,13 +60,13 @@ result_var; }) #undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) long err +#define INTERNAL_SYSCALL_DECL(err) long err __attribute__ ((unused)) #undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) ((long) (err)) +#define INTERNAL_SYSCALL_ERROR_P(val, err) ((void) (val), (long) (err)) #undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (val) +#define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val) #undef INTERNAL_SYSCALL #define INTERNAL_SYSCALL(name, err, nr, args...) \ @@ -104,7 +104,7 @@ \ { \ register long __v0 asm("$2") ncs_init; \ - register long __a0 asm("$4") = (long) arg1; \ + register long __a0 asm("$4") = (long) (arg1); \ register long __a3 asm("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ @@ -126,8 +126,8 @@ \ { \ register long __v0 asm("$2") ncs_init; \ - register long __a0 asm("$4") = (long) arg1; \ - register long __a1 asm("$5") = (long) arg2; \ + register long __a0 asm("$4") = (long) (arg1); \ + register long __a1 asm("$5") = (long) (arg2); \ register long __a3 asm("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ @@ -149,9 +149,9 @@ \ { \ register long __v0 asm("$2") ncs_init; \ - register long __a0 asm("$4") = (long) arg1; \ - register long __a1 asm("$5") = (long) arg2; \ - register long __a2 asm("$6") = (long) arg3; \ + register long __a0 asm("$4") = (long) (arg1); \ + register long __a1 asm("$5") = (long) (arg2); \ + register long __a2 asm("$6") = (long) (arg3); \ register long __a3 asm("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ @@ -173,10 +173,10 @@ \ { \ register long __v0 asm("$2") ncs_init; \ - register long __a0 asm("$4") = (long) arg1; \ - register long __a1 asm("$5") = (long) arg2; \ - register long __a2 asm("$6") = (long) arg3; \ - register long __a3 asm("$7") = (long) arg4; \ + register long __a0 asm("$4") = (long) (arg1); \ + register long __a1 asm("$5") = (long) (arg2); \ + register long __a2 asm("$6") = (long) (arg3); \ + register long __a3 asm("$7") = (long) (arg4); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ cs_init \ @@ -205,10 +205,10 @@ FORCE_FRAME_POINTER; \ { \ register long __v0 asm("$2") ncs_init; \ - register long __a0 asm("$4") = (long) arg1; \ - register long __a1 asm("$5") = (long) arg2; \ - register long __a2 asm("$6") = (long) arg3; \ - register long __a3 asm("$7") = (long) arg4; \ + register long __a0 asm("$4") = (long) (arg1); \ + register long __a1 asm("$5") = (long) (arg2); \ + register long __a2 asm("$6") = (long) (arg3); \ + register long __a3 asm("$7") = (long) (arg4); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ "subu\t$29, 32\n\t" \ @@ -219,7 +219,7 @@ ".set\treorder" \ : "=r" (__v0), "+r" (__a3) \ : input, "r" (__a0), "r" (__a1), "r" (__a2), \ - "r" ((long)arg5) \ + "r" ((long) (arg5)) \ : __SYSCALL_CLOBBERS); \ err = __a3; \ _sys_result = __v0; \ @@ -234,10 +234,10 @@ FORCE_FRAME_POINTER; \ { \ register long __v0 asm("$2") ncs_init; \ - register long __a0 asm("$4") = (long) arg1; \ - register long __a1 asm("$5") = (long) arg2; \ - register long __a2 asm("$6") = (long) arg3; \ - register long __a3 asm("$7") = (long) arg4; \ + register long __a0 asm("$4") = (long) (arg1); \ + register long __a1 asm("$5") = (long) (arg2); \ + register long __a2 asm("$6") = (long) (arg3); \ + register long __a3 asm("$7") = (long) (arg4); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ "subu\t$29, 32\n\t" \ @@ -249,7 +249,7 @@ ".set\treorder" \ : "=r" (__v0), "+r" (__a3) \ : input, "r" (__a0), "r" (__a1), "r" (__a2), \ - "r" ((long)arg5), "r" ((long)arg6) \ + "r" ((long) (arg5)), "r" ((long) (arg6)) \ : __SYSCALL_CLOBBERS); \ err = __a3; \ _sys_result = __v0; \ @@ -264,10 +264,10 @@ FORCE_FRAME_POINTER; \ { \ register long __v0 asm("$2") ncs_init; \ - register long __a0 asm("$4") = (long) arg1; \ - register long __a1 asm("$5") = (long) arg2; \ - register long __a2 asm("$6") = (long) arg3; \ - register long __a3 asm("$7") = (long) arg4; \ + register long __a0 asm("$4") = (long) (arg1); \ + register long __a1 asm("$5") = (long) (arg2); \ + register long __a2 asm("$6") = (long) (arg3); \ + register long __a3 asm("$7") = (long) (arg4); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ "subu\t$29, 32\n\t" \ @@ -280,7 +280,7 @@ ".set\treorder" \ : "=r" (__v0), "+r" (__a3) \ : input, "r" (__a0), "r" (__a1), "r" (__a2), \ - "r" ((long)arg5), "r" ((long)arg6), "r" ((long)arg7) \ + "r" ((long) (arg5)), "r" ((long) (arg6)), "r" ((long) (arg7)) \ : __SYSCALL_CLOBBERS); \ err = __a3; \ _sys_result = __v0; \ diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h index 98088d32f..23b1c9772 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h +++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h @@ -64,13 +64,13 @@ result_var; }) #undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) long err +#define INTERNAL_SYSCALL_DECL(err) long err __attribute__ ((unused)) #undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) ((long) (err)) +#define INTERNAL_SYSCALL_ERROR_P(val, err) ((void) (val), (long) (err)) #undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (val) +#define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val) #undef INTERNAL_SYSCALL #define INTERNAL_SYSCALL(name, err, nr, args...) \ diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/sendfile64.c b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/sendfile64.c new file mode 100644 index 000000000..4c451bd09 --- /dev/null +++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/sendfile64.c @@ -0,0 +1 @@ +/* sendfile64 is alias of sendfile syscall. */ diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list index c94fe75a7..b23a2a1d1 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list +++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list @@ -8,3 +8,5 @@ fanotify_mark EXTRA fanotify_mark i:iiiis fanotify_mark fstatfs - fstatfs i:ip __fstatfs fstatfs fstatfs64 __fstatfs64 statfs - statfs i:sp __statfs statfs statfs64 __statfs64 + +sendfile - sendfile i:iipi sendfile sendfile64 diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h index 0baa94f1d..02f196a83 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h +++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h @@ -60,13 +60,13 @@ result_var; }) #undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) long err +#define INTERNAL_SYSCALL_DECL(err) long err __attribute__ ((unused)) #undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) ((long) (err)) +#define INTERNAL_SYSCALL_ERROR_P(val, err) ((void) (val), (long) (err)) #undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (val) +#define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val) #undef INTERNAL_SYSCALL #define INTERNAL_SYSCALL(name, err, nr, args...) \ @@ -104,7 +104,7 @@ \ { \ register long __v0 asm("$2") ncs_init; \ - register long __a0 asm("$4") = (long) arg1; \ + register long __a0 asm("$4") = (long) (arg1); \ register long __a3 asm("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ @@ -126,8 +126,8 @@ \ { \ register long __v0 asm("$2") ncs_init; \ - register long __a0 asm("$4") = (long) arg1; \ - register long __a1 asm("$5") = (long) arg2; \ + register long __a0 asm("$4") = (long) (arg1); \ + register long __a1 asm("$5") = (long) (arg2); \ register long __a3 asm("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ @@ -149,9 +149,9 @@ \ { \ register long __v0 asm("$2") ncs_init; \ - register long __a0 asm("$4") = (long) arg1; \ - register long __a1 asm("$5") = (long) arg2; \ - register long __a2 asm("$6") = (long) arg3; \ + register long __a0 asm("$4") = (long) (arg1); \ + register long __a1 asm("$5") = (long) (arg2); \ + register long __a2 asm("$6") = (long) (arg3); \ register long __a3 asm("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ @@ -173,10 +173,10 @@ \ { \ register long __v0 asm("$2") ncs_init; \ - register long __a0 asm("$4") = (long) arg1; \ - register long __a1 asm("$5") = (long) arg2; \ - register long __a2 asm("$6") = (long) arg3; \ - register long __a3 asm("$7") = (long) arg4; \ + register long __a0 asm("$4") = (long) (arg1); \ + register long __a1 asm("$5") = (long) (arg2); \ + register long __a2 asm("$6") = (long) (arg3); \ + register long __a3 asm("$7") = (long) (arg4); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ cs_init \ @@ -197,11 +197,11 @@ \ { \ register long __v0 asm("$2") ncs_init; \ - register long __a0 asm("$4") = (long) arg1; \ - register long __a1 asm("$5") = (long) arg2; \ - register long __a2 asm("$6") = (long) arg3; \ - register long __a3 asm("$7") = (long) arg4; \ - register long __a4 asm("$8") = (long) arg5; \ + register long __a0 asm("$4") = (long) (arg1); \ + register long __a1 asm("$5") = (long) (arg2); \ + register long __a2 asm("$6") = (long) (arg3); \ + register long __a3 asm("$7") = (long) (arg4); \ + register long __a4 asm("$8") = (long) (arg5); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ cs_init \ @@ -222,12 +222,12 @@ \ { \ register long __v0 asm("$2") ncs_init; \ - register long __a0 asm("$4") = (long) arg1; \ - register long __a1 asm("$5") = (long) arg2; \ - register long __a2 asm("$6") = (long) arg3; \ - register long __a3 asm("$7") = (long) arg4; \ - register long __a4 asm("$8") = (long) arg5; \ - register long __a5 asm("$9") = (long) arg6; \ + register long __a0 asm("$4") = (long) (arg1); \ + register long __a1 asm("$5") = (long) (arg2); \ + register long __a2 asm("$6") = (long) (arg3); \ + register long __a3 asm("$7") = (long) (arg4); \ + register long __a4 asm("$8") = (long) (arg5); \ + register long __a5 asm("$9") = (long) (arg6); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ cs_init \ diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/register-dump.h b/libc/ports/sysdeps/unix/sysv/linux/mips/register-dump.h index 186228119..0156910e4 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/mips/register-dump.h +++ b/libc/ports/sysdeps/unix/sysv/linux/mips/register-dump.h @@ -17,9 +17,26 @@ License along with the GNU C Library. If not, see <http://www.gnu.org/licenses/>. */ +#include <sgidefs.h> #include <sys/uio.h> #include <_itoa.h> +#if _MIPS_SIM == _ABIO32 +# define CTX_TYPE struct sigcontext * +# define CTX_REG(ctx, i) ((ctx)->sc_regs[(i)]) +# define CTX_PC(ctx) ((ctx)->sc_pc) +# define CTX_MDHI(ctx) ((ctx)->sc_mdhi) +# define CTX_MDLO(ctx) ((ctx)->sc_mdlo) +# define REG_HEX_SIZE 8 +#else +# define CTX_TYPE ucontext_t * +# define CTX_REG(ctx, i) ((ctx)->uc_mcontext.gregs[(i)]) +# define CTX_PC(ctx) ((ctx)->uc_mcontext.pc) +# define CTX_MDHI(ctx) ((ctx)->uc_mcontext.mdhi) +# define CTX_MDLO(ctx) ((ctx)->uc_mcontext.mdhi) +# define REG_HEX_SIZE 16 +#endif + /* We will print the register dump in this format: R0 XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX @@ -32,7 +49,7 @@ */ static void -hexvalue (unsigned long int value, char *buf, size_t len) +hexvalue (_ITOA_WORD_TYPE value, char *buf, size_t len) { char *cp = _itoa_word (value, buf + len, 16, 0); while (cp > buf) @@ -40,9 +57,9 @@ hexvalue (unsigned long int value, char *buf, size_t len) } static void -register_dump (int fd, struct sigcontext *ctx) +register_dump (int fd, CTX_TYPE ctx) { - char regs[38][8]; + char regs[38][REG_HEX_SIZE]; struct iovec iov[38 * 2 + 10]; size_t nr = 0; int i; @@ -58,40 +75,40 @@ register_dump (int fd, struct sigcontext *ctx) /* Generate strings of register contents. */ for (i = 0; i < 32; i++) - hexvalue (ctx->sc_regs[i], regs[i], 8); - hexvalue (ctx->sc_pc, regs[32], 8); - hexvalue (ctx->sc_mdhi, regs[33], 8); - hexvalue (ctx->sc_mdlo, regs[34], 8); + hexvalue (CTX_REG (ctx, i), regs[i], REG_HEX_SIZE); + hexvalue (CTX_PC (ctx), regs[32], REG_HEX_SIZE); + hexvalue (CTX_MDHI (ctx), regs[33], REG_HEX_SIZE); + hexvalue (CTX_MDLO (ctx), regs[34], REG_HEX_SIZE); /* Generate the output. */ ADD_STRING ("Register dump:\n\n R0 "); for (i = 0; i < 8; i++) { - ADD_MEM (regs[i], 8); + ADD_MEM (regs[i], REG_HEX_SIZE); ADD_STRING (" "); } ADD_STRING ("\n R8 "); for (i = 8; i < 16; i++) { - ADD_MEM (regs[i], 8); + ADD_MEM (regs[i], REG_HEX_SIZE); ADD_STRING (" "); } ADD_STRING ("\n R16 "); for (i = 16; i < 24; i++) { - ADD_MEM (regs[i], 8); + ADD_MEM (regs[i], REG_HEX_SIZE); ADD_STRING (" "); } ADD_STRING ("\n R24 "); for (i = 24; i < 32; i++) { - ADD_MEM (regs[i], 8); + ADD_MEM (regs[i], REG_HEX_SIZE); ADD_STRING (" "); } ADD_STRING ("\n pc lo hi\n "); for (i = 32; i < 35; i++) { - ADD_MEM (regs[i], 8); + ADD_MEM (regs[i], REG_HEX_SIZE); ADD_STRING (" "); } ADD_STRING ("\n"); diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h b/libc/ports/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h index 9edde2168..7793e2147 100644 --- a/libc/ports/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h +++ b/libc/ports/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2000-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger <aj@suse.de>, 2000. @@ -23,9 +23,9 @@ #define SIGCONTEXT unsigned long _code, struct sigcontext * #define SIGCONTEXT_EXTRA_ARGS _code, -#define GET_PC(ctx) ((void *) ctx->sc_pc) -#define GET_FRAME(ctx) ((void *) ctx->sc_regs[30]) -#define GET_STACK(ctx) ((void *) ctx->sc_regs[29]) +#define GET_PC(ctx) ((void *) (unsigned long) ctx->sc_pc) +#define GET_FRAME(ctx) ((void *) (unsigned long) ctx->sc_regs[30]) +#define GET_STACK(ctx) ((void *) (unsigned long) ctx->sc_regs[29]) #define CALL_SIGHANDLER(handler, signo, ctx) \ (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx)) @@ -33,9 +33,9 @@ #define SIGCONTEXT unsigned long _code, ucontext_t * #define SIGCONTEXT_EXTRA_ARGS _code, -#define GET_PC(ctx) ((void *) ctx->uc_mcontext.pc) -#define GET_FRAME(ctx) ((void *) ctx->uc_mcontext.gregs[30]) -#define GET_STACK(ctx) ((void *) ctx->uc_mcontext.gregs[29]) +#define GET_PC(ctx) ((void *) (unsigned long) ctx->uc_mcontext.pc) +#define GET_FRAME(ctx) ((void *) (unsigned long) ctx->uc_mcontext.gregs[30]) +#define GET_STACK(ctx) ((void *) (unsigned long) ctx->uc_mcontext.gregs[29]) #define CALL_SIGHANDLER(handler, signo, ctx) \ (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx)) |