On Wed, Sep 12, 2012 at 2:17 PM, Irek Szczesniak <iszczesn...@gmail.com> wrote:
> Our build of ast-ksh.20120911 fails with src/cmd/ksh93/sh/io.c", line
> 1008: undefined symbol: SOCK_CLOEXEC
>
> I used the patch below to fix the problem, but then ran into the old
> bug with shtests: line 307: write to 1 failed [Bad file number].
>
> Now the question is: Is Solaris still going to be supported? Or is
> support fading away? I've seen many other opensource projects
> abandoning Solaris after Oracle killed Opensolaris...

As Glenn said Solaris will be supported. The problem is partially my
fault... we run a lot of experiments right now and not all platforms
are tested properly (it's called "alpha" for a reason... :-) ) ...

Attached (as "astksh20120911_solaris_fix001.diff.txt") is a patch
which fixes the build and runtime problems...

Long-term solution may be to add a |_ast_accept4()| in libast as
portability layer for OSes which do not have |accept4()| (I'm not fond
of that name... ;-( ).

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) roland.ma...@nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)
diff -r -u original/src/cmd/ksh93/edit/history.c 
build_i386_64bit_opt/src/cmd/ksh93/edit/history.c
--- src/cmd/ksh93/edit/history.c        2012-08-28 15:58:07.000000000 +0200
+++ src/cmd/ksh93/edit/history.c        2012-09-12 23:57:07.955787205 +0200
@@ -151,7 +151,7 @@
            (unsigned)acctfd < 10)
        {
                int n;
-               if((n = fcntl(acctfd, F_dupfd_cloexec, 10)) >= 0)
+               if((n = sh_fcntl(acctfd, F_dupfd_cloexec, 10)) >= 0)
                {
                        sh_close(acctfd);
                        acctfd = n;
@@ -269,7 +269,7 @@
        if((unsigned)fd <=2)
        {
                int n;
-               if((n=fcntl(fd,F_dupfd_cloexec,10))>=0)
+               if((n=sh_fcntl(fd,F_dupfd_cloexec,10))>=0)
                {
                        sh_close(fd);
                        fd=n;
@@ -1194,7 +1194,7 @@
                sh_close(oldfd=sffileno(fp));
                
if((newfd=open(hp->histname,O_BINARY|O_APPEND|O_CREAT|O_RDWR|O_cloexec,S_IRUSR|S_IWUSR))
 >= 0)
                {
-                       if(fcntl(newfd, F_dupfd_cloexec, oldfd) !=oldfd)
+                       if(sh_fcntl(newfd, F_dupfd_cloexec, oldfd) !=oldfd)
                                return(-1);
                        fcntl(oldfd,F_SETFD,FD_CLOEXEC);
                        close(newfd);
diff -r -u original/src/cmd/ksh93/sh/io.c 
build_i386_64bit_opt/src/cmd/ksh93/sh/io.c
--- src/cmd/ksh93/sh/io.c       2012-09-05 23:53:53.000000000 +0200
+++ src/cmd/ksh93/sh/io.c       2012-09-12 23:57:07.955874564 +0200
@@ -93,9 +93,6 @@
 #      ifndef SHUT_WR
 #         define SHUT_WR         1
 #      endif
-#      ifndef SOCK_CLOEXEC
-#        define SOCK_CLOEXEC   0
-#      endif
 #      if _socketpair_shutdown_mode
 #         define pipe(v) 
((socketpair(AF_UNIX,SOCK_STREAM|SOCK_CLOEXEC,0,v)<0||shutdown((v)[1],SHUT_RD)<0||fchmod((v)[1],S_IWUSR)<0||shutdown((v)[0],SHUT_WR)<0||fchmod((v)[0],S_IRUSR)<0)?(-1):0)
 #      else
@@ -103,6 +100,10 @@
 #      endif
 #   endif
 
+#ifndef SOCK_CLOEXEC
+#      define SOCK_CLOEXEC     (0)
+#endif
+
 #if !_lib_getaddrinfo
 
 #undef EAI_SYSTEM
@@ -973,13 +974,14 @@
        return(0);
 }
 
-#ifndef _lib_accept4
-#   define accept4(a,b,c,d)    accept(a,b,c)
-#endif
 #if SHOPT_COSHELL
     int sh_coaccept(Shell_t *shp,int *pv,int out)
     {
+#ifdef _lib_accept4
        int fd = accept4(pv[0],(struct sockaddr*)0,(socklen_t*)0,SOCK_CLOEXEC);
+#else
+       int fd = accept(pv[0],(struct sockaddr*)0,(socklen_t*)0);
+#endif
        sh_close(pv[0]);
        pv[0] = -1;
        if(fd<0)
diff -r -u original/src/cmd/ksh93/sh/path.c 
build_i386_64bit_opt/src/cmd/ksh93/sh/path.c
--- src/cmd/ksh93/sh/path.c     2012-09-10 21:32:51.000000000 +0200
+++ src/cmd/ksh93/sh/path.c     2012-09-12 23:57:07.955907404 +0200
@@ -1296,7 +1296,7 @@
                        if(n!=10)
                        {
                                sh_close(10);
-                               fcntl(n, F_dupfd_cloexec, 10);
+                               sh_fcntl(n, F_dupfd_cloexec, 10);
                                sh_close(n);
                                n=10;
                        }
diff -r -u original/src/cmd/ksh93/sh/xec.c 
build_i386_64bit_opt/src/cmd/ksh93/sh/xec.c
--- src/cmd/ksh93/sh/xec.c      2012-09-05 22:32:53.000000000 +0200
+++ src/cmd/ksh93/sh/xec.c      2012-09-12 23:57:07.955928171 +0200
@@ -121,7 +121,7 @@
        if(sh_rpipe(subpipe) < 0)
                return(false);
        usepipe++;
-       subpipe[2] = fcntl(1,F_dupfd_cloexec,10);
+       subpipe[2] = sh_fcntl(1,F_dupfd_cloexec,10);
 #ifdef _lib_pipe2
        fcntl(subpipe[0],F_SETFD,FD_CLOEXEC);
        fcntl(subpipe[2],F_SETFD,FD_CLOEXEC);
@@ -3394,7 +3394,7 @@
                sh_pipe(shp->cpipe);
                if((outfd=shp->cpipe[1]) < 10) 
                {
-                       int fd=fcntl(shp->cpipe[1],F_dupfd_cloexec,10);
+                       int fd=sh_fcntl(shp->cpipe[1],F_dupfd_cloexec,10);
                        if(fd>=10)
                        {
                                shp->fdstatus[fd] = 
(shp->fdstatus[outfd]&~IOCLEX);
_______________________________________________
ast-developers mailing list
ast-developers@research.att.com
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to