zsh-workers
 help / color / mirror / code / Atom feed
* AIX patch
@ 2001-06-19  6:45 Andrej Borsenkow
  2001-06-19 16:11 ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Andrej Borsenkow @ 2001-06-19  6:45 UTC (permalink / raw)
  To: ZSH Workers Mailing List

[-- Attachment #1: Type: text/plain, Size: 588 bytes --]

I am going to commit the following to HEAD. From feedback I had it should at
least fix reported compile problem. Of course, it does not mean that
compiled zsh will run, but that patch is needed in any case.

Note, that it adds test for type of third argument to accept (that is used
in some other functions as well). It currently checks for size_t, unsigned
long and int (those I have on systems here and reported on AIX 4.x) and
works on ReliantUNIX, Cygwin (up to date net release) and Mandrake with
gcc-2.96/glibc-2.2.3. Feel free to add more types as needed for your system.

-andrej

[-- Attachment #2: zsh-aix.diff --]
[-- Type: application/octet-stream, Size: 5830 bytes --]

Index: acconfig.h
===================================================================
RCS file: /cvsroot/zsh/zsh/acconfig.h,v
retrieving revision 1.11
diff -u -r1.11 acconfig.h
--- acconfig.h	2001/05/09 05:42:12	1.11
+++ acconfig.h	2001/06/19 06:39:31
@@ -320,3 +320,6 @@
 
 /* Define if term.h chokes without curses.h */
 #undef TERM_H_NEEDS_CURSES_H
+
+/* Define to the base type of the third argument of accept */
+#undef SOCKLEN_T
Index: aczsh.m4
===================================================================
RCS file: /cvsroot/zsh/zsh/aczsh.m4,v
retrieving revision 1.10
diff -u -r1.10 aczsh.m4
--- aczsh.m4	2001/04/23 19:59:03	1.10
+++ aczsh.m4	2001/06/19 06:39:32
@@ -683,3 +683,31 @@
 	then LIBS="$4"
 	else LIBS="$enable_libs"
 	fi)])
