Skip to content

Commit

Permalink
Various fixes/cleanups to get this package compiling on Solaris:
Browse files Browse the repository at this point in the history
 + 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.
  • Loading branch information
sketch committed Nov 19, 2004
1 parent d0b99ba commit 97ff422
Show file tree
Hide file tree
Showing 23 changed files with 564 additions and 40 deletions.
30 changes: 29 additions & 1 deletion sysutils/fam/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.19 2004/10/17 20:12:06 jmmv Exp $
# $NetBSD: Makefile,v 1.20 2004/11/19 12:35:22 sketch Exp $
#

DISTNAME= fam-2.7.0
Expand Down Expand Up @@ -54,6 +54,34 @@ MESSAGE_SRC= ${.CURDIR}/MESSAGE ${.CURDIR}/MESSAGE.kqueue
.include "../../mk/pthread.buildlink3.mk"
.endif

LDFLAGS.SunOS+= -lsocket -lnsl

.if ${OPSYS} == "SunOS"
SUBST_CLASSES+= sunfix dirent

SUBST_MESSAGE.sunfix= "Fixing ${OPSYS} namespace collision."
SUBST_STAGE.sunfix= pre-configure
SUBST_FILES.sunfix+= lib/Client.c++
SUBST_FILES.sunfix+= src/ClientConnection.c++ src/ClientConnection.h
SUBST_FILES.sunfix+= src/LocalClient.c++ src/LocalClient.h
SUBST_FILES.sunfix+= src/Listener.c++
SUBST_FILES.sunfix+= src/TCP_Client.h
SUBST_SED.sunfix= -e 's/sun\([^_]\)/sa_un\1/g'

SUBST_MESSAGE.dirent= "Fixing old sys/dir.h usage."
SUBST_STAGE.dirent= pre-configure
SUBST_FILES.dirent+= src/Directory.c++
SUBST_FILES.dirent+= src/DirectoryScanner.c++ src/DirectoryScanner.h
SUBST_SED.dirent= -e 's,sys/dir.h,dirent.h,g' -e 's/struct direct/struct dirent/g'

.include "../../mk/compiler.mk"

.if !empty(PKGSRC_COMPILER:Msunpro)
BUILDLINK_TRANSFORM+= rm:-lstdc++
.endif

.endif

post-extract:
${CP} ${FILESDIR}/IMonKQueue.c++ ${WRKSRC}/src
${CP} ${FILESDIR}/imon-compat.h ${WRKSRC}/src
Expand Down
33 changes: 22 additions & 11 deletions sysutils/fam/distinfo
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
$NetBSD: distinfo,v 1.15 2004/10/17 19:20:53 jmmv Exp $
$NetBSD: distinfo,v 1.16 2004/11/19 12:35:22 sketch Exp $

