This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: readdir_r-problem on Solaris 2.5.1


Hi Tom,

On Tue, Sep 10, 2002 at 12:27:24PM -0600, tromey@redhat.com wrote:
> >>>>> "Martin" == Martin Kahlert <martin.kahlert@infineon.com> writes:
> 
> Martin> /usr/include/dirent.h: In member function `JArray<java::lang::Object*>*
> Martin> java::io::File::performList(java::io::FilenameFilter*,
> Martin> java::io::FileFilter*, java::lang::Class*)':
> Martin> /usr/include/dirent.h:109: too many arguments to function `dirent*
> Martin> readdir_r(DIR*, dirent*)'
> Martin> java/io/natFile.cc:151: at this point in file
> 
> Martin> I got a working gcj-3.2 on Solaris 2.5.1 (hello world type -
> Martin> my main application will compile during the next several
> Martin> hours) by this ugly hack:
> Martin> [ added -D_POSIX_PTHREAD_SEMANTICS ]
> 
> Martin> What is the correct way for this?
> 
> If this is in fact the best fix, we would probably proceed by adding
> the define via configure or in include/posix.h.
> 
> What affect does this -D have on other parts of the code?
> Is this a documented define?

man readdir_r on the machine says:
POSIX
     cc  [  flag...  ]  file  ...  - D_POSIX_PTHREAD_SEMANTICS  [
     library... ]
     int  *readdir_r(DIR  *dirp,  struct  dirent  *entry,  struct
     dirent **result);
....

I found it by looking at the headers.

$ find /usr/include -name '*.h' | xargs grep POSIX_PTHREAD_SEMANTICS
/usr/include/dirent.h:  (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
/usr/include/dirent.h:#if       (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
/usr/include/dirent.h:#if       (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
/usr/include/grp.h:     (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
/usr/include/grp.h:#if  (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
/usr/include/grp.h:#if  (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
/usr/include/pwd.h:     (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
/usr/include/pwd.h:#if  (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
/usr/include/pwd.h:#if  (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
/usr/include/signal.h:  (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
/usr/include/signal.h:#if       (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
/usr/include/signal.h:#if       (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
/usr/include/time.h:    (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
/usr/include/time.h:#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
/usr/include/time.h:#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
/usr/include/unistd.h:  (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
/usr/include/unistd.h:#if       (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
/usr/include/unistd.h:#if       (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)

The problem might be that _POSIX_C_SOURCE is 1 when compiled with
-D_POSIX_SOURCE: /usr/include/sys/feature_tests.h contains:
#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
#define _POSIX_C_SOURCE 1
#endif

The other values mentioned in this file are those:
/*
 *      Values of _POSIX_C_SOURCE
 *
 *              undefined       not a POSIX compilation
 *                      1       POSIX.1-1990 compilation
 *                      2       POSIX.2-1992 compilation
 *                199309L       POSIX.1b-1993 compilation
 */

none of them is greater than 199506.

Hope that helps
Martin.

PS: Testing on that machine is limited because it's dog slow.

-- 
The early bird catches the worm. If you want something else for       
breakfast, get up later.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]