This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Neuter socketpair on Stratus VOS
authorPaul Green <Paul.Green@stratus.com>
Thu, 28 Mar 2002 07:46:00 +0000 (02:46 -0500)
committerJarkko Hietaniemi <jhi@iki.fi>
Thu, 28 Mar 2002 13:47:14 +0000 (13:47 +0000)
Message-Id: <200203281246.HAA14426@mailhub1.stratus.com>

p4raw-id: //depot/perl@15582

ext/Socket/socketpair.t
hints/vos.sh
vos/vos.c
vos/vosish.h

index d70f164..6549eae 100644 (file)
@@ -57,7 +57,8 @@ if( !$Config{d_alarm} ) {
 } else {
   # This should fail but not die if there is real socketpair
   eval {socketpair LEFT, RIGHT, -1, -1, -1};
-  if ($@ =~ /^Unsupported socket function "socketpair" called/) {
+  if ($@ =~ /^Unsupported socket function "socketpair" called/ ||
+      $! =~ /^The operation requested is not supported./) { # Stratus VOS
     plan skip_all => 'No socketpair (real or emulated)';
   } else {
     eval {AF_UNIX};
index f3bd74d..f9b9a88 100644 (file)
@@ -91,3 +91,6 @@ dont_use_nlink=define
 
 # Tell Configure where to find the hosts file.
 hostcat="cat /system/stcp/hosts"
+
+# VOS does not have socketpair() but we supply one in vos.c
+d_sockpair="define"
index c3566d4..a72614c 100644 (file)
--- a/vos/vos.c
+++ b/vos/vos.c
@@ -1,14 +1,17 @@
 /* Beginning of modification history */
 /* Written 02-01-02 by Nick Ing-Simmons (nick@ing-simmons.net) */
+/* Modified 02-03-27 by Paul Green (Paul.Green@stratus.com) to
+     add socketpair() dummy. */
 /* End of modification history */
 
-/* VOS doesn't supply a truncate function, so we build one up
-   from the available POSIX functions.  */
-
+#include <errno.h>
 #include <fcntl.h>
 #include <sys/types.h>
 #include <unistd.h>
 
+/* VOS doesn't supply a truncate function, so we build one up
+   from the available POSIX functions.  */
+
 int
 truncate(const char *path, off_t len)
 {
@@ -20,3 +23,15 @@ truncate(const char *path, off_t len)
  }
  return code;
 }
+
+/* VOS doesn't implement AF_UNIX (AF_LOCAL) style sockets, and
+   the perl emulation of them hangs on VOS (due to stcp-1257),
+   so we supply this version that always fails.  */
+
+int
+socketpair (int family, int type, int protocol, int fd[2]) {
+ fd[0] = 0;
+ fd[1] = 0;
+ errno = ENOSYS;
+ return -1;
+}
index 5befc65..dfddd31 100644 (file)
@@ -9,3 +9,6 @@ extern int ioctl (int fd, int request, ...);
 
 /* Specify a prototype for truncate() since we are supplying one. */
 extern int truncate (const char *path, off_t len);
+
+/* Specify a prototype for socketpair() since we supplying one. */
+extern int socketpair (int family, int type, int protocol, int fd[2]);