This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Create bits/socket.h for alpha, correct SOCK_CLOEXEC value.


Matt Turner a écrit :
> The kernel defines SOCK_CLOEXEC as
> include/linux/net.h:#define SOCK_CLOEXEC        O_CLOEXEC
> arch/alpha/include/asm/fcntl.h:#define O_CLOEXEC        010000000
> 
> But glibc was defining
> bits/socket.h:  SOCK_CLOEXEC = 02000000
> which was correct for x86, but not for alpha. So copy the x86 socket.h
> to alpha and correct this value.
> 
> Signed-off-by: Matt Turner <mattst88@gmail.com>
> ---
>  ChangeLog.alpha                             |    4 +
>  sysdeps/unix/sysv/linux/alpha/bits/socket.h |  429 +++++++++++++++++++++++++++
>  2 files changed, 433 insertions(+), 0 deletions(-)
>  create mode 100755 sysdeps/unix/sysv/linux/alpha/bits/socket.h
> 
> diff --git a/ChangeLog.alpha b/ChangeLog.alpha
> index e41c202..1efaacd 100644
> --- a/ChangeLog.alpha
> +++ b/ChangeLog.alpha
> @@ -1,3 +1,7 @@
> +2010-02-12  Matt Turner  <mattst88@gmail.com>
> +
> +	* sysdeps/unix/sysv/linux/alpha/bits/socket.h: New file.
> +
>  2010-01-12  Matt Turner  <mattst88@gmail.com>
>  
>  	* sysdeps/unix/sysv/linux/alpha/bits/stat.h: Fix double-inclusion
> diff --git a/sysdeps/unix/sysv/linux/alpha/bits/socket.h b/sysdeps/unix/sysv/linux/alpha/bits/socket.h
> new file mode 100755
> index 0000000..35b33f4
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/alpha/bits/socket.h
> @@ -0,0 +1,429 @@
> +/* System-specific socket constants and types.  Linux version.
> +   Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008, 2009, 2010
> +   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, write to the Free
> +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
> +   02111-1307 USA.  */
> +
> +#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 = 04000		/* Atomically mark descriptor(s) as
> +				   non-blocking.  */

This value should be 0x40000000 instead.

Note that there is a patch available to fix both these issues in BZ #10528.

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]