Hi!

----

Attached (as "astopen_o_search_001.diff.txt") is a prototype patch for
ast-open.2012-08-24 to get |O_search| defined (e.g. it's either
pointing to POSIX's |O_SEARCH|, Linux's |O_PATH| or is not defined)
and _used_ ...
... the bug problem with it is... it works on Solaris+AIX (which both
have |O_SEARCH|) ... but it does not work on Linux unless I compile
ast-open with $ (CC='gcc -D_GNU_SOURCE=1' nice ksh ./bin/package make)
#. The problem is that |O_PATH| is only defined if |_GNU_SOURCE| is
set... and something seems to undefine it somehow in the sources
unless it's set globally for all source files...

Glenn: Can you have a look, please ?

----

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 build_i386_64bit_opt_extrabuiltins/src/cmd/ksh93/bltins/cd_pwd.c 
build_strictoverflow/src/cmd/ksh93/bltins/cd_pwd.c
--- src/cmd/ksh93/bltins/cd_pwd.c       2012-08-09 15:24:15.000000000 +0200
+++ src/cmd/ksh93/bltins/cd_pwd.c       2012-08-25 05:48:44.740032375 +0200
@@ -89,8 +89,8 @@
        {
 #ifdef AT_FDCWD
                /*
-                * Open directory. First we try without |O_SEARCH| and
-                * if this fails with EACCESS we try with |O_SEARCH|
+                * Open directory. First we try without |O_search| and
+                * if this fails with EACCESS we try with |O_search|
                 * again.
                 * This is required ...
                 * - ... because some platforms may require that it can
@@ -106,10 +106,10 @@
                 * platforms.
                 */
                EINTR_REPEAT((fd = openat(dir, path, 
O_RDONLY|O_NONBLOCK|O_cloexec)) < 0);
-#   ifdef O_SEARCH
+#   ifdef O_search
                if((fd < 0) && (errno == EACCES))
                {
-                       EINTR_REPEAT((fd = openat(dir, path, 
O_SEARCH|O_cloexec)) < 0)
+                       EINTR_REPEAT((fd = openat(dir, path, 
O_search|O_cloexec)) < 0)
                }
 #   endif
 #else
@@ -307,7 +307,7 @@
                                goto success;
                        }
                }
-#ifndef O_SEARCH
+#ifndef O_search
                else
                {
                        
if((rval=chdir(path_relative(shp,stakptr(PATH_OFFSET)))) >= 0)
@@ -341,7 +341,7 @@
                                goto success;
                        }
                }
-#ifndef O_SEARCH
+#ifndef O_search
                else
                {
                        if(chdir(dir) >=0)
diff -r -u build_i386_64bit_opt_extrabuiltins/src/lib/libast/features/fcntl.c 
build_strictoverflow/src/lib/libast/features/fcntl.c
--- src/lib/libast/features/fcntl.c     2012-06-19 21:12:54.000000000 +0200
+++ src/lib/libast/features/fcntl.c     2012-08-25 06:38:39.711114636 +0200
@@ -27,6 +27,12 @@
  * generate POSIX fcntl.h
  */
 
+/*
+ * We use this to force Linux and some *BSD versions to tell us all
+ * their flags
+ */
+#define _GNU_SOURCE 1
+
 #include <sys/types.h>
 
 #include "FEATURE/lib"
@@ -325,6 +331,20 @@
 #else
        printf("#define O_cloexec               0\n");
 #endif
+#if defined(O_SEARCH)
+       printf("#define O_search                (%lx)\n", (long)O_SEARCH);
+#elif defined(O_PATH)
+       /*
+         * this requires |_GNU_SOURCE=1| to be set before _any_
+        * includes. We can't do a |define O_search O_PATH| here
+        * because |O_PATH| is only set when |_GNU_SOURCE=1| was set,
+        * which would require all consumers of this header to set
+        * |_GNU_SOURCE=1|. To avoid this we save the value.
+         */
+       printf("#define O_search                (%lx)\n", (long)O_PATH);
+#else
+       printf("/* O_search not available */\n");
+#endif
 #ifndef        O_TEMPORARY
        printf("#define O_TEMPORARY             0\n");
 #endif
_______________________________________________
ast-developers mailing list
ast-developers@research.att.com
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to