From: Amos Jeffries Date: Mon, 18 Apr 2011 11:50:50 +0000 (-0600) Subject: ICC: support 64-bit environments dirent definitions X-Git-Tag: SQUID_3_1_12_1~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=319ce7bbf9c0ffb77c4b8089fde7076b63cc0623;p=thirdparty%2Fsquid.git ICC: support 64-bit environments dirent definitions struct dirent is not consistently defined for 32-bit and 64-bit enabled environments. Provide a dirent_t type defined appropriate to the environment for use instead. --- diff --git a/compat/compat_shared.h b/compat/compat_shared.h index 19ef83aaf4..556537b59d 100644 --- a/compat/compat_shared.h +++ b/compat/compat_shared.h @@ -30,8 +30,7 @@ /* * DIRENT functionality can apparently come from many places. - * I believe these should really be done by OS-specific compat - * files, but for now its left here. + * With various complaints by different compilers */ #if HAVE_DIRENT_H #include @@ -51,6 +50,15 @@ #endif /* HAVE_NDIR_H */ #endif /* HAVE_DIRENT_H */ +/* The structure dirent also varies between 64-bit and 32-bit environments. + * Define our own dirent_t type for consistent simple internal use. + * NP: GCC seems not to care about the type naming differences. + */ +#if defined(__USE_FILE_OFFSET64) && !defined(__GNUC__) +#define dirent_t struct dirent64 +#else +#define dirent_t struct dirent +#endif /* * Filedescriptor limits in the different select loops diff --git a/src/fs/ufs/store_dir_ufs.cc b/src/fs/ufs/store_dir_ufs.cc index 99019ca477..092b2f552e 100644 --- a/src/fs/ufs/store_dir_ufs.cc +++ b/src/fs/ufs/store_dir_ufs.cc @@ -1063,7 +1063,6 @@ UFSSwapDir::DirClean(int swap_index) { DIR *dir_pointer = NULL; - struct dirent *de = NULL; LOCAL_ARRAY(char, p1, MAXPATHLEN + 1); LOCAL_ARRAY(char, p2, MAXPATHLEN + 1); @@ -1107,6 +1106,7 @@ UFSSwapDir::DirClean(int swap_index) return 0; } + dirent_t *de; while ((de = readdir(dir_pointer)) != NULL && k < 20) { if (sscanf(de->d_name, "%X", &swapfileno) != 1) continue; diff --git a/src/fs/ufs/ufscommon.h b/src/fs/ufs/ufscommon.h index 815e3b2d64..cf701880e7 100644 --- a/src/fs/ufs/ufscommon.h +++ b/src/fs/ufs/ufscommon.h @@ -399,7 +399,7 @@ public: int done; int fn; - struct dirent *entry; + dirent_t *entry; DIR *td; char fullpath[SQUID_MAXPATHLEN]; char fullfilename[SQUID_MAXPATHLEN];