pkgsrc/sysutils/fam/patches/patch-ad
sketch 97ff422b68 Various fixes/cleanups to get this package compiling on Solaris:
+ Use the mnttab(4) interface instead of mntent.
 + C++ syntax cleanups to appease the SunPro compiler.
 + Use MAXPATHLEN instead of NAME_MAX which can be unimplemented on strict
   POSIX systems.
 + Use POSIX inttypes.h if BSD types are not available.
 + RPC includes and C++ namespace fixes.
 + Use dirent(3) instead of older sys/dir.h interface.
 + Avoid `sun' namespace collision.

Patch based on the work of Robert Lillack and others, described in
http://mail-index.netbsd.org/tech-pkg/2004/08/20/0005.html and tested with
SunPro and gcc.
2004-11-19 12:35:22 +00:00

87 lines
2.3 KiB
Text

$NetBSD: patch-ad,v 1.5 2004/11/19 12:35:22 sketch Exp $
--- src/NFSFileSystem.c++.orig 2003-01-18 14:18:12.000000000 +0000
+++ src/NFSFileSystem.c++ 2004-11-08 17:31:41.663685000 +0000
@@ -24,7 +24,7 @@
#include "NFSFileSystem.h"
#include <assert.h>
-#include <mntent.h>
+#include "fam-mntent.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -41,12 +41,20 @@
#define ACREGMIN 3
#endif
+#if defined(HAVE_SYS_MNTTAB_H)
+NFSFileSystem::NFSFileSystem(const mnttab& mnt)
+#else
NFSFileSystem::NFSFileSystem(const mntent& mnt)
+#endif
: FileSystem(mnt)
{
// Extract the host name from the fs name.
+#if defined(HAVE_SYS_MNTTAB_H)
+ const char *fsname = mnt.mnt_special;
+#else
const char *fsname = mnt.mnt_fsname;
+#endif
const char *colon = strchr(fsname, ':');
if(colon == NULL)
{
@@ -55,12 +63,12 @@
assert(colon);
colon = fsname;
}
- char hostname[NAME_MAX + 1];
+ char hostname[MAXPATHLEN + 1];
int hostnamelen = colon - fsname;
- if(hostnamelen > NAME_MAX)
+ if(hostnamelen > MAXPATHLEN)
{
- assert(hostnamelen <= NAME_MAX);
- hostnamelen = NAME_MAX;
+ assert(hostnamelen <= MAXPATHLEN);
+ hostnamelen = MAXPATHLEN;
}
strncpy(hostname, fsname, hostnamelen);
hostname[hostnamelen] = '\0';
@@ -84,7 +92,11 @@
// acregmin, acregmax, actimeo, and noac options in the mount
// options. Otherwise, use defaults.
+#if defined(HAVE_SYS_MNTTAB_H)
+ const char * opt = mnt.mnt_mntopts;
+#else
const char * opt = mnt.mnt_opts;
+#endif
bool f_noac = false;
bool f_actimeo = false;
@@ -102,20 +114,20 @@
if (strstr(opt, "noac")) {
f_noac = true;
}
- if ((p = strstr(opt, "actimeo")))
+ if ((p = strstr((char *)opt, "actimeo")))
{
if (sscanf(p, "actimeo=%i", &actimeo) == 1) {
f_actimeo = true;
}
}
- if ((p = strstr(opt, "acregmin"))) {
+ if ((p = strstr((char *)opt, "acregmin"))) {
if (sscanf(p, "acregmin=%i", &acregmin) == 1) {
f_acregmin = true;
}
}
- if ((p = strstr(opt, "acregmax"))) {
+ if ((p = strstr((char *)opt, "acregmax"))) {
if (sscanf(p, "acregmax=%i", &acregmax) == 1) {
f_acregmax = true;
}