1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Teach ToolTalk config about NetBSD and adds HAS_STATVFS identifier which is consequently used in tt_file_system.C, because NetBSD switched to the POSIX/XOpen statvfs() calls in 2004.

This commit is contained in:
Jelle Hermsen 2012-09-27 03:03:27 +02:00 committed by Jon Trulson
parent 0ea703ed1e
commit 399915f0ce
2 changed files with 76 additions and 2 deletions

View file

@ -624,6 +624,37 @@
# undef OPT_XTHREADS # undef OPT_XTHREADS
# define OPT_CONST_CORRECT # define OPT_CONST_CORRECT
#elif defined(__NetBSD__)
# undef OPT_UNIX_SOCKET_RPC
# undef OPT_TLI
# undef OPT_DLOPEN_X11
# undef OPT_DLOPEN_CE
# undef OPT_ADDMSG_DIRECT
# undef OPT_SECURE_RPC
# undef OPT_CLASSING_ENGINE
# undef OPT_PATCH
# define OPT_POSIX_SIGNAL
# undef OPT_BSD_WAIT
# undef OPT_DGETTEXT
# define OPT_CATGETS
# undef OPT_GETDTABLESIZE
# undef OPT_SYSINFO
# define OPT_CPP_PATH "/usr/bin/cpp"
# define OPT_CPP_OPTIONS ""
# define OPT_STRERROR
# undef OPT_SVR4_GETMNTENT
# undef OPT_LOCKF_MNTENT
# define OPT_LOCAL_MOUNT_TYPE MNTTYPE_UFS
# undef OPT_OLD_RPC
# define OPT_DEFINE_SIG_PF
# define OPT_TAR_HAS_EXCLUDE_OPTION
# define OPT_HAS_REALPATH
# define OPT_AUTOMOUNT_PATH_FIX
# define OPT_BUG_RPCINTR
# undef OPT_XTHREADS
# define OPT_CONST_CORRECT
# define HAS_STATVFS
#else #else
/* Unknown configuration, complain */ /* Unknown configuration, complain */
}}}} You must edit lib/tt_options.h and add a section defining the options for your configuration. }}}} You must edit lib/tt_options.h and add a section defining the options for your configuration.

View file

@ -85,12 +85,24 @@
#elif defined(__osf__) || defined(CSRG_BASED) #elif defined(__osf__) || defined(CSRG_BASED)
# include <sys/types.h> # include <sys/types.h>
# include <sys/mount.h> # include <sys/mount.h>
# ifdef __osf__
#if defined(HAS_STATVFS)
extern "C" int getfsstat(struct statvfs *, long, int);
#elif defined(__osf__)
extern "C" int getfsstat(struct statfs *, long, int); extern "C" int getfsstat(struct statfs *, long, int);
# endif # endif
# define MNTTYPE_NFS "nfs" # define MNTTYPE_NFS "nfs"
# define ttOpenMntTbl(path,mode) ((FILE *) 1) # define ttOpenMntTbl(path,mode) ((FILE *) 1)
# define TtMntEntry struct statfs *
# if defined(HAS_STATVFS)
# include <sys/statvfs.h>
# define TtMntEntry struct statvfs *
# else
# define TtMntEntry struct statfs *
# endif
# ifdef __osf__ # ifdef __osf__
# define ttFsType(e) \ # define ttFsType(e) \
(((e)->f_type == MOUNT_UFS) ? "ufs" \ (((e)->f_type == MOUNT_UFS) ? "ufs" \
@ -466,6 +478,37 @@ updateFileSystemEntries ()
for (entry = (TtMntEntry)tmpbuf; rc > 0; --rc, for (entry = (TtMntEntry)tmpbuf; rc > 0; --rc,
entry = (TtMntEntry)((char *) entry + entry->vmt_length)) entry = (TtMntEntry)((char *) entry + entry->vmt_length))
#elif defined(HAS_STATVFS)
int numfs,i;
struct statvfs *buf;
long bufsize;
int flags = MNT_NOWAIT;
char *s, *host, path[MNAMELEN] ;
numfs = getvfsstat ( (struct statvfs *)0, 0, 0 );
bufsize = numfs * sizeof ( struct statvfs );
buf = (struct statvfs *) malloc ( bufsize );
memset ((void *)buf,0,bufsize);
getvfsstat ( buf, bufsize, flags );
for ( i=0; i<numfs; i++ )
{
// convert path@host to host:/path
s = strchr(buf[i].f_mntfromname,'@');
if (s != NULL) {
host = s + 1 ;
memset((char*)path,0,MNAMELEN);
strncpy(path,buf[i].f_mntfromname, (strlen(buf[i].f_mntfromname)
- strlen(s))) ;
strcpy(buf[i].f_mntfromname,host) ;
strcat(buf[i].f_mntfromname,":") ;
strcat(buf[i].f_mntfromname,path) ;
}
entry = &buf[i];
#elif defined(__osf__) || defined(CSRG_BASED) #elif defined(__osf__) || defined(CSRG_BASED)
int numfs,i; int numfs,i;
struct statfs *buf; struct statfs *buf;