You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by dg...@hyperreal.org on 1998/06/03 19:54:46 UTC

cvs commit: apache-1.3/src/include conf.h

dgaudet     98/06/03 10:54:46

  Modified:    src      PORTING
               src/include conf.h
  Log:
  explain NET_SIZE_T and why it is a mess
  
  Revision  Changes    Path
  1.29      +2 -1      apache-1.3/src/PORTING
  
  Index: PORTING
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/PORTING,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- PORTING	1998/05/09 03:25:41	1.28
  +++ PORTING	1998/06/03 17:54:45	1.29
  @@ -338,7 +338,8 @@
         NET_SIZE_T:
          Some functions such as accept(), getsockname(), getpeername() take
          an int *len on some architectures and a size_t *len on others.
  -       If left undefined apache will default it to int.
  +       If left undefined apache will default it to int.  See include/conf.h
  +       for a description of NET_SIZE_T.
   
         NEED_HASHBANG_EMUL:
          The execve()/etc. functions on this platform do not deal with #!,
  
  
  
  1.213     +19 -2     apache-1.3/src/include/conf.h
  
  Index: conf.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/include/conf.h,v
  retrieving revision 1.212
  retrieving revision 1.213
  diff -u -r1.212 -r1.213
  --- conf.h	1998/05/29 00:15:56	1.212
  +++ conf.h	1998/06/03 17:54:45	1.213
  @@ -1066,8 +1066,25 @@
   #define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
   #endif
   
  -/* some architectures require size_t * pointers where others require int *
  - * pointers in functions such as accept(), getsockname(), getpeername()
  +/*
  + * NET_SIZE_T exists because of shortsightedness on the POSIX committee.  BSD
  + * systems used "int *" as the parameter to accept(), getsockname(),
  + * getpeername() et al.  Consequently many unixes took an int * for that
  + * parameter.  The POSIX committee decided that "int" was just too generic and
  + * had to be replaced with size_t almost everywhere.  There's no problem with
  + * that when you're passing by value.  But when you're passing by reference
  + * this creates a gross source incompatibility with existing programs.  On
  + * 32-bit architectures it creates only a warning.  On 64-bit architectures it
  + * creates broken code -- because "int *" is a pointer to a 64-bit quantity and
  + * "size_t *" is frequently a pointer to a 32-bit quantity.
  + *
  + * Some Unixes adopted "size_t *" for the sake of POSIX compliance.  Others
  + * ignored it because it was such a broken interface.  Chaos ensued.  POSIX
  + * finally woke up and decided that it was wrong and created a new type
  + * socklen_t.  The only useful value for socklen_t is int, and that's how
  + * everyone who has a clue implements it.  It is almost always the case that
  + * NET_SIZE_T should be defined to be an int, unless the system being compiled
  + * for was created in the window of POSIX madness.
    */
   #ifndef NET_SIZE_T
   #define NET_SIZE_T int