Hi Eric,

Am Donnerstag, 30. Mai 2002 16:45 schrieb Eric Boehm:
> On Thu, May 30, 2002 at 10:55:45PM +1000, Andrew Bartlett wrote:
> >>>>> "Tian"   == Tian-xiong Lu <[EMAIL PROTECTED]> writes:
> >>>>> "Jerry"  == Gerald Carter <[EMAIL PROTECTED]> writes:
> >>>>> "Andrew" == Andrew Bartlett <[EMAIL PROTECTED]> writes:
>
>     Tian> Just tried compling samba-2.2.4 on a Solaris 7 box with two
>     Tian> configure options: --with-libsmbclient --with-acl-support
>
>     Tian> When compiling I got a warning message like this: In
>     Tian> function "sys_readdir" lib/system.c 331 Warning: return from
>     Tian> incompatible pointer type.
>
>     Jerry> Am looking into it.
>
>     Andrew> BTW, this is one of the things currently blocking us from
>     Andrew> building on the Cray.  (Now that just means that we will
>     Andrew> find the next one, but anyway...)
>
> I've seen the following behavior on Solaris 8.
>
> 1. compiling 32-bit with Sun Workshop, configure checks for and finds
>    readdir64... yes
>    dirent64... yes
>
> 2. compiling 32-bit with Sun Workshop, configure checks for and finds
>    readdir64... no
>    dirent64... yes
>
> I believe that this is because the test program for readdir64 is
> incorrect.

I believe the test program isn't that wrong. Wouldn't it be correct simply not 
to use dirent64 at all if readdir64 isn't defined ?

For the 32 bit case (which I am using anyway), the warning comes from the 
declaration of readdir64 as:
 struct dirent *readdir64(DIR *);
instead of 
 struct dirent64 *readdir64(DIR *);
which might be expected.

Looking at sys/dirent.h:

typedef struct dirent {
        ino_t           d_ino;
        off_t           d_off;
        unsigned short  d_reclen;
        char            d_name[1];
} dirent_t;

typedef struct dirent64 {
        ino64_t         d_ino;
        off64_t         d_off;
        unsigned short  d_reclen;
        char            d_name[1];
} dirent64_t;

A small test program reveals:
hasch@/home/hasch/solaris/test> gcc -o test test.c
hasch@/home/hasch/solaris/test> ./test
sizeof(ino_t)=4
sizeof(off_t)=4
sizeof(ino64_t)=8
sizeof(off64_t)=8
hasch@/home/hasch/solaris/test> gcc -D_FILE_OFFSET_BITS=64 -o test test.c
hasch@/home/hasch/solaris/test> ./test
sizeof(ino_t)=8
sizeof(off_t)=8
sizeof(ino64_t)=8
sizeof(off64_t)=8

So (at least for Solaris 8 which is what I am using) SMB_STRUCT_DIRENT can 
always be defined as dirent.

...Juergen



Reply via email to