|
Removed
Link Here
|
| 1 |
diff -urN fam-oss-2.6.4/config.h.in fam-oss-2.6.4-freebsd/config.h.in |
| 2 |
--- fam-oss-2.6.4/config.h.in Sat May 20 05:50:17 2000 |
| 3 |
+++ fam-oss-2.6.4-freebsd/config.h.in Sun Mar 18 00:02:38 2001 |
| 4 |
@@ -12,6 +12,8 @@ |
| 5 |
/* Define if the system has imon and IMONIOC_ ioctl flags. */ |
| 6 |
#undef HAVE_IMON |
| 7 |
|
| 8 |
+#undef HAVE_MNTENT_H |
| 9 |
+ |
| 10 |
/* Define if the system has the struct revokdi and the IMONIOC_REVOKDI |
| 11 |
** ioctl flag. (IRIX 5.3 doesn't.) |
| 12 |
*/ |
| 13 |
diff -urN fam-oss-2.6.4/configure.in fam-oss-2.6.4-freebsd/configure.in |
| 14 |
--- fam-oss-2.6.4/configure.in Sat May 20 06:23:17 2000 |
| 15 |
+++ fam-oss-2.6.4-freebsd/configure.in Sun Mar 18 00:36:29 2001 |
| 16 |
@@ -95,6 +95,8 @@ |
| 17 |
dnl AC_HEADER_SYS_WAIT |
| 18 |
dnl AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h syslog.h unistd.h) |
| 19 |
|
| 20 |
+AC_CHECK_HEADER(mntent.h, AC_DEFINE(HAVE_MNTENT_H)) |
| 21 |
+ |
| 22 |
dnl |
| 23 |
dnl See if imon is available; if so, is it IRIX or Linux? |
| 24 |
dnl |
| 25 |
@@ -299,10 +301,10 @@ |
| 26 |
dnl If we don't have MNTTYPE_NFS , we croak. |
| 27 |
dnl |
| 28 |
|
| 29 |
-FAM_DECL_IN_MNTENT(MNTTYPE_NFS, ,AC_MSG_ERROR(Didn't find MNTTYPE_NFS in mntent.h)) |
| 30 |
-FAM_DECL_IN_MNTENT(MNTTYPE_NFS2, AC_DEFINE(HAVE_MNTTYPE_NFS2)) |
| 31 |
-FAM_DECL_IN_MNTENT(MNTTYPE_NFS3, AC_DEFINE(HAVE_MNTTYPE_NFS3)) |
| 32 |
-FAM_DECL_IN_MNTENT(MNTTYPE_CACHEFS, AC_DEFINE(HAVE_MNTTYPE_CACHEFS)) |
| 33 |
+dnl FAM_DECL_IN_MNTENT(MNTTYPE_NFS, ,AC_MSG_ERROR(Didn't find MNTTYPE_NFS in mntent.h)) |
| 34 |
+dnl FAM_DECL_IN_MNTENT(MNTTYPE_NFS2, AC_DEFINE(HAVE_MNTTYPE_NFS2)) |
| 35 |
+dnl FAM_DECL_IN_MNTENT(MNTTYPE_NFS3, AC_DEFINE(HAVE_MNTTYPE_NFS3)) |
| 36 |
+dnl FAM_DECL_IN_MNTENT(MNTTYPE_CACHEFS, AC_DEFINE(HAVE_MNTTYPE_CACHEFS)) |
| 37 |
|
| 38 |
dnl |
| 39 |
dnl Test for bindresvport() prototype. |
| 40 |
diff -urN fam-oss-2.6.4/fam/Client.h fam-oss-2.6.4-freebsd/fam/Client.h |
| 41 |
--- fam-oss-2.6.4/fam/Client.h Sat May 20 05:46:31 2000 |
| 42 |
+++ fam-oss-2.6.4-freebsd/fam/Client.h Sat Mar 17 00:14:35 2001 |
| 43 |
@@ -23,6 +23,7 @@ |
| 44 |
#ifndef Client_included |
| 45 |
#define Client_included |
| 46 |
|
| 47 |
+#include <sys/types.h> |
| 48 |
#include <netinet/in.h> // for in_addr |
| 49 |
|
| 50 |
#include "Activity.h" |
| 51 |
diff -urN fam-oss-2.6.4/fam/FileSystem.c++ fam-oss-2.6.4-freebsd/fam/FileSystem.c++ |
| 52 |
--- fam-oss-2.6.4/fam/FileSystem.c++ Sat May 20 05:46:31 2000 |
| 53 |
+++ fam-oss-2.6.4-freebsd/fam/FileSystem.c++ Sat Mar 17 13:18:10 2001 |
| 54 |
@@ -22,7 +22,7 @@ |
| 55 |
|
| 56 |
#include "FileSystem.h" |
| 57 |
|
| 58 |
-#include <mntent.h> |
| 59 |
+#include "mntent.h" |
| 60 |
#include <string.h> |
| 61 |
|
| 62 |
#include "Event.h" |
| 63 |
diff -urN fam-oss-2.6.4/fam/FileSystemTable.c++ fam-oss-2.6.4-freebsd/fam/FileSystemTable.c++ |
| 64 |
--- fam-oss-2.6.4/fam/FileSystemTable.c++ Sat May 20 05:46:31 2000 |
| 65 |
+++ fam-oss-2.6.4-freebsd/fam/FileSystemTable.c++ Sat Mar 17 23:44:17 2001 |
| 66 |
@@ -21,9 +21,10 @@ |
| 67 |
// Temple Place - Suite 330, Boston MA 02111-1307, USA. |
| 68 |
|
| 69 |
#include <stddef.h> |
| 70 |
+#include <stdio.h> |
| 71 |
#include "FileSystemTable.h" |
| 72 |
|
| 73 |
-#include <mntent.h> |
| 74 |
+#include "mntent.h" |
| 75 |
#include <stdlib.h> |
| 76 |
#include <string.h> |
| 77 |
|
| 78 |
@@ -255,7 +256,10 @@ |
| 79 |
// create_fs_by_name initializes our "root" member variable. |
| 80 |
if (!fs_by_name) |
| 81 |
{ create_fs_by_name(); |
| 82 |
+#if !defined(__FreeBSD__) |
| 83 |
+ /* there is no mtab "file" in freebsd! */ |
| 84 |
mtab_watcher = new InternalClient(mtab_name, mtab_event_handler, NULL); |
| 85 |
+#endif |
| 86 |
} |
| 87 |
|
| 88 |
cr.become_user(); |
| 89 |
diff -urN fam-oss-2.6.4/fam/IMon.c++ fam-oss-2.6.4-freebsd/fam/IMon.c++ |
| 90 |
--- fam-oss-2.6.4/fam/IMon.c++ Sat May 20 05:46:31 2000 |
| 91 |
+++ fam-oss-2.6.4-freebsd/fam/IMon.c++ Sat Mar 17 14:06:17 2001 |
| 92 |
@@ -34,7 +34,9 @@ |
| 93 |
#endif |
| 94 |
#endif |
| 95 |
|
| 96 |
-#include <sys/sysmacros.h> |
| 97 |
+#if !defined(__FreeBSD__) |
| 98 |
+# include <sys/sysmacros.h> |
| 99 |
+#endif |
| 100 |
#include <unistd.h> |
| 101 |
|
| 102 |
#include "Interest.h" |
| 103 |
diff -urN fam-oss-2.6.4/fam/Interest.c++ fam-oss-2.6.4-freebsd/fam/Interest.c++ |
| 104 |
--- fam-oss-2.6.4/fam/Interest.c++ Sat May 20 05:46:31 2000 |
| 105 |
+++ fam-oss-2.6.4-freebsd/fam/Interest.c++ Sat Mar 17 14:06:37 2001 |
| 106 |
@@ -25,7 +25,9 @@ |
| 107 |
#include <string.h> |
| 108 |
#include <errno.h> |
| 109 |
#include <sys/param.h> |
| 110 |
-#include <sys/sysmacros.h> |
| 111 |
+#if !defined(__FreeBSD__) |
| 112 |
+# include <sys/sysmacros.h> |
| 113 |
+#endif |
| 114 |
|
| 115 |
#ifdef HAVE_IRIX_XTAB_VERIFICATION |
| 116 |
#include <stdio.h> |
| 117 |
diff -urN fam-oss-2.6.4/fam/InternalClient.c++ fam-oss-2.6.4-freebsd/fam/InternalClient.c++ |
| 118 |
--- fam-oss-2.6.4/fam/InternalClient.c++ Sat May 20 05:46:31 2000 |
| 119 |
+++ fam-oss-2.6.4-freebsd/fam/InternalClient.c++ Sat Mar 17 23:20:15 2001 |
| 120 |
@@ -35,8 +35,8 @@ |
| 121 |
{ |
| 122 |
assert(filename); |
| 123 |
assert(h); |
| 124 |
- assert(filename[0] == '/'); |
| 125 |
Log::debug("%s watching %s", name(), filename); |
| 126 |
+ assert(filename[0] == '/'); |
| 127 |
interest = new File(filename, this, Request(0), Cred::SuperUser); |
| 128 |
} |
| 129 |
|
| 130 |
diff -urN fam-oss-2.6.4/fam/Listener.c++ fam-oss-2.6.4-freebsd/fam/Listener.c++ |
| 131 |
--- fam-oss-2.6.4/fam/Listener.c++ Sat May 20 05:46:31 2000 |
| 132 |
+++ fam-oss-2.6.4-freebsd/fam/Listener.c++ Sat Mar 17 14:12:57 2001 |
| 133 |
@@ -22,6 +22,8 @@ |
| 134 |
|
| 135 |
#include "Listener.h" |
| 136 |
|
| 137 |
+#include <stdio.h> |
| 138 |
+#include <stdlib.h> |
| 139 |
#include <assert.h> |
| 140 |
#include <fcntl.h> |
| 141 |
#include <sys/types.h> |
| 142 |
@@ -202,7 +204,11 @@ |
| 143 |
// requested user and pass the name back to the client. |
| 144 |
|
| 145 |
char *tmpfile = tempnam("/tmp", ".fam"); |
| 146 |
+#if defined(__FreeBSD__) |
| 147 |
+ sockaddr_un sun = { sizeof(sockaddr_un), AF_UNIX, "" }; |
| 148 |
+#else |
| 149 |
sockaddr_un sun = { AF_UNIX, "" }; |
| 150 |
+#endif |
| 151 |
if(strlen(tmpfile) >= (sizeof(sun.sun_path) - 1)) |
| 152 |
{ |
| 153 |
Log::error("tmpnam() too long for sun_path (%d >= %d)!", |
| 154 |
@@ -235,7 +241,7 @@ |
| 155 |
return; |
| 156 |
} |
| 157 |
|
| 158 |
- if (chown(sun.sun_path, uid, -1) != 0) |
| 159 |
+ if (chown(sun.sun_path, uid, (gid_t)-1) != 0) |
| 160 |
{ Log::perror("localclient chown"); |
| 161 |
close(client_sock); |
| 162 |
return; |
| 163 |
@@ -271,7 +277,11 @@ |
| 164 |
|
| 165 |
// Get the new socket. |
| 166 |
|
| 167 |
+#if defined(__FreeBSD__) |
| 168 |
+ struct sockaddr_un sun = { sizeof(sockaddr_un), AF_UNIX, "" }; |
| 169 |
+#else |
| 170 |
struct sockaddr_un sun = { AF_UNIX, "" }; |
| 171 |
+#endif |
| 172 |
CONFIG_SOCKLEN_T sunlen = sizeof(sun); |
| 173 |
int client_fd = accept(ofd, (struct sockaddr *) &sun, &sunlen); |
| 174 |
if (client_fd < 0) |
| 175 |
@@ -333,7 +343,11 @@ |
| 176 |
void |
| 177 |
Listener::dirty_ugly_hack() |
| 178 |
{ |
| 179 |
+#if defined(__FreeBSD__) |
| 180 |
+ static sockaddr_un sun = { sizeof (sockaddr_un), AF_UNIX, "/tmp/.fam_socket" }; |
| 181 |
+#else |
| 182 |
static sockaddr_un sun = { AF_UNIX, "/tmp/.fam_socket" }; |
| 183 |
+#endif |
| 184 |
|
| 185 |
int sock = socket(PF_UNIX, SOCK_STREAM, 0); |
| 186 |
if (sock < 0) |
| 187 |
diff -urN fam-oss-2.6.4/fam/Log.c++ fam-oss-2.6.4-freebsd/fam/Log.c++ |
| 188 |
--- fam-oss-2.6.4/fam/Log.c++ Sat May 20 05:46:31 2000 |
| 189 |
+++ fam-oss-2.6.4-freebsd/fam/Log.c++ Sat Mar 17 14:14:31 2001 |
| 190 |
@@ -28,6 +28,8 @@ |
| 191 |
#include <stdlib.h> |
| 192 |
#include <string.h> |
| 193 |
#include <syslog.h> |
| 194 |
+#include <sys/time.h> |
| 195 |
+#include <sys/types.h> |
| 196 |
#include <sys/resource.h> |
| 197 |
#include <sys/stat.h> |
| 198 |
#include <unistd.h> |
| 199 |
diff -urN fam-oss-2.6.4/fam/Makefile.am fam-oss-2.6.4-freebsd/fam/Makefile.am |
| 200 |
--- fam-oss-2.6.4/fam/Makefile.am Sat May 20 05:46:31 2000 |
| 201 |
+++ fam-oss-2.6.4-freebsd/fam/Makefile.am Sat Mar 17 18:12:17 2001 |
| 202 |
@@ -72,6 +72,7 @@ |
| 203 |
main.c++ \ |
| 204 |
timeval.c++ \ |
| 205 |
timeval.h \ |
| 206 |
+ mntent_compat.c++ \ |
| 207 |
@IMON_FUNCS@.c++ |
| 208 |
|
| 209 |
EXTRA_fam_SOURCES = IMonIrix.c++ IMonLinux.c++ IMonNone.c++ |
| 210 |
diff -urN fam-oss-2.6.4/fam/Scheduler.h fam-oss-2.6.4-freebsd/fam/Scheduler.h |
| 211 |
--- fam-oss-2.6.4/fam/Scheduler.h Sat May 20 05:46:32 2000 |
| 212 |
+++ fam-oss-2.6.4-freebsd/fam/Scheduler.h Sat Mar 17 00:14:04 2001 |
| 213 |
@@ -24,6 +24,7 @@ |
| 214 |
#define Scheduler_included |
| 215 |
|
| 216 |
#include <sys/time.h> |
| 217 |
+#include <string.h> |
| 218 |
|
| 219 |
#include "Boolean.h" |
| 220 |
|
| 221 |
diff -urN fam-oss-2.6.4/fam/StringTable.h fam-oss-2.6.4-freebsd/fam/StringTable.h |
| 222 |
--- fam-oss-2.6.4/fam/StringTable.h Sat May 20 05:46:32 2000 |
| 223 |
+++ fam-oss-2.6.4-freebsd/fam/StringTable.h Sat Mar 17 18:05:38 2001 |
| 224 |
@@ -25,6 +25,7 @@ |
| 225 |
|
| 226 |
#include <assert.h> |
| 227 |
#include <string.h> |
| 228 |
+#include "mntent.h" |
| 229 |
|
| 230 |
// A StringTable maps C strings onto values. It is a cheap O(n) |
| 231 |
// implementation, suitable only for small tables that are |
| 232 |
diff -urN fam-oss-2.6.4/fam/mntent.h fam-oss-2.6.4-freebsd/fam/mntent.h |
| 233 |
--- fam-oss-2.6.4/fam/mntent.h Thu Jan 1 01:00:00 1970 |
| 234 |
+++ fam-oss-2.6.4-freebsd/fam/mntent.h Sat Mar 17 18:11:08 2001 |
| 235 |
@@ -0,0 +1,56 @@ |
| 236 |
+/* |
| 237 |
+ * mntent |
| 238 |
+ * mntent.h - compatability header for FreeBSD |
| 239 |
+ * |
| 240 |
+ * Copyright (c) 2001 David Rufino <daverufino@btinternet.com> |
| 241 |
+ * All rights reserved. |
| 242 |
+ * |
| 243 |
+ * Redistribution and use in source and binary forms, with or without |
| 244 |
+ * modification, are permitted provided that the following conditions |
| 245 |
+ * are met: |
| 246 |
+ * 1. Redistributions of source code must retain the above copyright |
| 247 |
+ * notice, this list of conditions and the following disclaimer. |
| 248 |
+ * 2. Redistributions in binary form must reproduce the above copyright |
| 249 |
+ * notice, this list of conditions and the following disclaimer in the |
| 250 |
+ * documentation and/or other materials provided with the distribution. |
| 251 |
+ * |
| 252 |
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
| 253 |
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 254 |
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 255 |
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| 256 |
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 257 |
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 258 |
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 259 |
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 260 |
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 261 |
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 262 |
+ * SUCH DAMAGE. |
| 263 |
+ */ |
| 264 |
+ |
| 265 |
+#if defined(HAVE_MNTENT_H) |
| 266 |
+#include <mntent.h> |
| 267 |
+#else |
| 268 |
+#ifndef _MNTENT_H |
| 269 |
+#define _MNTENT_H |
| 270 |
+#include <stdio.h> |
| 271 |
+ |
| 272 |
+#define MOUNTED "dummy" |
| 273 |
+ |
| 274 |
+#define MNTTYPE_NFS "nfs" |
| 275 |
+ |
| 276 |
+struct mntent { |
| 277 |
+ char *mnt_fsname; |
| 278 |
+ char *mnt_dir; |
| 279 |
+ char *mnt_type; |
| 280 |
+ char *mnt_opts; |
| 281 |
+ int mnt_freq; |
| 282 |
+ int mnt_passno; |
| 283 |
+}; |
| 284 |
+ |
| 285 |
+#define setmntent(x,y) ((FILE *)0x1) |
| 286 |
+struct mntent *getmntent __P ((FILE *fp)); |
| 287 |
+char *hasmntopt __P ((const struct mntent *mnt, const char *option)); |
| 288 |
+#define endmntent(x) ((int)1) |
| 289 |
+ |
| 290 |
+#endif /* _MNTENT_H */ |
| 291 |
+#endif /* HAVE_MNTENT_H */ |
| 292 |
diff -urN fam-oss-2.6.4/fam/mntent_compat.c++ fam-oss-2.6.4-freebsd/fam/mntent_compat.c++ |
| 293 |
--- fam-oss-2.6.4/fam/mntent_compat.c++ Thu Jan 1 01:00:00 1970 |
| 294 |
+++ fam-oss-2.6.4-freebsd/fam/mntent_compat.c++ Sat Mar 17 23:48:07 2001 |
| 295 |
@@ -0,0 +1,151 @@ |
| 296 |
+/* |
| 297 |
+ * Copyright (c) 1980, 1989, 1993, 1994 |
| 298 |
+ * The Regents of the University of California. All rights reserved. |
| 299 |
+ * Copyright (c) 2001 |
| 300 |
+ * David Rufino <daverufino@btinternet.com> |
| 301 |
+ * |
| 302 |
+ * Redistribution and use in source and binary forms, with or without |
| 303 |
+ * modification, are permitted provided that the following conditions |
| 304 |
+ * are met: |
| 305 |
+ * 1. Redistributions of source code must retain the above copyright |
| 306 |
+ * notice, this list of conditions and the following disclaimer. |
| 307 |
+ * 2. Redistributions in binary form must reproduce the above copyright |
| 308 |
+ * notice, this list of conditions and the following disclaimer in the |
| 309 |
+ * documentation and/or other materials provided with the distribution. |
| 310 |
+ * 3. All advertising materials mentioning features or use of this software |
| 311 |
+ * must display the following acknowledgement: |
| 312 |
+ * This product includes software developed by the University of |
| 313 |
+ * California, Berkeley and its contributors. |
| 314 |
+ * 4. Neither the name of the University nor the names of its contributors |
| 315 |
+ * may be used to endorse or promote products derived from this software |
| 316 |
+ * without specific prior written permission. |
| 317 |
+ * |
| 318 |
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
| 319 |
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 320 |
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 321 |
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| 322 |
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 323 |
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 324 |
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 325 |
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 326 |
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 327 |
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 328 |
+ * SUCH DAMAGE. |
| 329 |
+ */ |
| 330 |
+ |
| 331 |
+/* most of this was ripped from the mount(3) source */ |
| 332 |
+ |
| 333 |
+#include "config.h" |
| 334 |
+#include "mntent.h" |
| 335 |
+#if !defined(HAVE_MNTENT_H) |
| 336 |
+#include <stdlib.h> |
| 337 |
+#include <string.h> |
| 338 |
+#include <sys/param.h> |
| 339 |
+#include <sys/ucred.h> |
| 340 |
+#include <sys/mount.h> |
| 341 |
+ |
| 342 |
+static int pos = -1; |
| 343 |
+static int mntsize = -1; |
| 344 |
+static struct mntent _mntent; |
| 345 |
+ |
| 346 |
+char * |
| 347 |
+hasmntopt (const struct mntent *mnt, const char *option) |
| 348 |
+{ |
| 349 |
+ int found; |
| 350 |
+ char *opt, *optbuf; |
| 351 |
+ |
| 352 |
+ optbuf = strdup(mnt->mnt_opts); |
| 353 |
+ found = 0; |
| 354 |
+ for (opt = optbuf; (opt = strtok(opt, " ")) != NULL; opt = NULL) { |
| 355 |
+ if (!strcasecmp(opt, option)) { |
| 356 |
+ opt = opt - optbuf + mnt->mnt_opts; |
| 357 |
+ free (optbuf); |
| 358 |
+ return (opt); |
| 359 |
+ } |
| 360 |
+ } |
| 361 |
+ free (optbuf); |
| 362 |
+ return (NULL); |
| 363 |
+} |
| 364 |
+ |
| 365 |
+static char * |
| 366 |
+catopt (char *s0, const char *s1) |
| 367 |
+{ |
| 368 |
+ size_t i; |
| 369 |
+ char *cp; |
| 370 |
+ |
| 371 |
+ if (s1 == NULL || *s1 == '\0') |
| 372 |
+ return s0; |
| 373 |
+ if (s0 && *s0) { |
| 374 |
+ i = strlen(s0) + strlen(s1) + 1 + 1; |
| 375 |
+ if ((cp = (char *)malloc(i)) == NULL) |
| 376 |
+ return (NULL); |
| 377 |
+ (void)snprintf(cp, i, "%s %s", s0, s1); |
| 378 |
+ } else |
| 379 |
+ cp = strdup(s1); |
| 380 |
+ |
| 381 |
+ if (s0) |
| 382 |
+ free(s0); |
| 383 |
+ return (cp); |
| 384 |
+} |
| 385 |
+ |
| 386 |
+ |
| 387 |
+static char * |
| 388 |
+flags2opts (int flags) |
| 389 |
+{ |
| 390 |
+ char *res; |
| 391 |
+ res = NULL; |
| 392 |
+ res = catopt(res, (flags & MNT_RDONLY) ? "ro" : "rw"); |
| 393 |
+ if (flags & MNT_SYNCHRONOUS) res = catopt(res, "sync"); |
| 394 |
+ if (flags & MNT_NOEXEC) res = catopt(res, "noexec"); |
| 395 |
+ if (flags & MNT_NOSUID) res = catopt(res, "nosuid"); |
| 396 |
+ if (flags & MNT_NODEV) res = catopt(res, "nodev"); |
| 397 |
+ if (flags & MNT_UNION) res = catopt(res, "union"); |
| 398 |
+ if (flags & MNT_ASYNC) res = catopt(res, "async"); |
| 399 |
+ if (flags & MNT_NOATIME) res = catopt(res, "noatime"); |
| 400 |
+ if (flags & MNT_NOCLUSTERR) res = catopt(res, "noclusterr"); |
| 401 |
+ if (flags & MNT_NOCLUSTERW) res = catopt(res, "noclusterw"); |
| 402 |
+ if (flags & MNT_NOSYMFOLLOW) res = catopt(res, "nosymfollow"); |
| 403 |
+ if (flags & MNT_SUIDDIR) res = catopt(res, "suiddir"); |
| 404 |
+ |
| 405 |
+ return res; |
| 406 |
+} |
| 407 |
+ |
| 408 |
+static struct mntent * |
| 409 |
+statfs_to_mntent (struct statfs *mntbuf) |
| 410 |
+{ |
| 411 |
+ static char opts_buf[40], *tmp; |
| 412 |
+ |
| 413 |
+ _mntent.mnt_fsname = mntbuf->f_mntfromname; |
| 414 |
+ _mntent.mnt_dir = mntbuf->f_mntonname; |
| 415 |
+ _mntent.mnt_type = mntbuf->f_fstypename; |
| 416 |
+ tmp = flags2opts (mntbuf->f_flags); |
| 417 |
+ if (tmp) { |
| 418 |
+ opts_buf[sizeof(opts_buf)-1] = '\0'; |
| 419 |
+ strncpy (opts_buf, tmp, sizeof(opts_buf)-1); |
| 420 |
+ free (tmp); |
| 421 |
+ } else { |
| 422 |
+ *opts_buf = '\0'; |
| 423 |
+ } |
| 424 |
+ _mntent.mnt_opts = opts_buf; |
| 425 |
+ _mntent.mnt_freq = _mntent.mnt_passno = 0; |
| 426 |
+ return (&_mntent); |
| 427 |
+} |
| 428 |
+ |
| 429 |
+struct mntent * |
| 430 |
+getmntent (FILE *fp) |
| 431 |
+{ |
| 432 |
+ struct statfs *mntbuf; |
| 433 |
+ |
| 434 |
+ if (pos == -1 || mntsize == -1) |
| 435 |
+ mntsize = getmntinfo (&mntbuf, MNT_NOWAIT); |
| 436 |
+ |
| 437 |
+ ++pos; |
| 438 |
+ if (pos == mntsize) { |
| 439 |
+ pos = mntsize = -1; |
| 440 |
+ return (NULL); |
| 441 |
+ } |
| 442 |
+ |
| 443 |
+ return (statfs_to_mntent (&mntbuf[pos])); |
| 444 |
+} |
| 445 |
+ |
| 446 |
+#endif /* HAVE_MNTENT_H */ |
| 447 |
diff -urN fam-oss-2.6.4/libfam/Client.c++ fam-oss-2.6.4-freebsd/libfam/Client.c++ |
| 448 |
--- fam-oss-2.6.4/libfam/Client.c++ Sat May 20 05:46:32 2000 |
| 449 |
+++ fam-oss-2.6.4-freebsd/libfam/Client.c++ Sat Mar 17 00:12:01 2001 |
| 450 |
@@ -20,6 +20,7 @@ |
| 451 |
// with this program; if not, write the Free Software Foundation, Inc., 59 |
| 452 |
// Temple Place - Suite 330, Boston MA 02111-1307, USA. |
| 453 |
|
| 454 |
+#include <stdio.h> |
| 455 |
#include <stdlib.h> |
| 456 |
#include <unistd.h> |
| 457 |
#include <netinet/in.h> |
| 458 |
diff -urN fam-oss-2.6.4/libfam/fam.c++ fam-oss-2.6.4-freebsd/libfam/fam.c++ |
| 459 |
--- fam-oss-2.6.4/libfam/fam.c++ Sat May 20 05:46:32 2000 |
| 460 |
+++ fam-oss-2.6.4-freebsd/libfam/fam.c++ Sat Mar 17 00:12:43 2001 |
| 461 |
@@ -21,6 +21,7 @@ |
| 462 |
// Temple Place - Suite 330, Boston MA 02111-1307, USA. |
| 463 |
|
| 464 |
#include <sys/types.h> |
| 465 |
+#include <rpc/rpc.h> |
| 466 |
#include <sys/time.h> |
| 467 |
#include <unistd.h> |
| 468 |
#include <stdlib.h> |
| 469 |
diff -urN fam-oss-2.6.4/test/test.c++ fam-oss-2.6.4-freebsd/test/test.c++ |
| 470 |
--- fam-oss-2.6.4/test/test.c++ Sat May 20 05:46:32 2000 |
| 471 |
+++ fam-oss-2.6.4-freebsd/test/test.c++ Sat Mar 17 18:39:23 2001 |
| 472 |
@@ -1,6 +1,7 @@ |
| 473 |
#include <sys/types.h> |
| 474 |
#include <sys/time.h> |
| 475 |
#include <stdio.h> |
| 476 |
+#include <string.h> |
| 477 |
#include <unistd.h> |
| 478 |
#include <signal.h> |
| 479 |
#include <errno.h> |
| 480 |
--- fam-oss-2.6.4/acconfig.h Sat May 20 05:46:31 2000 |
| 481 |
+++ fam-oss-2.6.4-freebsd/acconfig.h Sun Mar 18 00:40:47 2001 |
| 482 |
@@ -44,6 +44,8 @@ |
| 483 |
** Otherwise, we'll use MNTTYPE_NFS. */ |
| 484 |
#undef HAVE_FSID_NFS2 |
| 485 |
|
| 486 |
+#undef HAVE_MNTENT_H |
| 487 |
+ |
| 488 |
/* Define if we have MNTTYPE_NFS2 */ |
| 489 |
#define HAVE_MNTTYPE_NFS2 0 |
| 490 |
|