delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/07/29/18:31:13

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_FRT_STOCK2
X-Spam-Check-By: sourceware.org
Subject: Re: socklen_t type
From: "Yaakov (Cygwin/X)" <yselkowitz AT users DOT sourceforge DOT net>
To: cygwin <cygwin AT cygwin DOT com>
Date: Fri, 29 Jul 2011 17:30:52 -0500
In-Reply-To: <20110729202330.GE13084@calimero.vinschen.de>
References: <4E330A4C DOT 90706 AT redhat DOT com> <20110729202330 DOT GE13084 AT calimero DOT vinschen DOT de>
Message-ID: <1311978655.3972.9.camel@YAAKOV04>
Mime-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Fri, 2011-07-29 at 22:23 +0200, Corinna Vinschen wrote:
> On Jul 29 13:30, Eric Blake wrote:
> > Is there any specific reason why socklen_t on cygwin is int instead
> > of uint32_t, like it is on Linux?
> 
> Other than history?  No, I don't think so.  But I also don't think
> it's worth the effort.  All the underlying Windows functions typically
> use int rather than uint32_t, and even the Linux man page states:
> 
>   The optlen argument of getsockopt() and setsockopt() is in reality an
>   int [*] (and this is what 4.x BSD and libc4 and libc5 have).  Some
>   POSIX confusion resulted in the present socklen_t, also used by glibc.

FWIW, I am aware of the following packages which are affected by the
difference:

kdebase-runtime
libgcrypt
libunique

But POSIX says[1]:

> The <sys/socket.h> header shall define the socklen_t type, which is an
> integer type of width of at least 32 bits...
> 
> To forestall portability problems, it is recommended that applications
> not use values larger than 2^31 -1 for the socklen_t type.

That would seem to allow either 'uint32_t' or 'int', so we're not wrong,
and its the aforementioned applications' fault for making Linux
assumptions.


Yaakov

[1]
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019