Teach ToolTalk config about NetBSD and adds HAS_STATVFS identifier which is consequen...
authorJelle Hermsen <jelle@jellehermsen.nl>
Thu, 27 Sep 2012 01:03:27 +0000 (03:03 +0200)
committerJon Trulson <jon@radscan.com>
Sat, 29 Sep 2012 01:11:09 +0000 (19:11 -0600)
cde/lib/tt/lib/tt_options.h
cde/lib/tt/lib/util/tt_file_system.C

index fef3512d0ded97094d6a023dfd361999bba1d038..cb8379f1eaea7f442e81e8f973420b949dc6e5d5 100644 (file)
 # undef  OPT_XTHREADS 
 # 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
 /* Unknown configuration, complain */
 }}}} You must edit lib/tt_options.h and add a section defining the options for your configuration.
index 074d2a5bb87fe5d68d525344a4fecb1bbc9f47cb..ef6924d7345a2a5931ad2187e53c9791365fd5e9 100644 (file)
 #elif defined(__osf__) || defined(CSRG_BASED)
 #       include <sys/types.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);
 # endif
+
 #       define MNTTYPE_NFS              "nfs"
 #       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__
 #       define ttFsType(e)              \
                                 (((e)->f_type == MOUNT_UFS) ? "ufs" \
@@ -466,6 +478,37 @@ updateFileSystemEntries ()
 
        for (entry = (TtMntEntry)tmpbuf; rc > 0; --rc,
             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)
         int             numfs,i;
         struct statfs   *buf;