dirlist bug fixed + scons updated

This commit is contained in:
hsn 2005-02-18 19:22:41 +00:00
parent 47c811eb02
commit e1530f9edc
9 changed files with 93 additions and 51 deletions

View File

@ -9,6 +9,8 @@ Version NEXT
removed STDC_HEADER checks, drop support for pre-ANSI compilers removed STDC_HEADER checks, drop support for pre-ANSI compilers
started work on alternate SCons based build system started work on alternate SCons based build system
fspd: use urandom, not random -> avoid hangs on Lin suck 2.6 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 Version 2.8.1b23 - 14 Jan 2005
use srandomdev for seeding of client seq. number generator use srandomdev for seeding of client seq. number generator

View File

@ -6,7 +6,7 @@ Import(Split("env PREFIX VERSION PACKAGE TARBALL"))
env.Alias("install",[ PREFIX+'/bin', PREFIX+'/man'] ) env.Alias("install",[ PREFIX+'/bin', PREFIX+'/man'] )
#Add build target #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 #Change default target to build
env.Default(None) env.Default(None)

View File

@ -8,13 +8,32 @@ PACKAGE='fsp'
VERSION='2.8.1b24' VERSION='2.8.1b24'
env = Environment(CPPPATH='#/include') 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 # Turn CPPFLAGS to list
env.Append( CPPFLAGS = []) 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 # Get CC from commandline
if ARGUMENTS.get('CC', 0): if ARGUMENTS.get('CC', 0):
env.Replace(CC = ARGUMENTS.get('CC')) env.Replace(CC = ARGUMENTS.get('CC'))
@ -69,11 +88,43 @@ def checkForUserPrefix(conf):
else: else:
conf.Result(0) conf.Result(0)
def getVarSize(conf,var):
conf.Message("checking for size of "+var+" ")
rc = conf.TryCompile("""
#include <stdio.h>
#include <sys/types.h>
main ()
{
if ((%s *) 0)
return 0;
if (sizeof (%s))
return 0;
;
return 0;
}
""" % (var,var),'.c')
if rc:
rc,result = conf.TryRun('''
#include <stdio.h>
#include <sys/types.h>
main ()
{
printf("%%d",sizeof(%s));
return 0;
}''' % var,'.c')
if rc:
rc=result
conf.Result(rc)
return rc
############ Start configuration ############## ############ Start configuration ##############
conf = Configure(env,{'checkForGCCOption':checkForGCCOption, conf = Configure(env,{'checkForGCCOption':checkForGCCOption,
'MAINTAINER_MODE':checkForMaintainerMode, 'MAINTAINER_MODE':checkForMaintainerMode,
'checkForLockPrefix':checkForLockPrefix, 'checkForLockPrefix':checkForLockPrefix,
'checkPrefix':checkForUserPrefix 'checkPrefix':checkForUserPrefix,
'sizeOf':getVarSize
}) })
#check for GCC options #check for GCC options
for option in Split(""" for option in Split("""
@ -93,6 +144,23 @@ for option in Split("""
#portability build time config #portability build time config
if conf.CheckFunc('srandomdev'): if conf.CheckFunc('srandomdev'):
conf.env.Append(CPPFLAGS = '-DHAVE_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 #check for available locking methods
if not conf.CheckType("union semun", "#include <sys/types.h>\n#include <sys/ipc.h>\n#include <sys/sem.h>",'c'): if not conf.CheckType("union semun", "#include <sys/types.h>\n#include <sys/ipc.h>\n#include <sys/sem.h>",'c'):
conf.env.Append(CPPFLAGS = "-D_SEM_SEMUN_UNDEFINED=1") conf.env.Append(CPPFLAGS = "-D_SEM_SEMUN_UNDEFINED=1")
@ -100,6 +168,7 @@ fun_lockf=conf.CheckFunc("lockf")
fun_semop=conf.CheckFunc("semop") fun_semop=conf.CheckFunc("semop")
fun_shmget=conf.CheckFunc("shmget") fun_shmget=conf.CheckFunc("shmget")
fun_flock=conf.CheckFunc("flock") fun_flock=conf.CheckFunc("flock")
#select locking type #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) 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": if lt == "none":
@ -125,6 +194,7 @@ else:
conf.env.Append(CPPFLAGS = '-DFSP_NOLOCKING') conf.env.Append(CPPFLAGS = '-DFSP_NOLOCKING')
conf.checkForLockPrefix() conf.checkForLockPrefix()
conf.checkPrefix() conf.checkPrefix()
conf.env.Append(CPPFLAGS = '-DSYSCONFDIR=\\"'+PREFIX+'/etc\\"')
conf.MAINTAINER_MODE() conf.MAINTAINER_MODE()
conf.Finish() conf.Finish()
@ -133,4 +203,4 @@ TARBALL=PACKAGE+'-'+VERSION+'.tar.gz'
env.Append(CPPFLAGS = "-DPACKAGE_VERSION=\\\""+VERSION+"\\\"") env.Append(CPPFLAGS = "-DPACKAGE_VERSION=\\\""+VERSION+"\\\"")
# process build rules # process build rules
Export( Split("env PREFIX PACKAGE VERSION TARBALL")) 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'))

View File

@ -38,7 +38,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include "my-string.h" #include "my-string.h"
#include <stdlib.h> #include <stdlib.h>

View File

@ -181,13 +181,12 @@ static RDIRENT **get_dir_blk (char * path)
dirblocksize = rlen; dirblocksize = rlen;
else else
if (rlen < dirblocksize) at_eof = 1; if (rlen < dirblocksize) at_eof = 1;
/* if(rlen < RDHSIZE) at_eof = 1; */ memcpy(buf + acc, ub->buf, rlen);
for(p1 = ub->buf, p2 = buf + acc, k = rlen; k--; ) *p2++ = *p1++;
acc += rlen; acc += rlen;
pos += rlen; pos += rlen;
} }
if(acc >= UBUF_MAXSPACE) len = UBUF_MAXSPACE; if(acc >= dirblocksize) len = dirblocksize;
else len = acc; else len = acc;
for(p2 = buf, rem = len, k = 0; ; k++) { 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; dp[cnt] = 0;
free(fpath); free(fpath);
return(dp); 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++; *p2++ = *p1++;
} }
free(fpath); free(fpath);

View File

@ -1,5 +1,6 @@
/*********************************************************************\ /*********************************************************************\
* Copyright (c) 1991 by Wen-King Su (wen-king@vlsi.cs.caltech.edu) * * 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 * * 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 * * that this notice is always included, and that you hold the author *
@ -17,49 +18,19 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifdef HAVE_ERRNO_H
#include <errno.h> #include <errno.h>
#endif
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef STDC_HEADERS
#include <stdlib.h> #include <stdlib.h>
#endif
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
#include <time.h> #include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
#endif
#endif
#include <fcntl.h> #include <fcntl.h>
#include <signal.h> #include <signal.h>
#ifdef HAVE_DIRENT_H
#include <dirent.h> #include <dirent.h>
#else
#ifdef HAVE_SYS_DIR_H
#include <sys/dir.h>
#else
#ifdef HAVE_SYS_NDIR_H
#include <sys/ndir.h>
#else
#ifdef HAVE_NDIR_H
#include <ndir.h>
#endif
#endif
#endif
#endif
/**************************************************************************** /****************************************************************************
* UBUF is the structure of message exchanged between server and clients. * UBUF is the structure of message exchanged between server and clients.

View File

@ -88,11 +88,7 @@ extern int logfd;
extern int tlogfd; extern int tlogfd;
void fsplogf (void); void fsplogf (void);
void fsplogs (void); void fsplogs (void);
#ifdef __STDC__
void fsploga(const char *fmt, ...); void fsploga(const char *fmt, ...);
#else
void fsploga(va_alist);
#endif
void xferlog(char direction, const char *filename,unsigned long filesize,const char *hostname); void xferlog(char direction, const char *filename,unsigned long filesize,const char *hostname);
#endif /* _FSP_S_EXTERN_H_ */ #endif /* _FSP_S_EXTERN_H_ */

View File

@ -11,6 +11,10 @@
#define fseeko fseek #define fseeko fseek
#endif #endif
#ifndef RETSIGTYPE
#define RETSIGTYPE void
#endif
#ifdef STAT_MACROS_BROKEN #ifdef STAT_MACROS_BROKEN
#define S_ISREG(mode) ((mode) & S_IFREG) #define S_ISREG(mode) ((mode) & S_IFREG)
#define S_ISDIR(mode) ((mode) & S_IFDIR) #define S_ISDIR(mode) ((mode) & S_IFDIR)