patches/glibc/ports-2.10.1/550-alpha-fix-SOCK_NONBLOCK.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jan 17 23:06:02 2010 +0100 (2010-01-17)
changeset 1740 c57458bb354d
permissions -rw-r--r--
configure: do not require hg when configuring in an hg clone

When configuring in an hg clone, we need hg to compute the version string.
It can happen that users do not have Mercurial (eg. if they got a snapshot
rather that they did a full clone). In this case, we can still run, of
course, so simply fill the version string with a sufficiently explicit
value, that does not require hg. The date is a good candidate.
     1 2009-08-16  Aurelien Jarno  <aurelien@aurel32.net>
     2 
     3 	* ports/sysdeps/unix/sysv/linux/alpha/bits/socket.h: New file based on
     4 	the generic version, with SOCK_NONBLOCK matching the kernel value.
     5 
     6 diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/bits/socket.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/bits/socket.h
     7 --- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/bits/socket.h	1970-01-01 01:00:00.000000000 +0100
     8 +++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/bits/socket.h	2009-11-13 00:51:17.000000000 +0100
     9 @@ -0,0 +1,407 @@
    10 +/* System-specific socket constants and types.  Linux version.
    11 +   Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008, 2009
    12 +   Free Software Foundation, Inc.
    13 +   This file is part of the GNU C Library.
    14 +
    15 +   The GNU C Library is free software; you can redistribute it and/or
    16 +   modify it under the terms of the GNU Lesser General Public
    17 +   License as published by the Free Software Foundation; either
    18 +   version 2.1 of the License, or (at your option) any later version.
    19 +
    20 +   The GNU C Library is distributed in the hope that it will be useful,
    21 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
    22 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    23 +   Lesser General Public License for more details.
    24 +
    25 +   You should have received a copy of the GNU Lesser General Public
    26 +   License along with the GNU C Library; if not, write to the Free
    27 +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    28 +   02111-1307 USA.  */
    29 +
    30 +#ifndef __BITS_SOCKET_H
    31 +#define __BITS_SOCKET_H
    32 +
    33 +#ifndef _SYS_SOCKET_H
    34 +# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
    35 +#endif
    36 +
    37 +#define	__need_size_t
    38 +#include <stddef.h>
    39 +
    40 +#include <sys/types.h>
    41 +
    42 +/* Type for length arguments in socket calls.  */
    43 +#ifndef __socklen_t_defined
    44 +typedef __socklen_t socklen_t;
    45 +# define __socklen_t_defined
    46 +#endif
    47 +
    48 +/* Types of sockets.  */
    49 +enum __socket_type
    50 +{
    51 +  SOCK_STREAM = 1,		/* Sequenced, reliable, connection-based
    52 +				   byte streams.  */
    53 +#define SOCK_STREAM SOCK_STREAM
    54 +  SOCK_DGRAM = 2,		/* Connectionless, unreliable datagrams
    55 +				   of fixed maximum length.  */
    56 +#define SOCK_DGRAM SOCK_DGRAM
    57 +  SOCK_RAW = 3,			/* Raw protocol interface.  */
    58 +#define SOCK_RAW SOCK_RAW
    59 +  SOCK_RDM = 4,			/* Reliably-delivered messages.  */
    60 +#define SOCK_RDM SOCK_RDM
    61 +  SOCK_SEQPACKET = 5,		/* Sequenced, reliable, connection-based,
    62 +				   datagrams of fixed maximum length.  */
    63 +#define SOCK_SEQPACKET SOCK_SEQPACKET
    64 +  SOCK_DCCP = 6,		/* Datagram Congestion Control Protocol.  */
    65 +#define SOCK_DCCP SOCK_DCCP
    66 +  SOCK_PACKET = 10,		/* Linux specific way of getting packets
    67 +				   at the dev level.  For writing rarp and
    68 +				   other similar things on the user level. */
    69 +#define SOCK_PACKET SOCK_PACKET
    70 +
    71 +  /* Flags to be ORed into the type parameter of socket and socketpair and
    72 +     used for the flags parameter of paccept.  */
    73 +
    74 +  SOCK_CLOEXEC = 02000000,	/* Atomically set close-on-exec flag for the
    75 +				   new descriptor(s).  */
    76 +#define SOCK_CLOEXEC SOCK_CLOEXEC
    77 +#undef SOCK_NONBLOCK
    78 +  SOCK_NONBLOCK = 0x40000000	/* Atomically mark descriptor(s) as
    79 +				   non-blocking.  */
    80 +#define SOCK_NONBLOCK SOCK_NONBLOCK
    81 +};
    82 +
    83 +/* Protocol families.  */
    84 +#define	PF_UNSPEC	0	/* Unspecified.  */
    85 +#define	PF_LOCAL	1	/* Local to host (pipes and file-domain).  */
    86 +#define	PF_UNIX		PF_LOCAL /* POSIX name for PF_LOCAL.  */
    87 +#define	PF_FILE		PF_LOCAL /* Another non-standard name for PF_LOCAL.  */
    88 +#define	PF_INET		2	/* IP protocol family.  */
    89 +#define	PF_AX25		3	/* Amateur Radio AX.25.  */
    90 +#define	PF_IPX		4	/* Novell Internet Protocol.  */
    91 +#define	PF_APPLETALK	5	/* Appletalk DDP.  */
    92 +#define	PF_NETROM	6	/* Amateur radio NetROM.  */
    93 +#define	PF_BRIDGE	7	/* Multiprotocol bridge.  */
    94 +#define	PF_ATMPVC	8	/* ATM PVCs.  */
    95 +#define	PF_X25		9	/* Reserved for X.25 project.  */
    96 +#define	PF_INET6	10	/* IP version 6.  */
    97 +#define	PF_ROSE		11	/* Amateur Radio X.25 PLP.  */
    98 +#define	PF_DECnet	12	/* Reserved for DECnet project.  */
    99 +#define	PF_NETBEUI	13	/* Reserved for 802.2LLC project.  */
   100 +#define	PF_SECURITY	14	/* Security callback pseudo AF.  */
   101 +#define	PF_KEY		15	/* PF_KEY key management API.  */
   102 +#define	PF_NETLINK	16
   103 +#define	PF_ROUTE	PF_NETLINK /* Alias to emulate 4.4BSD.  */
   104 +#define	PF_PACKET	17	/* Packet family.  */
   105 +#define	PF_ASH		18	/* Ash.  */
   106 +#define	PF_ECONET	19	/* Acorn Econet.  */
   107 +#define	PF_ATMSVC	20	/* ATM SVCs.  */
   108 +#define PF_RDS		21	/* RDS sockets.  */
   109 +#define	PF_SNA		22	/* Linux SNA Project */
   110 +#define	PF_IRDA		23	/* IRDA sockets.  */
   111 +#define	PF_PPPOX	24	/* PPPoX sockets.  */
   112 +#define	PF_WANPIPE	25	/* Wanpipe API sockets.  */
   113 +#define PF_LLC		26	/* Linux LLC.  */
   114 +#define PF_CAN		29	/* Controller Area Network.  */
   115 +#define PF_TIPC		30	/* TIPC sockets.  */
   116 +#define	PF_BLUETOOTH	31	/* Bluetooth sockets.  */
   117 +#define	PF_IUCV		32	/* IUCV sockets.  */
   118 +#define PF_RXRPC	33	/* RxRPC sockets.  */
   119 +#define PF_ISDN		34	/* mISDN sockets.  */
   120 +#define PF_PHONET	35	/* Phonet sockets.  */
   121 +#define PF_IEEE802154	36	/* IEEE 802.15.4 sockets.  */
   122 +#define	PF_MAX		37	/* For now..  */
   123 +
   124 +/* Address families.  */
   125 +#define	AF_UNSPEC	PF_UNSPEC
   126 +#define	AF_LOCAL	PF_LOCAL
   127 +#define	AF_UNIX		PF_UNIX
   128 +#define	AF_FILE		PF_FILE
   129 +#define	AF_INET		PF_INET
   130 +#define	AF_AX25		PF_AX25
   131 +#define	AF_IPX		PF_IPX
   132 +#define	AF_APPLETALK	PF_APPLETALK
   133 +#define	AF_NETROM	PF_NETROM
   134 +#define	AF_BRIDGE	PF_BRIDGE
   135 +#define	AF_ATMPVC	PF_ATMPVC
   136 +#define	AF_X25		PF_X25
   137 +#define	AF_INET6	PF_INET6
   138 +#define	AF_ROSE		PF_ROSE
   139 +#define	AF_DECnet	PF_DECnet
   140 +#define	AF_NETBEUI	PF_NETBEUI
   141 +#define	AF_SECURITY	PF_SECURITY
   142 +#define	AF_KEY		PF_KEY
   143 +#define	AF_NETLINK	PF_NETLINK
   144 +#define	AF_ROUTE	PF_ROUTE
   145 +#define	AF_PACKET	PF_PACKET
   146 +#define	AF_ASH		PF_ASH
   147 +#define	AF_ECONET	PF_ECONET
   148 +#define	AF_ATMSVC	PF_ATMSVC
   149 +#define AF_RDS		PF_RDS
   150 +#define	AF_SNA		PF_SNA
   151 +#define	AF_IRDA		PF_IRDA
   152 +#define	AF_PPPOX	PF_PPPOX
   153 +#define	AF_WANPIPE	PF_WANPIPE
   154 +#define AF_LLC		PF_LLC
   155 +#define AF_CAN		PF_CAN
   156 +#define AF_TIPC		PF_TIPC
   157 +#define	AF_BLUETOOTH	PF_BLUETOOTH
   158 +#define	AF_IUCV		PF_IUCV
   159 +#define AF_RXRPC	PF_RXRPC
   160 +#define AF_ISDN		PF_ISDN
   161 +#define AF_PHONET	PF_PHONET
   162 +#define AF_IEEE802154	PF_IEEE802154
   163 +#define	AF_MAX		PF_MAX
   164 +
   165 +/* Socket level values.  Others are defined in the appropriate headers.
   166 +
   167 +   XXX These definitions also should go into the appropriate headers as
   168 +   far as they are available.  */
   169 +#define SOL_RAW		255
   170 +#define SOL_DECNET      261
   171 +#define SOL_X25         262
   172 +#define SOL_PACKET	263
   173 +#define SOL_ATM		264	/* ATM layer (cell level).  */
   174 +#define SOL_AAL		265	/* ATM Adaption Layer (packet level).  */
   175 +#define SOL_IRDA	266
   176 +
   177 +/* Maximum queue length specifiable by listen.  */
   178 +#define SOMAXCONN	128
   179 +
   180 +/* Get the definition of the macro to define the common sockaddr members.  */
   181 +#include <bits/sockaddr.h>
   182 +
   183 +/* Structure describing a generic socket address.  */
   184 +struct sockaddr
   185 +  {
   186 +    __SOCKADDR_COMMON (sa_);	/* Common data: address family and length.  */
   187 +    char sa_data[14];		/* Address data.  */
   188 +  };
   189 +
   190 +
   191 +/* Structure large enough to hold any socket address (with the historical
   192 +   exception of AF_UNIX).  We reserve 128 bytes.  */
   193 +#define __ss_aligntype	unsigned long int
   194 +#define _SS_SIZE	128
   195 +#define _SS_PADSIZE	(_SS_SIZE - (2 * sizeof (__ss_aligntype)))
   196 +
   197 +struct sockaddr_storage
   198 +  {
   199 +    __SOCKADDR_COMMON (ss_);	/* Address family, etc.  */
   200 +    __ss_aligntype __ss_align;	/* Force desired alignment.  */
   201 +    char __ss_padding[_SS_PADSIZE];
   202 +  };
   203 +
   204 +
   205 +/* Bits in the FLAGS argument to `send', `recv', et al.  */
   206 +enum
   207 +  {
   208 +    MSG_OOB		= 0x01,	/* Process out-of-band data.  */
   209 +#define MSG_OOB		MSG_OOB
   210 +    MSG_PEEK		= 0x02,	/* Peek at incoming messages.  */
   211 +#define MSG_PEEK	MSG_PEEK
   212 +    MSG_DONTROUTE	= 0x04,	/* Don't use local routing.  */
   213 +#define MSG_DONTROUTE	MSG_DONTROUTE
   214 +#ifdef __USE_GNU
   215 +    /* DECnet uses a different name.  */
   216 +    MSG_TRYHARD		= MSG_DONTROUTE,
   217 +# define MSG_TRYHARD	MSG_DONTROUTE
   218 +#endif
   219 +    MSG_CTRUNC		= 0x08,	/* Control data lost before delivery.  */
   220 +#define MSG_CTRUNC	MSG_CTRUNC
   221 +    MSG_PROXY		= 0x10,	/* Supply or ask second address.  */
   222 +#define MSG_PROXY	MSG_PROXY
   223 +    MSG_TRUNC		= 0x20,
   224 +#define	MSG_TRUNC	MSG_TRUNC
   225 +    MSG_DONTWAIT	= 0x40, /* Nonblocking IO.  */
   226 +#define	MSG_DONTWAIT	MSG_DONTWAIT
   227 +    MSG_EOR		= 0x80, /* End of record.  */
   228 +#define	MSG_EOR		MSG_EOR
   229 +    MSG_WAITALL		= 0x100, /* Wait for a full request.  */
   230 +#define	MSG_WAITALL	MSG_WAITALL
   231 +    MSG_FIN		= 0x200,
   232 +#define	MSG_FIN		MSG_FIN
   233 +    MSG_SYN		= 0x400,
   234 +#define	MSG_SYN		MSG_SYN
   235 +    MSG_CONFIRM		= 0x800, /* Confirm path validity.  */
   236 +#define	MSG_CONFIRM	MSG_CONFIRM
   237 +    MSG_RST		= 0x1000,
   238 +#define	MSG_RST		MSG_RST
   239 +    MSG_ERRQUEUE	= 0x2000, /* Fetch message from error queue.  */
   240 +#define	MSG_ERRQUEUE	MSG_ERRQUEUE
   241 +    MSG_NOSIGNAL	= 0x4000, /* Do not generate SIGPIPE.  */
   242 +#define	MSG_NOSIGNAL	MSG_NOSIGNAL
   243 +    MSG_MORE		= 0x8000,  /* Sender will send more.  */
   244 +#define	MSG_MORE	MSG_MORE
   245 +
   246 +    MSG_CMSG_CLOEXEC	= 0x40000000	/* Set close_on_exit for file
   247 +                                           descriptor received through
   248 +                                           SCM_RIGHTS.  */
   249 +#define MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC
   250 +  };
   251 +
   252 +
   253 +/* Structure describing messages sent by
   254 +   `sendmsg' and received by `recvmsg'.  */
   255 +struct msghdr
   256 +  {
   257 +    void *msg_name;		/* Address to send to/receive from.  */
   258 +    socklen_t msg_namelen;	/* Length of address data.  */
   259 +
   260 +    struct iovec *msg_iov;	/* Vector of data to send/receive into.  */
   261 +    size_t msg_iovlen;		/* Number of elements in the vector.  */
   262 +
   263 +    void *msg_control;		/* Ancillary data (eg BSD filedesc passing). */
   264 +    size_t msg_controllen;	/* Ancillary data buffer length.
   265 +				   !! The type should be socklen_t but the
   266 +				   definition of the kernel is incompatible
   267 +				   with this.  */
   268 +
   269 +    int msg_flags;		/* Flags on received message.  */
   270 +  };
   271 +
   272 +/* Structure used for storage of ancillary data object information.  */
   273 +struct cmsghdr
   274 +  {
   275 +    size_t cmsg_len;		/* Length of data in cmsg_data plus length
   276 +				   of cmsghdr structure.
   277 +				   !! The type should be socklen_t but the
   278 +				   definition of the kernel is incompatible
   279 +				   with this.  */
   280 +    int cmsg_level;		/* Originating protocol.  */
   281 +    int cmsg_type;		/* Protocol specific type.  */
   282 +#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
   283 +    __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data.  */
   284 +#endif
   285 +  };
   286 +
   287 +/* Ancillary data object manipulation macros.  */
   288 +#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
   289 +# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
   290 +#else
   291 +# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
   292 +#endif
   293 +#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
   294 +#define CMSG_FIRSTHDR(mhdr) \
   295 +  ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr)		      \
   296 +   ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0)
   297 +#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \
   298 +			 & (size_t) ~(sizeof (size_t) - 1))
   299 +#define CMSG_SPACE(len) (CMSG_ALIGN (len) \
   300 +			 + CMSG_ALIGN (sizeof (struct cmsghdr)))
   301 +#define CMSG_LEN(len)   (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
   302 +
   303 +extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr,
   304 +				      struct cmsghdr *__cmsg) __THROW;
   305 +#ifdef __USE_EXTERN_INLINES
   306 +# ifndef _EXTERN_INLINE
   307 +#  define _EXTERN_INLINE __extern_inline
   308 +# endif
   309 +_EXTERN_INLINE struct cmsghdr *
   310 +__NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg))
   311 +{
   312 +  if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
   313 +    /* The kernel header does this so there may be a reason.  */
   314 +    return 0;
   315 +
   316 +  __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
   317 +			       + CMSG_ALIGN (__cmsg->cmsg_len));
   318 +  if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) __mhdr->msg_control
   319 +					+ __mhdr->msg_controllen)
   320 +      || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
   321 +	  > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
   322 +    /* No more entries.  */
   323 +    return 0;
   324 +  return __cmsg;
   325 +}
   326 +#endif	/* Use `extern inline'.  */
   327 +
   328 +/* Socket level message types.  This must match the definitions in
   329 +   <linux/socket.h>.  */
   330 +enum
   331 +  {
   332 +    SCM_RIGHTS = 0x01		/* Transfer file descriptors.  */
   333 +#define SCM_RIGHTS SCM_RIGHTS
   334 +#ifdef __USE_GNU
   335 +    , SCM_CREDENTIALS = 0x02	/* Credentials passing.  */
   336 +# define SCM_CREDENTIALS SCM_CREDENTIALS
   337 +#endif
   338 +  };
   339 +
   340 +#ifdef __USE_GNU
   341 +/* User visible structure for SCM_CREDENTIALS message */
   342 +struct ucred
   343 +{
   344 +  pid_t pid;			/* PID of sending process.  */
   345 +  uid_t uid;			/* UID of sending process.  */
   346 +  gid_t gid;			/* GID of sending process.  */
   347 +};
   348 +#endif
   349 +
   350 +/* Ugly workaround for unclean kernel headers.  */
   351 +#if !defined __USE_MISC && !defined __USE_GNU
   352 +# ifndef FIOGETOWN
   353 +#  define __SYS_SOCKET_H_undef_FIOGETOWN
   354 +# endif
   355 +# ifndef FIOSETOWN
   356 +#  define __SYS_SOCKET_H_undef_FIOSETOWN
   357 +# endif
   358 +# ifndef SIOCATMARK
   359 +#  define __SYS_SOCKET_H_undef_SIOCATMARK
   360 +# endif
   361 +# ifndef SIOCGPGRP
   362 +#  define __SYS_SOCKET_H_undef_SIOCGPGRP
   363 +# endif
   364 +# ifndef SIOCGSTAMP
   365 +#  define __SYS_SOCKET_H_undef_SIOCGSTAMP
   366 +# endif
   367 +# ifndef SIOCGSTAMPNS
   368 +#  define __SYS_SOCKET_H_undef_SIOCGSTAMPNS
   369 +# endif
   370 +# ifndef SIOCSPGRP
   371 +#  define __SYS_SOCKET_H_undef_SIOCSPGRP
   372 +# endif
   373 +#endif
   374 +
   375 +/* Get socket manipulation related informations from kernel headers.  */
   376 +#include <asm/socket.h>
   377 +
   378 +#if !defined __USE_MISC && !defined __USE_GNU
   379 +# ifdef __SYS_SOCKET_H_undef_FIOGETOWN
   380 +#  undef __SYS_SOCKET_H_undef_FIOGETOWN
   381 +#  undef FIOGETOWN
   382 +# endif
   383 +# ifdef __SYS_SOCKET_H_undef_FIOSETOWN
   384 +#  undef __SYS_SOCKET_H_undef_FIOSETOWN
   385 +#  undef FIOSETOWN
   386 +# endif
   387 +# ifdef __SYS_SOCKET_H_undef_SIOCATMARK
   388 +#  undef __SYS_SOCKET_H_undef_SIOCATMARK
   389 +#  undef SIOCATMARK
   390 +# endif
   391 +# ifdef __SYS_SOCKET_H_undef_SIOCGPGRP
   392 +#  undef __SYS_SOCKET_H_undef_SIOCGPGRP
   393 +#  undef SIOCGPGRP
   394 +# endif
   395 +# ifdef __SYS_SOCKET_H_undef_SIOCGSTAMP
   396 +#  undef __SYS_SOCKET_H_undef_SIOCGSTAMP
   397 +#  undef SIOCGSTAMP
   398 +# endif
   399 +# ifdef __SYS_SOCKET_H_undef_SIOCGSTAMPNS
   400 +#  undef __SYS_SOCKET_H_undef_SIOCGSTAMPNS
   401 +#  undef SIOCGSTAMPNS
   402 +# endif
   403 +# ifdef __SYS_SOCKET_H_undef_SIOCSPGRP
   404 +#  undef __SYS_SOCKET_H_undef_SIOCSPGRP
   405 +#  undef SIOCSPGRP
   406 +# endif
   407 +#endif
   408 +
   409 +/* Structure used to manipulate the SO_LINGER option.  */
   410 +struct linger
   411 +  {
   412 +    int l_onoff;		/* Nonzero to linger on close.  */
   413 +    int l_linger;		/* Time to linger.  */
   414 +  };
   415 +
   416 +#endif	/* bits/socket.h */
   417 diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/bits/socket.h glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/bits/socket.h