+
+dnl 
+dnl zsh_CHECK_SOCKLEN_T
+dnl
+dnl	check type of third argument of some network functions; currently
+dnl	tested are size_t *, unsigned long *, int *.
+dnl
+AC_DEFUN([zsh_CHECK_SOCKLEN_T],[
+  AC_CACHE_CHECK(
+    [base type of the third argument to accept],
+    [zsh_cv_type_socklen_t],
+    [zsh_cv_type_socklen_t=
+    for zsh_type in int "unsigned long" size_t ; do
+      AC_TRY_COMPILE(
+        [#include <sys/types.h>
+         #include <sys/socket.h>],
+        [extern int accept (int, struct sockaddr *, $zsh_type *);],
+        [zsh_cv_type_socklen_t="$zsh_type"; break],
+        []
+      )
+    done
+    if test -z "$zsh_cv_type_socklen_t"; then
+      zsh_cv_type_socklen_t=int
+    fi]
+  )
+  AC_DEFINE_UNQUOTED([SOCKLEN_T], [$zsh_cv_type_socklen_t])]
+)
+
Index: zshconfig.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/zshconfig.ac,v
retrieving revision 1.7
diff -u -r1.7 zshconfig.ac
--- zshconfig.ac	2001/06/17 16:16:23	1.7
+++ zshconfig.ac	2001/06/19 06:39:33
@@ -1486,6 +1486,12 @@
 
 
 dnl ---------------
+dnl check for the type of third argument of accept
+dnl ---------------
+
+zsh_CHECK_SOCKLEN_T
+
+dnl ---------------
 dnl dynamic loading
 dnl ---------------
 L=N
@@ -1497,29 +1503,30 @@
 MOD_IMPORT_FUNCTION=
 aixdynamic=no
 hpuxdynamic=no
-if test "$ac_cv_func_dlopen"  != yes ||
-   test "$ac_cv_func_dlsym"   != yes ||
-   test "$ac_cv_func_dlerror" != yes; then
-  if test "$ac_cv_func_load"      != yes ||
-     test "$ac_cv_func_unload"    != yes ||
-     test "$ac_cv_func_loadbind"  != yes ||
-     test "$ac_cv_func_loadquery" != yes; then
-    if test "$ac_cv_func_shl_load" != yes ||
-       test "$ac_cv_func_shl_unload" != yes ||
-       test "$ac_cv_func_shl_findsym" != yes; then
-      dynamic=no
-    elif test "x$dynamic" = xyes; then
-      hpuxdynamic=yes
-      DL_EXT="${DL_EXT=sl}"
-      dnl autoheader won't allow us to define anything which isn't
-      dnl going into a header, and we can't undefine anything, so
-      dnl just define this anyway and rely on the later tests to
-      dnl define DYNAMIC or not.
-      AC_DEFINE(HPUXDYNAMIC)dnl
-    fi
-  elif test "x$dynamic" = xyes; then
+if test "$ac_cv_func_load"      = yes &&
+   test "$ac_cv_func_unload"    = yes &&
+   test "$ac_cv_func_loadbind"  = yes &&
+   test "$ac_cv_func_loadquery" = yes; then
+  dnl Force AIXDYNAMIC even on newer versions that have dl family
+  if test "x$dynamic" = xyes; then
     aixdynamic=yes
   fi
+elif test "$ac_cv_func_dlopen"  != yes ||
+     test "$ac_cv_func_dlsym"   != yes ||
+     test "$ac_cv_func_dlerror" != yes; then
+  if test "$ac_cv_func_shl_load" != yes ||
+     test "$ac_cv_func_shl_unload" != yes ||
+     test "$ac_cv_func_shl_findsym" != yes; then
+    dynamic=no
+  elif test "x$dynamic" = xyes; then
+    hpuxdynamic=yes
+    DL_EXT="${DL_EXT=sl}"
+    dnl autoheader won't allow us to define anything which isn't
+    dnl going into a header, and we can't undefine anything, so
+    dnl just define this anyway and rely on the later tests to
+    dnl define DYNAMIC or not.
+    AC_DEFINE(HPUXDYNAMIC)dnl
+  fi
 fi
 
 test -n "$GCC" && LDARG=-Wl,
@@ -1537,7 +1544,7 @@
   zsh_cv_sys_dynamic_execsyms="${zsh_cv_sys_dynamic_execsyms=yes}"
   zsh_cv_sys_dynamic_strip_exe="${zsh_cv_sys_dynamic_strip_exe=yes}"
   zsh_cv_sys_dynamic_strip_lib="${zsh_cv_sys_dynamic_strip_lib=yes}"
-  zsh_cv_sys_dynamic_broken="${zsh_cv_sys_dynamic_broken=no}"
+  zsh_cv_shared_environ="${zsh_cv_shared_environ=yes}"
 elif test "$host_os" = cygwin; then
   DL_EXT="${DL_EXT=dll}"
   DLLD="${DLLD=dllwrap}"
@@ -1723,7 +1730,6 @@
 if test "x$dynamic" = xyes; then
   zsh_SHARED_VARIABLE([environ], [char **])
   test "$zsh_cv_shared_environ" = yes || dynamic=no
-dnl  test "$zsh_cv_sys_dynamic_broken" = no || dynamic=no
   if test "$ac_cv_func_tgetent" = yes; then
     zsh_SHARED_FUNCTION([tgetent])
   fi
Index: Src/Modules/zftp.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/zftp.c,v
retrieving revision 1.17
diff -u -r1.17 zftp.c
--- Src/Modules/zftp.c	2001/06/15 13:01:42	1.17
+++ Src/Modules/zftp.c	2001/06/19 06:39:33
@@ -972,7 +972,8 @@
 #else
 	char portcmd[40];
 #endif
-	int ret, len;
+	SOCKLEN_T len;
+	int ret;
 
 	if (!(zfprefs & ZFPF_SNDP)) {
 	    zwarnnam(name, "only sendport mode available for data", NULL, 0);
@@ -1064,7 +1065,8 @@
 static int
 zfgetdata(char *name, char *rest, char *cmd, int getsize)
 {
-    int len, newfd, is_passive;
+    SOCKLEN_T len;
+    int newfd, is_passive;
     union tcp_sockaddr zdsock;
 
     if (zfopendata(name, &zdsock, &is_passive))
@@ -1698,7 +1700,8 @@
     struct servent *zservp;
     struct hostent *zhostp = NULL;
     char **addrp, *fname;
-    int err, len, tmout;
+    int err, tmout;
+    SOCKLEN_T  len;
     int herrno, af, hlen;
 
     if (!*args) {

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: AIX patch
  2001-06-19  6:45 AIX patch Andrej Borsenkow
@ 2001-06-19 16:11 ` Bart Schaefer
  2001-06-19 18:48   ` Andrej Borsenkow
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2001-06-19 16:11 UTC (permalink / raw)
  To: Andrej Borsenkow, ZSH Workers Mailing List

On Jun 19, 10:45am, Andrej Borsenkow wrote:
}
} Note, that it adds test for type of third argument to accept (that is used
} in some other functions as well). It currently checks for size_t, unsigned
} long and int (those I have on systems here and reported on AIX 4.x)