SHA1 (fam-2.7.0.tar.gz) = 6c2316f02acf89a41c42ffc3d7fd9cf5eada83a8
Size (fam-2.7.0.tar.gz) = 301974 bytes
SHA1 (patch-aa) = 19743b7627e72e96c13a1288d8872e85d42a6dca
SHA1 (patch-ab) = a486fd2b7330a0942717fd2aebb0fbdeb3c87dc7
SHA1 (patch-aa) = 97f73077cf7845cc0ac13247b0d2ee92a1d722d6
SHA1 (patch-ab) = 0ca86059b8e4f9ba59537c6525acf35784e35743
SHA1 (patch-ac) = 676966b0372780af4ee5536276132a04dd038863
SHA1 (patch-ad) = b8e621acd36811a76a84af82e6f2b5962973e344
SHA1 (patch-ae) = 225a0bd5195be3d3d75edf021b27bed19d84dc15
SHA1 (patch-af) = 57946b3837479b641bb002620ae41008f49af995
SHA1 (patch-ag) = 978fa2a582c5f9d2c8660c0a8d933211e97ef500
SHA1 (patch-ah) = d7763198df76d1f0783342a8961b59879e8e1241
SHA1 (patch-ad) = 19364c8dd3f887a59f41556206c8c2d179577932
SHA1 (patch-ae) = aa8fed958555d6870367fd202a6117ddcb5a1da9
SHA1 (patch-af) = 5868f44d29c31533bdb012213022e814d3fc3995
SHA1 (patch-ag) = 3300a1cd565f9edaea3c334a9e278185efbcb7a6
SHA1 (patch-ah) = dc8ec60631b57668fcef0b296efe3e271cb7fcae
SHA1 (patch-ai) = b80aafbb3849fc8c828b6829d8975b910e4d0fd5
SHA1 (patch-aj) = 39391961fd7929d6a5fb49ecb492585cb821afaa
SHA1 (patch-ak) = 48ddfcf9b7562832402a464437ca485249d371a1
SHA1 (patch-ao) = 64827309bf91a2018629e28fef20109dde3fbf01
SHA1 (patch-ap) = 318e99722c78b1120d444d1421f04affc107d028
SHA1 (patch-al) = e0b4c3ca447f42573def07e8b47209ec6e6ad016
SHA1 (patch-am) = 12e4d17ded9ca12df9788d34c0f3e3d1ba301e9a
SHA1 (patch-an) = 7aa54fb1f90e3b2eb767d41fd842f7f4a0561b81
SHA1 (patch-ao) = 161160f121e9338e807bfe0c5df6cf14457fec62
SHA1 (patch-ap) = bbb31577e0cc9ffb8ccbce75082ccddd917d7cea
SHA1 (patch-aq) = a54ba100b779fa13b35c962ba734ee11e093cb28
SHA1 (patch-ar) = dd88a28f4951ff110949d0d79dc6aee18fc9e065
SHA1 (patch-as) = 52c3788e2d08b8fccbef3f57fa888b0c2ea52daf
SHA1 (patch-at) = 209f89cefac326e6c1b99bec4622ba0d6eabe1e4
SHA1 (patch-au) = 6bd507eb448b3fd126042759a3b6f70335401c5b
SHA1 (patch-ax) = 950e9fd9de885f653f96aebaafc2269f489e2fad
SHA1 (patch-av) = e79813d88ec48a886688539da34150c5bd229a0a
SHA1 (patch-aw) = 9e5de9617e6cd59644294695d0ea79427b521ba0
SHA1 (patch-ax) = 59d31ea4735ed964ac508874c422fe5bfc8efd5e
SHA1 (patch-ay) = 081b4bc7cf25a8e30b3680b6df7599570ea0db86
SHA1 (patch-az) = 13901fdef8c13318d585e36820c5e0aa4c28f889
4 changes: 2 additions & 2 deletions sysutils/fam/patches/patch-aa
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$NetBSD: patch-aa,v 1.6 2004/04/18 17:11:08 jmmv Exp $
$NetBSD: patch-aa,v 1.7 2004/11/19 12:35:22 sketch Exp $

--- configure.ac.orig 2003-11-26 20:47:59.000000000 +0100
+++ configure.ac
Expand All @@ -7,7 +7,7 @@ $NetBSD: patch-aa,v 1.6 2004/04/18 17:11:08 jmmv Exp $
AC_HEADER_STDC
AC_HEADER_DIRENT
-AC_CHECK_HEADERS([fcntl.h limits.h linux/imon.h netinet/in.h rpc/rpc.h rpcsvc/mount.h stddef.h stdlib.h string.h syslog.h sys/imon.h sys/param.h sys/select.h sys/statvfs.h sys/syssgi.h sys/time.h sys/types.h sys/un.h unistd.h])
+AC_CHECK_HEADERS([fcntl.h limits.h linux/imon.h netinet/in.h rpc/rpc.h rpcsvc/mount.h stddef.h stdlib.h string.h syslog.h sys/imon.h sys/param.h sys/select.h sys/statvfs.h sys/syssgi.h sys/time.h sys/types.h sys/un.h unistd.h mntent.h sys/sysmacros.h])
+AC_CHECK_HEADERS([fcntl.h limits.h linux/imon.h netinet/in.h rpc/rpc.h rpcsvc/mount.h stddef.h stdlib.h string.h syslog.h sys/imon.h sys/param.h sys/select.h sys/statvfs.h sys/syssgi.h sys/time.h sys/types.h sys/un.h unistd.h mntent.h sys/mnttab.h sys/sysmacros.h])

if test "$have_sys_imon_h"; then
MONITOR_FUNCS=IMonIRIX
Expand Down
21 changes: 17 additions & 4 deletions sysutils/fam/patches/patch-ab
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$NetBSD: patch-ab,v 1.3 2004/03/28 22:00:05 minskim Exp $
$NetBSD: patch-ab,v 1.4 2004/11/19 12:35:22 sketch Exp $

