diff --git a/ChangeLog b/ChangeLog index 7dded47..5a88837 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,8 @@ Version NEXT removed STDC_HEADER checks, drop support for pre-ANSI compilers started work on alternate SCons based build system fspd: use urandom, not random -> avoid hangs on Lin suck 2.6 + build system converted to SCons + fixed directory listing bug in client library introduced in beta23 Version 2.8.1b23 - 14 Jan 2005 use srandomdev for seeding of client seq. number generator diff --git a/SConscript b/SConscript index 1b68e3b..2c6f7fb 100644 --- a/SConscript +++ b/SConscript @@ -6,7 +6,7 @@ Import(Split("env PREFIX VERSION PACKAGE TARBALL")) env.Alias("install",[ PREFIX+'/bin', PREFIX+'/man'] ) #Add build target -env.Alias("build", Split('server/fspd clients/ contrib/') ) +env.Alias("build", Split('server/fspd clients/ contrib/ tests/') ) #Change default target to build env.Default(None) diff --git a/SConstruct b/SConstruct index a7d7a0b..d7e724b 100644 --- a/SConstruct +++ b/SConstruct @@ -8,13 +8,32 @@ PACKAGE='fsp' VERSION='2.8.1b24' env = Environment(CPPPATH='#/include') -env.Append( ENV = {'HOME': os.environ.get('HOME')} ) -env.Append( ENV = {'DISTCC_HOSTS': os.environ.get('DISTCC_HOSTS')} ) -if os.environ.get('CC'): - env.Replace(CC = os.environ.get('CC')) - # Turn CPPFLAGS to list env.Append( CPPFLAGS = []) + +################### Functions ###################### +def importEnv(list=None, prefix=None): + if list: + for i in list: + if os.environ.get(i): + kw={} + kw[i]=os.environ.get(i) + kw={ 'ENV': kw } + env.Append(**kw) + if prefix: + for i in os.environ.keys(): + if i.startswith(prefix): + kw={} + kw[i]=os.environ.get(i) + kw={ 'ENV': kw } + env.Append(**kw) + +#import environment +importEnv(['HOME','CC']) +importEnv(prefix='DISTCC_') +importEnv(prefix='CCACHE_') +if env['ENV'].get('CC'): + env.Replace( CC = env['ENV'].get('CC')) # Get CC from commandline if ARGUMENTS.get('CC', 0): env.Replace(CC = ARGUMENTS.get('CC')) @@ -69,11 +88,43 @@ def checkForUserPrefix(conf): else: conf.Result(0) +def getVarSize(conf,var): + conf.Message("checking for size of "+var+" ") + rc = conf.TryCompile(""" +#include +#include + +main () +{ + if ((%s *) 0) + return 0; + if (sizeof (%s)) + return 0; + ; + return 0; +} +""" % (var,var),'.c') + if rc: + rc,result = conf.TryRun(''' +#include +#include + +main () +{ + printf("%%d",sizeof(%s)); + return 0; +}''' % var,'.c') + if rc: + rc=result + conf.Result(rc) + return rc + ############ Start configuration ############## conf = Configure(env,{'checkForGCCOption':checkForGCCOption, 'MAINTAINER_MODE':checkForMaintainerMode, 'checkForLockPrefix':checkForLockPrefix, - 'checkPrefix':checkForUserPrefix + 'checkPrefix':checkForUserPrefix, + 'sizeOf':getVarSize }) #check for GCC options for option in Split(""" @@ -93,6 +144,23 @@ for option in Split(""" #portability build time config if conf.CheckFunc('srandomdev'): conf.env.Append(CPPFLAGS = '-DHAVE_SRANDOMDEV') +if conf.CheckFunc('fseeko'): + conf.env.Append(CPPFLAGS = '-DHAVE_FSEEKO') +if conf.CheckFunc('random'): + conf.env.Append(CPPFLAGS = '-DHAVE_RANDOM') +if conf.CheckFunc('fork'): + conf.env.Append(CPPFLAGS = '-DHAVE_FORK') +if conf.CheckFunc('setsid'): + conf.env.Append(CPPFLAGS = '-DHAVE_SETSID') +if conf.CheckCHeader('unistd.h'): + env.Append(CPPFLAGS = '-DHAVE_UNISTD_H') +env.Append(CPPFLAGS = '-DSIZEOF_CHAR='+conf.sizeOf("char")) +env.Append(CPPFLAGS = '-DSIZEOF_LONG='+conf.sizeOf("long")) +env.Append(CPPFLAGS = '-DSIZEOF_SHORT='+conf.sizeOf("short")) +env.Append(CPPFLAGS = '-DSIZEOF_UNSIGNED='+conf.sizeOf("unsigned")) +env.Append(CPPFLAGS = '-DSIZEOF_VOID='+conf.sizeOf("void")) +env.Append(CPPFLAGS = '-DSIZEOF_OFF_T='+conf.sizeOf("off_t")) + #check for available locking methods if not conf.CheckType("union semun", "#include \n#include \n#include ",'c'): conf.env.Append(CPPFLAGS = "-D_SEM_SEMUN_UNDEFINED=1") @@ -100,6 +168,7 @@ fun_lockf=conf.CheckFunc("lockf") fun_semop=conf.CheckFunc("semop") fun_shmget=conf.CheckFunc("shmget") fun_flock=conf.CheckFunc("flock") + #select locking type lt=ARGUMENTS.get('locking', 0) or ARGUMENTS.get("with-locking",0) or ARGUMENTS.get("lock",0) or ARGUMENTS.get("with-lock",0) if lt == "none": @@ -125,6 +194,7 @@ else: conf.env.Append(CPPFLAGS = '-DFSP_NOLOCKING') conf.checkForLockPrefix() conf.checkPrefix() +conf.env.Append(CPPFLAGS = '-DSYSCONFDIR=\\"'+PREFIX+'/etc\\"') conf.MAINTAINER_MODE() conf.Finish() @@ -133,4 +203,4 @@ TARBALL=PACKAGE+'-'+VERSION+'.tar.gz' env.Append(CPPFLAGS = "-DPACKAGE_VERSION=\\\""+VERSION+"\\\"") # process build rules Export( Split("env PREFIX PACKAGE VERSION TARBALL")) -env.SConscript(dirs=Split('. bsd_src common server client clients contrib')) +env.SConscript(dirs=Split('. bsd_src common server client clients contrib tests')) diff --git a/bsd_src/find.c b/bsd_src/find.c index 153c9cb..f0e2791 100644 --- a/bsd_src/find.c +++ b/bsd_src/find.c @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include "my-string.h" #include diff --git a/client/util.c b/client/util.c index 10f017b..618703a 100644 --- a/client/util.c +++ b/client/util.c @@ -181,13 +181,12 @@ static RDIRENT **get_dir_blk (char * path) dirblocksize = rlen; else if (rlen < dirblocksize) at_eof = 1; - /* if(rlen < RDHSIZE) at_eof = 1; */ - for(p1 = ub->buf, p2 = buf + acc, k = rlen; k--; ) *p2++ = *p1++; + memcpy(buf + acc, ub->buf, rlen); acc += rlen; pos += rlen; } - if(acc >= UBUF_MAXSPACE) len = UBUF_MAXSPACE; + if(acc >= dirblocksize) len = dirblocksize; else len = acc; for(p2 = buf, rem = len, k = 0; ; k++) { @@ -231,12 +230,12 @@ static RDIRENT **get_dir_blk (char * path) } } - if(acc < UBUF_MAXSPACE) { + if(acc < dirblocksize) { dp[cnt] = 0; free(fpath); return(dp); } - for(p1 = buf + UBUF_MAXSPACE, p2 = buf, k = (acc -= UBUF_MAXSPACE); k--;) + for(p1 = buf + dirblocksize, p2 = buf, k = (acc -= dirblocksize); k--;) *p2++ = *p1++; } free(fpath); diff --git a/configure.ac b/configure.ac index d842e57..83cfa65 100644 --- a/configure.ac +++ b/configure.ac @@ -222,13 +222,13 @@ elif test "x$with_locking" = "xshmget" -a "x$ac_cv_func_shmget" = "xyes" -a "x$a AC_DEFINE(FSP_USE_SHAREMEM_AND_LOCKF,1,[Define for lockf locking]) elif test "x$with_locking" = "xflock" -a "x$ac_cv_func_flock" = "xyes"; then AC_DEFINE(FSP_USE_FLOCK,1,[Define for flock style locks]) -#Autodetect locking +#Autodetect locking elif test "x$ac_cv_func_semop" = "xyes" -a "x$ac_cv_func_shmget" = "xyes"; then AC_DEFINE(FSP_USE_SHAREMEM_AND_SEMOP,1) elif test "x$ac_cv_func_shmget" = "xyes" -a "x$ac_cv_func_lockf" = "xyes"; then AC_DEFINE(FSP_USE_SHAREMEM_AND_LOCKF,1) elif test "x$ac_cv_func_lockf" = "xyes"; then AC_DEFINE(FSP_USE_LOCKF,1) -elif test "x$ac_cv_func_flock" = "xyes"; then AC_DEFINE(FSP_USE_FLOCK,1) +elif test "x$ac_cv_func_flock" = "xyes"; then AC_DEFINE(FSP_USE_FLOCK,1) else AC_DEFINE(FSP_NOLOCKING,1) AC_MSG_NOTICE([no suitable locking method detected]) diff --git a/include/common_def.h b/include/common_def.h index d206203..795a7cc 100644 --- a/include/common_def.h +++ b/include/common_def.h @@ -1,5 +1,6 @@ /*********************************************************************\ * Copyright (c) 1991 by Wen-King Su (wen-king@vlsi.cs.caltech.edu) * + * Copyright (c) 2003-2005 by Radim Kolar * * * * You may copy or modify this file in any manner you wish, provided * * that this notice is always included, and that you hold the author * @@ -17,49 +18,19 @@ #include #include -#ifdef HAVE_ERRNO_H #include -#endif #include #include #ifdef HAVE_UNISTD_H #include #endif -#ifdef STDC_HEADERS #include -#endif - -#if TIME_WITH_SYS_TIME - # include - # include -#else - # if HAVE_SYS_TIME_H - # include - # else - # include - #endif -#endif +#include #include - #include - -#ifdef HAVE_DIRENT_H #include -#else -#ifdef HAVE_SYS_DIR_H -#include -#else -#ifdef HAVE_SYS_NDIR_H -#include -#else -#ifdef HAVE_NDIR_H -#include -#endif -#endif -#endif -#endif /**************************************************************************** * UBUF is the structure of message exchanged between server and clients. diff --git a/include/s_extern.h b/include/s_extern.h index 5fad1dc..e0a2692 100644 --- a/include/s_extern.h +++ b/include/s_extern.h @@ -88,11 +88,7 @@ extern int logfd; extern int tlogfd; void fsplogf (void); void fsplogs (void); -#ifdef __STDC__ void fsploga(const char *fmt, ...); -#else -void fsploga(va_alist); -#endif void xferlog(char direction, const char *filename,unsigned long filesize,const char *hostname); #endif /* _FSP_S_EXTERN_H_ */ diff --git a/include/tweak.h b/include/tweak.h index 48e8054..f5cb857 100644 --- a/include/tweak.h +++ b/include/tweak.h @@ -11,6 +11,10 @@ #define fseeko fseek #endif +#ifndef RETSIGTYPE +#define RETSIGTYPE void +#endif + #ifdef STAT_MACROS_BROKEN #define S_ISREG(mode) ((mode) & S_IFREG) #define S_ISDIR(mode) ((mode) & S_IFDIR)