Linux/gcc apparently has an actual `socklen_t' typedef.  Probably should
try that first.

Index: aczsh.m4
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-4.0/aczsh.m4,v
retrieving revision 1.4
diff -u -r1.4 aczsh.m4
--- aczsh.m4	2001/06/19 16:00:43	1.4
+++ aczsh.m4	2001/06/19 16:01:45
@@ -695,7 +695,7 @@
     [base type of the third argument to accept],
     [zsh_cv_type_socklen_t],
     [zsh_cv_type_socklen_t=
-    for zsh_type in int "unsigned long" size_t ; do
+    for zsh_type in socklen_t int "unsigned long" size_t ; do
       AC_TRY_COMPILE(
         [#include <sys/types.h>
          #include <sys/socket.h>],

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: AIX patch
  2001-06-19 16:11 ` Bart Schaefer
@ 2001-06-19 18:48   ` Andrej Borsenkow
  2001-06-20 17:12     ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Andrej Borsenkow @ 2001-06-19 18:48 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: ZSH Workers Mailing List

On Tue, 19 Jun 2001, Bart Schaefer wrote:

> On Jun 19, 10:45am, Andrej Borsenkow wrote:
> }
> } Note, that it adds test for type of third argument to accept (that is used
> } in some other functions as well). It currently checks for size_t, unsigned
> } long and int (those I have on systems here and reported on AIX 4.x)
>
> Linux/gcc apparently has an actual `socklen_t' typedef.  Probably should
> try that first.
>
> +    for zsh_type in socklen_t int "unsigned long" size_t ; do

I had some considerations for testing for int first. If we hit some really
broken compiler that does not care about protoype mismatch we better have
the "most common" case first. It defaulted to int before - so let's stick
to int as much as possible. May be, I'm just plain paranoid. And the
whole needs check for general prototype support of course.

BTW Linux/gcc is pretty vague definition :-) On Mandrake cooker it finds
size_t.

-andrej


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: AIX patch
  2001-06-19 18:48   ` Andrej Borsenkow
@ 2001-06-20 17:12     ` Bart Schaefer
  2001-06-20 17:56       ` Andrej Borsenkow
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2001-06-20 17:12 UTC (permalink / raw)
  To: Andrej Borsenkow; +Cc: ZSH Workers Mailing List

On Jun 19, 10:48pm, Andrej Borsenkow wrote:
} Subject: Re: AIX patch
}
} On Tue, 19 Jun 2001, Bart Schaefer wrote:
} 
} > Linux/gcc apparently has an actual `socklen_t' typedef.  Probably should
} > try that first.
} >
} > +    for zsh_type in socklen_t int "unsigned long" size_t ; do
} 
} I had some considerations for testing for int first. If we hit some really
} broken compiler that does not care about protoype mismatch we better have
} the "most common" case first.

That's an excellent reason for trying int *second*.

If the socklen_t typedef exists, it's almost certainly the right thing to
use.  If it doesn't exist, it won't matter whether the compiler cares for
matching prototypes because it'll be a syntax error.

I strongly suspect that the intersection of compilers that botch up the
matching prototypes with headers that typedef socklen_t is the empty set.

} It defaulted to int before - so let's stick to int as much as
} possible. May be, I'm just plain paranoid. And the whole needs check
} for general prototype support of course.

That raises the question of what SOCKLEN_T gets defined to be when NONE
of the types that are attempted work.  (It also raises the question of
whether we should be testing for HAVE_SOCKLEN_T and providing our own
typedef if not, rather than defining a SOCKLEN_T macro.)  I think the
right way to default to `int' is to fall back on it when the test fails
entirely.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: AIX patch
  2001-06-20 17:12     ` Bart Schaefer
@ 2001-06-20 17:56       ` Andrej Borsenkow
  0 siblings, 0 replies; 5+ messages in thread
From: Andrej Borsenkow @ 2001-06-20 17:56 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Andrej Borsenkow, ZSH Workers Mailing List

On Wed, 20 Jun 2001, Bart Schaefer wrote:

>
> That raises the question of what SOCKLEN_T gets defined to be when NONE
> of the types that are attempted work.  (It also raises the question of
> whether we should be testing for HAVE_SOCKLEN_T and providing our own
> typedef if not, rather than defining a SOCKLEN_T macro.)  I think the
> right way to default to `int' is to fall back on it when the test fails
> entirely.
>

It does default to int currently. As for typedef - how are other types
handled currently (e.g. 64-bit integer)?

-andrej


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-06-20 17:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-19  6:45 AIX patch Andrej Borsenkow
2001-06-19 16:11 ` Bart Schaefer
2001-06-19 18:48   ` Andrej Borsenkow
2001-06-20 17:12     ` Bart Schaefer
2001-06-20 17:56       ` Andrej Borsenkow

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).