--- config.h.in.orig 2003-01-19 18:40:15.000000000 -0600
+++ config.h.in
--- config.h.in.orig 2003-01-20 00:40:15.000000000 +0000
+++ config.h.in 2004-11-08 14:04:04.600109000 +0000
@@ -52,6 +52,9 @@
/* Define to 1 if you have the `select' function. */
#undef HAVE_SELECT
Expand All @@ -22,16 +22,29 @@ $NetBSD: patch-ab,v 1.3 2004/03/28 22:00:05 minskim Exp $
/* Define to 1 if you have the <syslog.h> header file. */
#undef HAVE_SYSLOG_H

@@ -120,6 +126,12 @@
@@ -120,6 +126,15 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H

+/* Define to 1 if you have the <mntent.h> header file. */
+#undef HAVE_MNTENT_H
+
+/* Define to 1 if you have the <sys/mnttab.h> header file. */
+#undef HAVE_SYS_MNTTAB_H
+
+/* Define to 1 if you have the <sys/sysmacros.h> header file. */
+#undef HAVE_SYS_SYSMACROS_H
+
/* Define to 1 if the system has the type `_Bool'. */
#undef HAVE__BOOL

@@ -180,3 +192,9 @@

/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
+
+/* Use standard POSIX type if BSD type is not available */
+#ifndef u_int32_t
+#include <inttypes.h>
+typedef uint32_t u_int32_t;
+#endif
80 changes: 77 additions & 3 deletions sysutils/fam/patches/patch-ad
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$NetBSD: patch-ad,v 1.4 2004/03/28 22:01:54 minskim Exp $
$NetBSD: patch-ad,v 1.5 2004/11/19 12:35:22 sketch Exp $

--- src/NFSFileSystem.c++.orig 2003-01-18 08:18:12.000000000 -0600
+++ src/NFSFileSystem.c++
--- 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"

Expand All @@ -11,3 +11,77 @@ $NetBSD: patch-ad,v 1.4 2004/03/28 22:01:54 minskim Exp $
#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;
}
37 changes: 33 additions & 4 deletions sysutils/fam/patches/patch-ae
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
$NetBSD: patch-ae,v 1.3 2004/03/28 22:00:05 minskim Exp $
$NetBSD: patch-ae,v 1.4 2004/11/19 12:35:22 sketch Exp $

--- src/FileSystem.c++.orig 2003-01-18 08:18:12.000000000 -0600
+++ src/FileSystem.c++
@@ -22,7 +22,7 @@
--- src/FileSystem.c++.orig 2003-01-18 14:18:12.000000000 +0000
+++ src/FileSystem.c++ 2004-11-08 15:39:34.558377000 +0000
@@ -22,14 +22,20 @@

#include "FileSystem.h"

Expand All @@ -11,3 +11,32 @@ $NetBSD: patch-ae,v 1.3 2004/03/28 22:00:05 minskim Exp $
#include <string.h>

#include "Event.h"

+#if defined(HAVE_SYS_MNTTAB_H)
+FileSystem::FileSystem(const mnttab& mnt)
+ : mydir (strcpy(new char[strlen(mnt.mnt_mountp) + 1], mnt.mnt_mountp)),
+ myfsname(strcpy(new char[strlen(mnt.mnt_special) + 1], mnt.mnt_special))
+#else
FileSystem::FileSystem(const mntent& mnt)
: mydir (strcpy(new char[strlen(mnt.mnt_dir ) + 1], mnt.mnt_dir )),
myfsname(strcpy(new char[strlen(mnt.mnt_fsname) + 1], mnt.mnt_fsname))
+#endif
{ }

FileSystem::~FileSystem()
@@ -40,9 +46,15 @@
}

bool
+#if defined(HAVE_SYS_MNTTAB_H)
+FileSystem::matches(const mnttab& mnt) const
+{
+ return !strcmp(mydir, mnt.mnt_mountp) && !strcmp(myfsname, mnt.mnt_special);
+#else
FileSystem::matches(const mntent& mnt) const
{
return !strcmp(mydir, mnt.mnt_dir) && !strcmp(myfsname, mnt.mnt_fsname);
+#endif
}

void
Loading

0 comments on commit 97ff422

Please sign in to comment.