Samba 2.0.6 Compilation Warning under Solaris 7

dlynde at draper.com dlynde at draper.com
Mon Apr 24 21:26:04 GMT 2000


I am trying to install Samba 2.0.6 under Solaris 7 (latest Sun-recommended
patches applied) using the GNU C compiler "gcc version 2.95.1 19990816
(release)".  It seems strange to me that there is a compilation warning because
the purpose of the wrapper for which the compilation warning is issued is to
make sure typing and results are correct.

The problem appears to be due to a difference in what the samba code expects
and what is done in the Solaris "dirent.h" include file.  Since I don't know
which has the error, I don't know what to do to fix the problem.


Compiler warning during make:
--------------------------------------------------------------------------------
  .
  .
  .
Compiling lib/slprintf.c
Compiling lib/system.c
lib/system.c: In function `sys_readdir':
lib/system.c:350: warning: return from incompatible pointer type
Compiling lib/doscalls.c
  .
  .
  .
--------------------------------------------------------------------------------

The code in system.c:
--------------------------------------------------------------------------------
  .
  .
  .
/*******************************************************************
 A readdir wrapper that will deal with 64 bit filesizes.
********************************************************************/

SMB_STRUCT_DIRENT *sys_readdir(DIR *dirp)
{
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_READDIR64)
  return readdir64(dirp);
#else
  return readdir(dirp);
#endif
}
  .
  .
  .
--------------------------------------------------------------------------------

>From include file includes.h:
--------------------------------------------------------------------------------
  .
  .
  .
/*
 * Type for dirent structure.
 */

#ifndef SMB_STRUCT_DIRENT
#  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_DIRENT64)
#    define SMB_STRUCT_DIRENT struct dirent64
#  else
#    define SMB_STRUCT_DIRENT struct dirent
#  endif
#endif
  .
  .
  .
--------------------------------------------------------------------------------

>From "man lf64":
--------------------------------------------------------------------------------
  .
  .
  .
  <dirent.h>
     struct dirent *readdir();     struct    dirent64    *read-
                                   dir64();
     struct dirent *readdir_r();   struct              dirent64
                                   *readdir64_r();
  .
  .
  .
--------------------------------------------------------------------------------

>From config.h:
--------------------------------------------------------------------------------
  .
  .
  .
#define HAVE_STRUCT_DIRENT64 1
  .
  .
  .
#define HAVE_EXPLICIT_LARGEFILE_SUPPORT 1
  .
  .
  .
#define HAVE_READDIR64 1
  .
  .
  .
--------------------------------------------------------------------------------

>From Makefile:
--------------------------------------------------------------------------------
  .
  .
  .
CPPFLAGS= -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
  .
  .
  .
--------------------------------------------------------------------------------


If you add "-E" to CFLAGS in the Makefile, you can see the code produced is:

  .
  .
  .
extern struct dirent    * readdir64 (DIR *);
  .
  .
  .
struct dirent64  *sys_readdir(DIR *dirp);
  .
  .
  .
struct dirent64  *sys_readdir(DIR *dirp)
{

  return readdir64(dirp);



}


The problem is that the "readdir64" result is type "dirent", not the samba-
expected "dirent64".

This is happening in the Solaris "dirent.h", where:

  .
  .
  .
/* large file compilation environment setup */
#if !defined(_LP64) && _FILE_OFFSET_BITS == 64
#ifdef __PRAGMA_REDEFINE_EXTNAME
#pragma redefine_extname        readdir readdir64
#else
#define readdir                 readdir64
#endif
#endif  /* _FILE_OFFSET_BITS == 64 */
  .
  .
  .

causes:

extern struct dirent    *readdir(DIR *);

to become:

extern struct dirent    * readdir64 (DIR *);

So, either this should not be happening in dirent.h or the samba code needs
to be altered so that "SMB_STRUCT_DIRENT" becomes "dirent", rather than
"dirent64".

Actually, I would be happy just to know how to compile samba without largefiles
support.


More information about the samba mailing list