[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Offtopic (Was: no socklen_t for ksock.cpp)
From:       Waldo Bastian <bastian () suse ! de>
Date:       1999-12-28 21:21:23
[Download RAW message or body]

On Tue, 28 Dec 1999, Stephan Kulow wrote:
> Greg Lee wrote:
> > On Mon, 27 Dec 1999, Waldo Bastian wrote:
> > > On Mon, 27 Dec 1999, Greg Lee wrote:
> > > > In kdelibs/kdecore/ksock.cpp I had to change "socklen_t":
> > >
> > > Why? socklen_t is defined by POSIX.
> > >
> > > Cheers,
> > > Waldo
> >
> > You're asking why I had to change it?  To get it to compile.
> >
> > I apologize on behalf of my computer for not knowing a POSIX
> > symbol.  Evidently mine is not the only system with the
> > problem, otherwise kdelibs/configure would not define ksize_t in
> > config.h to be size_t when socklen_t is not found.
>
> I think, it has been done on introduction of glibc2

The man-page has a chapter dedicated to it:

NOTE
       The third argument of accept was originally declared as an
       `int  *'  (and  is  that under libc4 and libc5 and on many
       other systems like BSD 4.*, SunOS 4, SGI); a POSIX 1003.1g
       draft  standard wanted to change it into a `size_t *', and
       that is what it is for SunOS 5.  Later POSIX  drafts  have
       `socklen_t *', and so do the Single Unix Specification and
       glibc2.  Quoting Linus Torvalds: _Any_ sane library _must_
       have  "socklen_t"  be the same size as int.  Anything else
       breaks any BSD socket layer stuff.  POSIX initially  _did_
       make  it  a size_t, and I (and hopefully others, but obvi­
       ously not too many) complained to them very loudly indeed.
       Making  it  a size_t is completely broken, exactly because
       size_t very seldom is the same size  as  "int"  on  64-bit
       architectures,  for  example.  And it _has_ to be the same
       size as "int" because that's what the BSD socket interface
       is.   Anyway,  the POSIX people eventually got a clue, and
       created "socklen_t".  They shouldn't have  touched  it  in
       the  first  place,  but  once they did they felt it had to
       have a named type for some unfathomable  reason  (probably
       somebody  didn't  like  losing  face  over having done the
       original stupid thing, so they silently just renamed their
       blunder).                                                        

Cheers,
Waldo
         

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic