resolve conflicts.

This commit is contained in:
christos 2003-03-09 01:38:38 +00:00
parent 37deef3cda
commit 1a6788bb65
40 changed files with 669 additions and 648 deletions

View File

@ -1,7 +1,7 @@
.\" $NetBSD: amd.8,v 1.3 2002/11/29 23:06:22 christos Exp $
.\" $NetBSD: amd.8,v 1.4 2003/03/09 01:38:39 christos Exp $
.\"
.\"
.\" Copyright (c) 1997-2002 Erez Zadok
.\" Copyright (c) 1997-2003 Erez Zadok
.\" Copyright (c) 1989 Jan-Simon Pendry
.\" Copyright (c) 1989 Imperial College of Science, Technology & Medicine
.\" Copyright (c) 1989 The Regents of the University of California.
@ -40,7 +40,7 @@
.\"
.\" %W% (Berkeley) %G%
.\"
.\" Id: amd.8,v 1.7 2002/06/22 20:52:44 ezk Exp
.\" Id: amd.8,v 1.8 2002/12/27 22:43:46 ezk Exp
.\"
.TH AMD 8 "3 November 1989"
.SH NAME

View File

@ -1,7 +1,7 @@
/* $NetBSD: amd.c,v 1.4 2002/11/29 23:06:22 christos Exp $ */
/* $NetBSD: amd.c,v 1.5 2003/03/09 01:38:39 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: amd.c,v 1.19 2002/06/23 01:05:38 ib42 Exp
* Id: amd.c,v 1.23 2002/12/27 22:43:46 ezk Exp
*
*/
@ -299,6 +299,9 @@ init_global_options(void)
/* LDAP cache */
gopt.ldap_cache_seconds = 0;
gopt.ldap_cache_maxmem = 131072;
/* LDAP protocol version */
gopt.ldap_proto_version = 2;
#endif /* HAVE_MAP_LDAP */
#ifdef HAVE_MAP_NIS
@ -369,11 +372,6 @@ main(int argc, char *argv[])
going_down(1);
}
#ifdef DEBUG
/* initialize debugging flags (Register AMQ, Enter daemon mode) */
debug_flags = D_AMQ | D_DAEMON;
#endif /* DEBUG */
/*
* Initialize global options structure.
*/
@ -554,9 +552,7 @@ main(int argc, char *argv[])
}
#endif /* HAVE_MAP_NIS */
#ifdef DEBUG
amuDebug(D_DAEMON)
#endif /* DEBUG */
if (!amuDebug(D_DAEMON))
ppid = daemon_mode();
sprintf(pid_fsname, "%s:(pid%ld)", am_get_hostname(), (long) am_mypid);

View File

@ -1,7 +1,7 @@
/* $NetBSD: amfs_auto.c,v 1.2 2002/11/29 23:08:32 christos Exp $ */
/* $NetBSD: amfs_auto.c,v 1.3 2003/03/09 01:38:39 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: amfs_auto.c,v 1.48 2002/06/23 15:12:09 ib42 Exp
* Id: amfs_auto.c,v 1.58 2003/01/25 01:46:23 ib42 Exp
*
*/
@ -68,7 +68,7 @@
/****************************************************************************
*** FORWARD DEFINITIONS ***
****************************************************************************/
static int amfs_auto_bgmount(struct continuation *cp, int mpe);
static int amfs_auto_bgmount(struct continuation *cp);
static int amfs_auto_mount(am_node *mp, mntfs *mf);
static int amfs_auto_readdir_browsable(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, int count, int fully_browsable);
static mntfs **amfs_auto_lookup_mntfs(am_node *new_mp, int *error_return);
@ -190,7 +190,7 @@ amfs_auto_mount(am_node *mp, mntfs *mf)
if (mf->mf_fo->opt_pref) {
/* allow pref:=null to set a real null prefix */
if (STREQ(mf->mf_fo->opt_pref, "null")) {
mp->am_pref = "";
mp->am_pref = strdup("");
} else {
/*
* the prefix specified as an option
@ -253,20 +253,8 @@ amfs_auto_umount(am_node *mp, mntfs *mf)
int error = 0;
#ifdef HAVE_FS_AUTOFS
if (mf->mf_flags & MFF_AUTOFS) {
if (mf->mf_flags & MFF_AUTOFS)
error = UMOUNT_FS(mp->am_path, mf->mf_real_mount, mnttab_file_name);
/*
* autofs mounts are in place, so it is possible
* that we can't just unmount our mount points and go away.
* If that's the case, just give up.
*/
if (error == EBUSY)
goto out;
autofs_release_fh(mf->mf_autofs_fh);
mf->mf_autofs_fh = 0;
}
out:
#endif /* HAVE_FS_AUTOFS */
return error;
@ -281,6 +269,7 @@ free_continuation(struct continuation *cp)
{
mntfs **mf;
dlog("free_continuation");
if (cp->callout)
untimeout(cp->callout);
/*
@ -289,7 +278,8 @@ free_continuation(struct continuation *cp)
* or free all but the used one, if the mount succeeded.
*/
for (mf = cp->mp->am_mfarray; *mf; mf++)
if (cp->mp->am_error || cp->mp->am_mnt != *mf)
/* don't free the mntfs attached to the am_node */
if (cp->mp->am_mnt != *mf)
free_mntfs(*mf);
XFREE(cp->mp->am_mfarray);
cp->mp->am_mfarray = 0;
@ -298,12 +288,14 @@ free_continuation(struct continuation *cp)
/*
* Discard the underlying mount point and replace
* with a reference to an error filesystem.
* Replace mount point with a reference to an error filesystem.
* The mount point (struct mntfs) is NOT discarded,
* the caller must do it if it wants to _before_ calling this function.
*/
void
assign_error_mntfs(am_node *mp)
{
dlog("assign_error_mntfs");
if (mp->am_error > 0) {
/*
* Save the old error code
@ -311,10 +303,6 @@ assign_error_mntfs(am_node *mp)
int error = mp->am_error;
if (error <= 0)
error = mp->am_mnt->mf_error;
/*
* Discard the old filesystem
*/
free_mntfs(mp->am_mnt);
/*
* Allocate a new error reference
*/
@ -402,7 +390,7 @@ amfs_auto_cont(int rc, int term, voidp closure)
}
if (mf->mf_flags & MFF_NFS_SCALEDOWN)
amfs_auto_bgmount(cp, 0);
amfs_auto_bgmount(cp);
else {
/*
* If we get here then that attempt didn't work, so
@ -412,13 +400,14 @@ amfs_auto_cont(int rc, int term, voidp closure)
amd_stats.d_merr++;
cp->mf++;
xmp = cp->mp;
amfs_auto_bgmount(cp, 0);
amfs_auto_bgmount(cp);
assign_error_mntfs(xmp);
}
} else {
/*
* The mount worked.
*/
dlog("Mounting %s returned success", cp->mp->am_path);
am_mounted(cp->mp);
free_continuation(cp);
}
@ -453,9 +442,9 @@ amfs_auto_retry(int rc, int term, voidp closure)
/* explicitly forbid further retries after timeout */
cp->retry = FALSE;
}
if (error || !IN_PROGRESS(cp)) {
(void) amfs_auto_bgmount(cp, error);
}
if (error || !IN_PROGRESS(cp))
amfs_auto_bgmount(cp);
reschedule_timeout_mp();
}
@ -492,20 +481,18 @@ For each location:
fetch next mount location
if the filesystem failed to be mounted then
this_error = error from filesystem
elif the filesystem is mounting or unmounting then
this_error = -1
elif the fileserver is down then
this_error = -1
elif the filesystem is already mounted
this_error = 0
goto failed
if the filesystem is mounting or unmounting then
goto retry;
if the fileserver is down then
this_error = EIO
continue;
if the filesystem is already mounted
break
fi
if no error on this mount then
this_error = initialize mount point
fi
if file server is down then
this_error = -1
fi
this_error = initialize mount point
if no error on this mount and mount is delayed then
this_error = -1
fi
@ -527,13 +514,12 @@ For each location:
endfor
*/
static int
amfs_auto_bgmount(struct continuation *cp, int mp_error)
amfs_auto_bgmount(struct continuation *cp)
{
am_node *mp = cp->mp;
mntfs *mf = mp->am_mnt; /* Current mntfs */
mntfs *mf_retry = 0; /* First mntfs which needed retrying */
mntfs *mf; /* Current mntfs */
int this_error = -1; /* Per-mount error */
int hard_error = -1;
int hard_error = -1; /* Cumulative per-node error */
/*
* Try to mount each location.
@ -542,15 +528,15 @@ amfs_auto_bgmount(struct continuation *cp, int mp_error)
* hard_error > 0 indicates everything failed with a hard error
* hard_error < 0 indicates nothing could be mounted now
*/
for (; this_error && *cp->mf; cp->mf++) {
for (mp->am_mnt = *cp->mf; *cp->mf; cp->mf++, mp->am_mnt = *cp->mf) {
am_ops *p;
int retry;
mf = mp->am_mnt = *cp->mf;
mf = mp->am_mnt;
p = mf->mf_ops;
if (hard_error < 0)
hard_error = this_error;
this_error = 0;
if (mf->mf_fo->fs_mtab) {
plog(XLOG_MAP, "Trying mount of %s on %s fstype %s mount_type %s",
@ -558,9 +544,6 @@ amfs_auto_bgmount(struct continuation *cp, int mp_error)
mp->am_parent->am_mnt->mf_fo ? mp->am_parent->am_mnt->mf_fo->opt_mount_type : "root");
}
this_error = 0;
retry = TRUE;
if (mp->am_link) {
XFREE(mp->am_link);
mp->am_link = 0;
@ -570,30 +553,36 @@ amfs_auto_bgmount(struct continuation *cp, int mp_error)
if (mf->mf_error > 0) {
this_error = mf->mf_error;
} else if (mf->mf_flags & (MFF_MOUNTING | MFF_UNMOUNTING)) {
goto failed;
}
if (mf->mf_flags & (MFF_MOUNTING | MFF_UNMOUNTING)) {
/*
* Still mounting - retry later
*/
dlog("Duplicate pending mount fstype %s", p->fs_type);
this_error = -1;
} else if (FSRV_ISDOWN(mf->mf_server)) {
goto retry;
}
if (FSRV_ISDOWN(mf->mf_server)) {
/*
* Would just mount from the same place
* as a hung mount - so give up
*/
dlog("%s is already hung - giving up", mf->mf_mount);
mp_error = EWOULDBLOCK;
retry = FALSE;
this_error = -1;
} else if (mf->mf_flags & MFF_MOUNTED) {
dlog("%s is already hung - giving up", mf->mf_server->fs_host);
this_error = EIO;
if (mf->mf_error < 0)
mf->mf_error = EIO;
continue;
}
if (mf->mf_flags & MFF_MOUNTED) {
dlog("duplicate mount of \"%s\" ...", mf->mf_info);
/*
* Just call am_mounted()
*/
am_mounted(mp);
this_error = 0;
break;
}
@ -604,28 +593,24 @@ amfs_auto_bgmount(struct continuation *cp, int mp_error)
* is not known to be up. In the common case this will
* progress things faster.
*/
if (!this_error) {
/*
* Fill in attribute fields.
*/
if (mf->mf_fsflags & FS_DIRECTORY)
mk_fattr(mp, NFDIR);
else
mk_fattr(mp, NFLNK);
if (p->fs_init)
this_error = (*p->fs_init) (mf);
}
/*
* Make sure the fileserver is UP before doing any more work
* Fill in attribute fields.
*/
if (!FSRV_ISUP(mf->mf_server)) {
dlog("waiting for server %s to become available", mf->mf_server->fs_host);
this_error = -1;
}
if (mf->mf_fsflags & FS_DIRECTORY)
mk_fattr(mp, NFDIR);
else
mk_fattr(mp, NFLNK);
if (!this_error && mf->mf_fo->opt_delay) {
if (p->fs_init)
this_error = (*p->fs_init) (mf);
if (this_error > 0)
continue;
if (this_error < 0)
goto retry;
if (mf->mf_fo->opt_delay) {
/*
* If there is a delay timer on the mount
* then don't try to mount if the timer
@ -634,144 +619,99 @@ amfs_auto_bgmount(struct continuation *cp, int mp_error)
int i = atoi(mf->mf_fo->opt_delay);
if (i > 0 && clocktime() < (cp->start + i)) {
dlog("Mount of %s delayed by %lds", mf->mf_mount, (long) (i - clocktime() + cp->start));
this_error = -1;
goto retry;
}
}
if (this_error < 0 && retry) {
if (!mf_retry)
mf_retry = dup_mntfs(mf);
cp->retry = TRUE;
dlog("will retry ...\n");
break;
}
/*
* If the directory is not yet made and it needs to be made, then make it!
*/
if (!this_error && !(mf->mf_flags & MFF_MKMNT) && mf->mf_fsflags & FS_MKMNT) {
if (!(mf->mf_flags & MFF_MKMNT) && mf->mf_fsflags & FS_MKMNT) {
plog(XLOG_INFO, "creating mountpoint directory '%s'", mf->mf_real_mount);
this_error = mkdirs(mf->mf_real_mount, 0555);
if (this_error)
plog(XLOG_ERROR, "mkdir failed: %s", strerror(this_error));
else
mf->mf_flags |= MFF_MKMNT;
if (this_error) {
plog(XLOG_ERROR, "mkdirs failed: %s", strerror(this_error));
continue;
}
mf->mf_flags |= MFF_MKMNT;
}
if (!this_error) {
#ifdef HAVE_FS_AUTOFS
if (mf->mf_flags & MFF_AUTOFS) {
mf->mf_autofs_fh = autofs_get_fh(mp);
if (mf->mf_fsflags & FS_MBACKGROUND) {
mf->mf_flags |= MFF_MOUNTING; /* XXX */
dlog("backgrounding mount of \"%s\"", mf->mf_mount);
if (cp->callout) {
untimeout(cp->callout);
cp->callout = 0;
}
#endif /* HAVE_FS_AUTOFS */
if (mf->mf_fsflags & FS_MBACKGROUND) {
mf->mf_flags |= MFF_MOUNTING; /* XXX */
dlog("backgrounding mount of \"%s\"", mf->mf_mount);
if (cp->callout) {
untimeout(cp->callout);
cp->callout = 0;
}
/* actually run the task, backgrounding as necessary */
run_task(try_mount, (voidp) mp, amfs_auto_cont, (voidp) cp);
if (mf_retry)
free_mntfs(mf_retry);
return -1;
} else {
dlog("foreground mount of \"%s\" ...", mf->mf_info);
this_error = try_mount((voidp) mp);
if (this_error < 0) {
if (!mf_retry)
mf_retry = dup_mntfs(mf);
cp->retry = TRUE;
}
}
}
}
if (this_error >= 0) {
if (this_error > 0) {
amd_stats.d_merr++;
if (mf != mf_retry) {
mf->mf_error = this_error;
mf->mf_flags |= MFF_ERROR;
}
/* actually run the task, backgrounding as necessary */
run_task(try_mount, (voidp) mp, amfs_auto_cont, (voidp) cp);
return -1;
} else {
dlog("foreground mount of \"%s\" ...", mf->mf_info);
this_error = try_mount((voidp) mp);
/* do this again, it might have changed */
mf = mp->am_mnt;
}
if (this_error > 0)
goto failed;
break; /* Success */
retry:
if (!cp->retry)
continue;
dlog("will retry ...\n");
/*
* Arrange that amfs_auto_bgmount is called
* after anything else happens.
*/
dlog("Arranging to retry mount of %s", mp->am_path);
sched_task(amfs_auto_retry, (voidp) cp, (voidp) mf);
if (cp->callout)
untimeout(cp->callout);
cp->callout = timeout(RETRY_INTERVAL, wakeup, (voidp) mf);
mp->am_ttl = clocktime() + RETRY_INTERVAL;
/*
* Not done yet - so don't return anything
*/
return -1;
failed:
amd_stats.d_merr++;
mf->mf_error = this_error;
mf->mf_flags |= MFF_ERROR;
if (mf->mf_flags & MFF_MKMNT) {
rmdirs(mf->mf_real_mount);
mf->mf_flags &= ~MFF_MKMNT;
}
/*
* Wakeup anything waiting for this mount
*/
wakeup((voidp) mf);
}
if (this_error) {
if (cp->retry) {
free_mntfs(mf);
mf = mp->am_mnt = mf_retry;
/*
* Not retrying again (so far)
*/
cp->retry = FALSE;
#if 0
/*
* Start at the beginning.
* Rewind the location vector and
* reset the default options.
*
* DISABLED.
*/
dlog("(skipping rewind)\n");
#endif
/*
* Arrange that amfs_auto_bgmount is called
* after anything else happens.
*/
dlog("Arranging to retry mount of %s", mp->am_path);
sched_task(amfs_auto_retry, (voidp) cp, (voidp) mf);
if (cp->callout)
untimeout(cp->callout);
cp->callout = timeout(RETRY_INTERVAL, wakeup, (voidp) mf);
mp->am_ttl = clocktime() + RETRY_INTERVAL;
/*
* Not done yet - so don't return anything
*/
return -1;
} else {
#ifdef HAVE_FS_AUTOFS
if (mp->am_flags & AMF_AUTOFS)
autofs_mount_failed(mp);
#endif /* HAVE_FS_AUTOFS */
if (mf->mf_flags & MFF_MKMNT)
rmdirs(mf->mf_real_mount);
}
}
if (hard_error < 0 || this_error == 0)
hard_error = this_error;
/*
* Discard handle on duff filesystem.
* This should never happen since it
* should be caught by the case above.
*/
if (mf_retry) {
if (hard_error)
plog(XLOG_ERROR, "discarding a retry mntfs for %s", mf_retry->mf_mount);
free_mntfs(mf_retry);
/* continue */
}
/*
* If we get here, then either the mount succeeded or
* there is no more mount information available.
*/
if (hard_error < 0 && mp_error)
hard_error = mp->am_error = mp_error;
if (hard_error > 0) {
if (this_error) {
mp->am_mnt = mf = new_mntfs();
#ifdef HAVE_FS_AUTOFS
if (mp->am_flags & AMF_AUTOFS)
autofs_mount_failed(mp);
#endif /* HAVE_FS_AUTOFS */
if (hard_error <= 0)
hard_error = this_error;
if (hard_error < 0)
hard_error = ETIMEDOUT;
/*
* Set a small(ish) timeout on an error node if
* the error was not a time out.
@ -779,6 +719,7 @@ amfs_auto_bgmount(struct continuation *cp, int mp_error)
switch (hard_error) {
case ETIMEDOUT:
case EWOULDBLOCK:
case EIO:
mp->am_timeo = 17;
break;
default:
@ -786,6 +727,13 @@ amfs_auto_bgmount(struct continuation *cp, int mp_error)
break;
}
new_ttl(mp);
} else {
mf = mp->am_mnt;
/*
* Wakeup anything waiting for this mount
*/
wakeup((voidp) mf);
hard_error = 0;
}
/*
@ -967,6 +915,7 @@ amfs_auto_lookup_node(am_node *mp, char *fname, int *error_return)
error = new_mp->am_error;
continue;
}
/*
* If the error code is undefined then it must be
* in progress.
@ -975,14 +924,6 @@ amfs_auto_lookup_node(am_node *mp, char *fname, int *error_return)
if (mf->mf_error < 0)
goto in_progrss;
/*
* Check for a hung node
*/
if (FSRV_ISDOWN(mf->mf_server)) {
dlog("server hung");
error = new_mp->am_error;
continue;
}
/*
* If there was a previous error with this node
* then return that error code.
@ -1000,10 +941,14 @@ amfs_auto_lookup_node(am_node *mp, char *fname, int *error_return)
* wait for a retry, by which time the (un)mount may
* have completed.
*/
dlog("ignoring mount of %s in %s -- flags (%x) in progress",
expanded_fname, mf->mf_mount, mf->mf_flags);
dlog("ignoring mount of %s in %s -- %smounting in progress, flags %x",
expanded_fname, mf->mf_mount,
(mf->mf_flags & MFF_UNMOUNTING) ? "un" : "", mf->mf_flags);
in_progress++;
new_mp->am_flags |= AMF_REMOUNT;
if (mf->mf_flags & MFF_UNMOUNTING) {
dlog("will remount later");
new_mp->am_flags |= AMF_REMOUNT;
}
continue;
}
@ -1162,6 +1107,8 @@ amfs_auto_lookup_mntfs(am_node *new_mp, int *error_return)
* map for it.
*/
if (mp->am_pref) {
if (strlen(mp->am_pref) + strlen(new_mp->am_name) >= sizeof(path_name))
ereturn(ENAMETOOLONG);
sprintf(path_name, "%s%s", mp->am_pref, new_mp->am_name);
pfname = path_name;
} else {
@ -1198,11 +1145,6 @@ amfs_auto_lookup_mntfs(am_node *new_mp, int *error_return)
*/
ivecs = strsplit(info, ' ', '\"');
/*
* Default error code...
*/
error = ENOENT;
if (mf->mf_auto)
def_opts = mf->mf_auto;
else
@ -1217,7 +1159,8 @@ amfs_auto_lookup_mntfs(am_node *new_mp, int *error_return)
/*
* Pick up new defaults
*/
def_opts = str3cat(def_opts, def_opts, ";", *cur_ivec + 1);
char *old_def_opts = def_opts;
def_opts = str3cat((char *) 0, old_def_opts, ";", *cur_ivec + 1);
dlog("Setting def_opts to \"%s\"", def_opts);
continue;
} else
@ -1257,7 +1200,7 @@ amfs_auto_lookup_mntfs(am_node *new_mp, int *error_return)
XFREE(info);
if (count == 0) { /* no match */
XFREE(mf_array);
return NULL;
ereturn(ENOENT);
}
return mf_array;
@ -1284,7 +1227,7 @@ amfs_auto_mount_child(am_node *new_mp, int *error_return)
cp = ALLOC(struct continuation);
cp->callout = 0;
cp->mp = new_mp;
cp->retry = FALSE;
cp->retry = TRUE;
cp->start = clocktime();
cp->mf = new_mp->am_mfarray;
@ -1293,7 +1236,7 @@ amfs_auto_mount_child(am_node *new_mp, int *error_return)
* for a ufs file system) then return the attributes, otherwise just
* return an error.
*/
error = amfs_auto_bgmount(cp, error);
error = amfs_auto_bgmount(cp);
reschedule_timeout_mp();
if (!error)
return new_mp;
@ -1330,14 +1273,19 @@ amfs_auto_lookup_child(am_node *mp, char *fname, int *error_return, int op)
{
am_node *new_mp;
mntfs **mf_array;
int mp_error;
dlog("in amfs_auto_lookup_child");
*error_return = 0;
new_mp = amfs_auto_lookup_node(mp, fname, error_return);
/* return if it was already mounted or if we got an error */
if (!new_mp || *error_return >= 0)
/* return if we got an error */
if (!new_mp || *error_return > 0)
return new_mp;
/* also return if it's already mounted and known to be up */
if (*error_return == 0 && FSRV_ISUP(new_mp->am_mnt->mf_server))
return new_mp;
if (op == VLOOK_DELETE)
@ -1346,19 +1294,48 @@ amfs_auto_lookup_child(am_node *mp, char *fname, int *error_return, int op)
*/
ereturn(ENOENT);
/* save error_return */
mp_error = *error_return;
mf_array = amfs_auto_lookup_mntfs(new_mp, error_return);
if (!mf_array) {
/* don't touch *error_return, it's already set */
new_mp->am_error = new_mp->am_mnt->mf_error = *error_return;
free_map(new_mp);
return 0;
return NULL;
}
/*
* Already mounted but known to be down:
* check if we have any alternatives to mount
*/
if (mp_error == 0) {
mntfs **mfp;
for (mfp = mf_array; *mfp; mfp++)
if (*mfp != new_mp->am_mnt)
break;
if (*mfp != NULL) {
/*
* we found an alternative, so try mounting again.
*/
*error_return = -1;
} else {
for (mfp = mf_array; *mfp; mfp++)
free_mntfs(*mfp);
XFREE(mf_array);
if (new_mp->am_flags & AMF_SOFTLOOKUP) {
ereturn(EIO);
} else {
*error_return = 0;
return new_mp;
}
}
}
/* store the array inside the am_node */
new_mp->am_mfarray = mf_array;
/*
* we need to sort the mntfs's we got.
* XXX: we need to sort the mntfs's we got.
* the order should be something like:
* 1. link
* 2. anything else (XXX -- any other preferences?)
@ -1411,9 +1388,9 @@ amfs_auto_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, i
/* check if map is browsable */
if (mp->am_mnt && mp->am_mnt->mf_mopts) {
mnt.mnt_opts = mp->am_mnt->mf_mopts;
if (hasmntopt(&mnt, "fullybrowsable"))
if (amu_hasmntopt(&mnt, "fullybrowsable"))
return amfs_auto_readdir_browsable(mp, cookie, dp, ep, count, TRUE);
if (hasmntopt(&mnt, "browsable"))
if (amu_hasmntopt(&mnt, "browsable"))
return amfs_auto_readdir_browsable(mp, cookie, dp, ep, count, FALSE);
}
@ -1460,7 +1437,7 @@ amfs_auto_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, i
if (!xp)
dp->dl_eof = TRUE; /* by default assume readdir done */
amuDebug(D_READDIR) {
if (amuDebug(D_READDIR)) {
nfsentry *ne;
int j;
for (j = 0, ne = ep; ne; ne = ne->ne_nextentry)
@ -1475,7 +1452,7 @@ amfs_auto_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, i
dlog("amfs_auto_readdir: End of readdir in %s", mp->am_path);
dp->dl_eof = TRUE;
dp->dl_entries = 0;
amuDebug(D_READDIR)
if (amuDebug(D_READDIR))
plog(XLOG_DEBUG, "end of readdir eof=TRUE, dl_entries=0\n");
return 0;
}
@ -1519,7 +1496,7 @@ amfs_auto_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, i
ep->ne_nextentry = 0;
amuDebug(D_READDIR) {
if (amuDebug(D_READDIR)) {
nfsentry *ne;
int j;
for (j=0,ne=ep; ne; ne=ne->ne_nextentry)
@ -1543,7 +1520,7 @@ amfs_auto_readdir_browsable(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsen
dp->dl_eof = FALSE; /* assume readdir not done */
amuDebug(D_READDIR)
if (amuDebug(D_READDIR))
plog(XLOG_DEBUG, "amfs_auto_readdir_browsable gen=%u, count=%d",
gen, count);
@ -1607,7 +1584,7 @@ amfs_auto_readdir_browsable(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsen
te = make_entry_chain(mp, dp->dl_entries, fully_browsable);
if (!te)
return 0;
amuDebug(D_READDIR) {
if (amuDebug(D_READDIR)) {
nfsentry *ne;
for (j = 0, ne = te; ne; ne = ne->ne_nextentry)
plog(XLOG_DEBUG, "gen1 key %4d \"%s\"", j++, ne->ne_name);
@ -1629,7 +1606,7 @@ amfs_auto_readdir_browsable(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsen
dp->dl_eof = TRUE; /* tell readdir that's it */
}
ep[1].ne_nextentry = te; /* append this chunk of "te" chain */
amuDebug(D_READDIR) {
if (amuDebug(D_READDIR)) {
nfsentry *ne;
for (j = 0, ne = te; ne; ne = ne->ne_nextentry)
plog(XLOG_DEBUG, "gen2 key %4d \"%s\"", j++, ne->ne_name);
@ -1683,7 +1660,7 @@ amfs_auto_readdir_browsable(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsen
}
ep = te; /* send next chunk of "te" chain */
dp->dl_entries = ep;
amuDebug(D_READDIR) {
if (amuDebug(D_READDIR)) {
nfsentry *ne;
plog(XLOG_DEBUG, "dl_entries=0x%lx, te_next=0x%lx, dl_eof=%d",
(u_long) dp->dl_entries,

View File

@ -1,7 +1,7 @@
/* $NetBSD: amq_subr.c,v 1.7 2002/12/06 03:57:44 thorpej Exp $ */
/* $NetBSD: amq_subr.c,v 1.8 2003/03/09 01:38:39 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: amq_subr.c,v 1.12 2002/06/23 01:05:38 ib42 Exp
* Id: amq_subr.c,v 1.13 2002/12/27 22:43:48 ezk Exp
*
*/
/*

View File

@ -1,7 +1,7 @@
/* $NetBSD: map.c,v 1.2 2002/11/29 23:11:26 christos Exp $ */
/* $NetBSD: map.c,v 1.3 2003/03/09 01:38:39 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: map.c,v 1.32 2002/06/24 03:05:15 ib42 Exp
* Id: map.c,v 1.36 2002/12/27 22:43:50 ezk Exp
*
*/
@ -464,6 +464,7 @@ fh_to_mp3(am_nfs_fh *fhp, int *rp, int c_or_d)
ap = 0;
goto drop;
}
#if 0
/*
* If the node is hung then locate a new node
* for it. This implements the replicated filesystem
@ -473,7 +474,7 @@ fh_to_mp3(am_nfs_fh *fhp, int *rp, int c_or_d)
int error;
am_node *orig_ap = ap;
dlog("fh_to_mp3: %s (%s) is hung:- call lookup",
dlog("fh_to_mp3: %s (%s) is hung: lookup alternative file server",
orig_ap->am_path, orig_ap->am_mnt->mf_info);
/*
@ -514,6 +515,7 @@ fh_to_mp3(am_nfs_fh *fhp, int *rp, int c_or_d)
new_ttl(orig_ap);
}
#endif
/*
* Disallow references to objects being unmounted, unless
@ -890,10 +892,13 @@ unmount_node(am_node *mp)
dlog("No-op unmount of error node %s", mf->mf_info);
error = 0;
} else {
dlog("Unmounting %s (%s)", mf->mf_mount, mf->mf_info);
dlog("Unmounting <%s> <%s> (%s) flags %x",
mp->am_path, mf->mf_mount, mf->mf_info, mf->mf_flags);
error = (*mf->mf_ops->umount_fs) (mp, mf);
}
/* do this again, it might have changed */
mf = mp->am_mnt;
if (error) {
errno = error; /* XXX */
dlog("%s: unmount: %m", mf->mf_mount);
@ -1028,6 +1033,18 @@ unmount_mp(am_node *mp)
plog(XLOG_INFO, "\"%s\" on %s timed out", mp->am_path, mp->am_mnt->mf_mount);
#endif /* notdef */
if (mf->mf_refc == 1 && !FSRV_ISUP(mf->mf_server)) {
/*
* Don't try to unmount from a server that is known to be down
*/
if (!(mf->mf_flags & MFF_LOGDOWN)) {
/* Only log this once, otherwise gets a bit boring */
plog(XLOG_STATS, "file server %s is down - timeout of \"%s\" ignored", mf->mf_server->fs_host, mp->am_path);
mf->mf_flags |= MFF_LOGDOWN;
}
return 0;
}
#ifdef HAVE_FS_AUTOFS
if (mf->mf_flags & MFF_AUTOFS) {
autofs_release_fh(mf->mf_autofs_fh);
@ -1035,35 +1052,16 @@ unmount_mp(am_node *mp)
}
#endif /* HAVE_FS_AUTOFS */
dlog("\"%s\" on %s timed out", mp->am_path, mp->am_mnt->mf_mount);
mf->mf_flags |= MFF_UNMOUNTING;
if ((mf->mf_fsflags & FS_UBACKGROUND) &&
(mf->mf_flags & MFF_MOUNTED)) {
if (mf->mf_refc == 1 && !FSRV_ISUP(mf->mf_server)) {
/*
* Don't try to unmount from a server that is known to be down
*/
if (!(mf->mf_flags & MFF_LOGDOWN)) {
/* Only log this once, otherwise gets a bit boring */
plog(XLOG_STATS, "file server %s is down - timeout of \"%s\" ignored", mf->mf_server->fs_host, mp->am_path);
mf->mf_flags |= MFF_LOGDOWN;
}
} else {
/* Clear logdown flag - since the server must be up */
mf->mf_flags &= ~MFF_LOGDOWN;
dlog("\"%s\" on %s timed out", mp->am_path, mp->am_mnt->mf_mount);
/* dlog("Will background the unmount attempt"); */
/*
* Note that we are unmounting this node
*/
mf->mf_flags |= MFF_UNMOUNTING;
run_task(unmount_node_wrap, (voidp) mp,
free_map_if_success, (voidp) mp);
was_backgrounded = 1;
dlog("unmount attempt backgrounded");
}
dlog("Trying unmount in background");
run_task(unmount_node_wrap, (voidp) mp,
free_map_if_success, (voidp) mp);
was_backgrounded = 1;
} else {
dlog("\"%s\" on %s timed out", mp->am_path, mp->am_mnt->mf_mount);
dlog("Trying unmount in foreground");
mf->mf_flags |= MFF_UNMOUNTING;
free_map_if_success(unmount_node(mp), 0, (voidp) mp);
dlog("unmount attempt done");
}

View File

@ -1,7 +1,7 @@
/* $NetBSD: nfs_start.c,v 1.2 2002/11/29 23:10:40 christos Exp $ */
/* $NetBSD: nfs_start.c,v 1.3 2003/03/09 01:38:40 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: nfs_start.c,v 1.16 2002/06/23 01:46:59 ezk Exp
* Id: nfs_start.c,v 1.18 2002/12/27 22:43:50 ezk Exp
*
*/

View File

@ -1,7 +1,7 @@
/* $NetBSD: opts.c,v 1.4 2002/11/29 23:06:22 christos Exp $ */
/* $NetBSD: opts.c,v 1.5 2003/03/09 01:38:40 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: opts.c,v 1.23 2002/06/23 01:05:39 ib42 Exp
* Id: opts.c,v 1.25 2002/12/27 22:43:52 ezk Exp
*
*/
@ -1179,7 +1179,7 @@ expand_op(char *opt, int sel_p)
plog(XLOG_ERROR, expand_error, opt);
goto out;
}
amuDebug(D_STR)
if (amuDebug(D_STR))
plog(XLOG_DEBUG, "Environment gave \"%s\" -> \"%s\"", nbuf, env);
} else {
plog(XLOG_USER, "Unknown sequence \"${%s}\"", nbuf);
@ -1218,7 +1218,7 @@ out:
normalize_slash(opt);
amuDebug(D_STR) {
if (amuDebug(D_STR)) {
plog(XLOG_DEBUG, "Expansion of \"%s\"...", cp_orig);
plog(XLOG_DEBUG, "......... is \"%s\"", opt);
}

View File

@ -1,7 +1,7 @@
/* $NetBSD: sched.c,v 1.4 2002/11/29 23:06:22 christos Exp $ */
/* $NetBSD: sched.c,v 1.5 2003/03/09 01:38:40 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: sched.c,v 1.10 2002/02/02 20:58:56 ezk Exp
* Id: sched.c,v 1.11 2002/12/27 22:43:52 ezk Exp
*
*/

View File

@ -1,7 +1,7 @@
/* $NetBSD: srvr_nfs.c,v 1.7 2003/01/06 13:26:24 wiz Exp $ */
/* $NetBSD: srvr_nfs.c,v 1.8 2003/03/09 01:38:40 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: srvr_nfs.c,v 1.18 2002/06/23 01:05:39 ib42 Exp
* Id: srvr_nfs.c,v 1.23 2002/12/29 01:51:26 ib42 Exp
*
*/
@ -394,21 +394,21 @@ nfs_timed_out(voidp v)
* Another ping has failed
*/
np->np_ping++;
if (np->np_ping > 1)
srvrlog(fs, "not responding");
/*
* Not known to be up any longer
*/
if (FSRV_ISUP(fs)) {
if (FSRV_ISUP(fs))
fs->fs_flags &= ~FSF_VALID;
if (np->np_ping > 1)
srvrlog(fs, "not responding");
}
/*
* If ttl has expired then guess that it is dead
*/
if (np->np_ttl < clocktime()) {
int oflags = fs->fs_flags;
dlog("ttl has expired");
if ((fs->fs_flags & FSF_DOWN) == 0) {
/*
* Server was up, but is now down.
@ -432,11 +432,21 @@ nfs_timed_out(voidp v)
}
if (oflags != fs->fs_flags && (fs->fs_flags & FSF_WANT))
wakeup_srvr(fs);
/*
* Reset failed ping count
*/
np->np_ping = 0;
} else {
if (np->np_ping > 1)
dlog("%d pings to %s failed - at most %d allowed", np->np_ping, fs->fs_host, MAX_ALLOWED_PINGS);
}
/*
* New RPC xid, so any late responses to the previous ping
* get ignored...
*/
np->np_xid = NPXID_ALLOC(struct );
/*
* Run keepalive again
*/
@ -569,19 +579,20 @@ nfs_srvr_port(fserver *fs, u_short *port, voidp wchan)
static void
start_nfs_pings(fserver *fs, int pingval)
{
if (!(fs->fs_flags & FSF_PINGING)) {
fs->fs_flags |= FSF_PINGING;
if (fs->fs_cid)
untimeout(fs->fs_cid);
if (pingval < 0) {
srvrlog(fs, "wired up");
fs->fs_flags |= FSF_VALID;
fs->fs_flags &= ~FSF_DOWN;
} else {
nfs_keepalive(fs);
}
} else {
if (fs->fs_flags & FSF_PINGING) {
dlog("Already running pings to %s", fs->fs_host);
return;
}
if (fs->fs_cid)
untimeout(fs->fs_cid);
if (pingval < 0) {
srvrlog(fs, "wired up (pings disabled)");
fs->fs_flags |= FSF_VALID;
fs->fs_flags &= ~FSF_DOWN;
} else {
fs->fs_flags |= FSF_PINGING;
nfs_keepalive(fs);
}
}
@ -593,7 +604,6 @@ fserver *
find_nfs_srvr(mntfs *mf)
{
char *host = mf->mf_fo->opt_rhost;
char *nfs_proto = NULL;
fserver *fs;
int pingval;
mntent_t mnt;
@ -601,9 +611,7 @@ find_nfs_srvr(mntfs *mf)
struct hostent *hp = 0;
struct sockaddr_in *ip;
u_long nfs_version = 0; /* default is no version specified */
#ifdef MNTTAB_OPT_PROTO
char *rfsname = mf->mf_fo->opt_rfs;
#endif /* MNTTAB_OPT_PROTO */
char *nfs_proto = NULL; /* no IP protocol either */
/*
* Get ping interval from mount options.
@ -643,21 +651,21 @@ find_nfs_srvr(mntfs *mf)
}
if (*p == NULL)
plog(XLOG_WARNING, "ignoring unknown protocol option for %s:%s",
host, rfsname);
host, mf->mf_fo->opt_rfs);
}
}
#endif /* MNTTAB_OPT_PROTO */
#ifdef HAVE_NFS_NFSV2_H
/* allow overriding if nfsv2 option is specified in mount options */
if (hasmntopt(&mnt, "nfsv2")) {
if (amu_hasmntopt(&mnt, "nfsv2")) {
nfs_version = (u_long) 2; /* nullify any ``vers=X'' statements */
nfs_proto = "udp"; /* nullify any ``proto=tcp'' statements */
plog(XLOG_WARNING, "found compatibility option \"nfsv2\": set options vers=2,proto=udp for host %s", host);
}
#endif /* HAVE_NFS_NFSV2_H */
/* check if we globally overridden the NFS version/protocol */
/* check if we've globally overridden the NFS version/protocol */
if (gopt.nfs_vers) {
nfs_version = gopt.nfs_vers;
plog(XLOG_INFO, "find_nfs_srvr: force NFS version to %d",
@ -704,6 +712,22 @@ find_nfs_srvr(mntfs *mf)
ip = 0;
}
/*
* This may not be the best way to do things, but it really doesn't make
* sense to query a file server which is marked as 'down' for any
* version/proto combination.
*/
ITER(fs, fserver, &nfs_srvr_list) {
if (FSRV_ISDOWN(fs) &&
STREQ(host, fs->fs_host)) {
plog(XLOG_WARNING, "fileserver %s is already hung - not running NFS proto/version discovery", host);
fs->fs_refc++;
if (ip)
XFREE(ip);
return fs;
}
}
/*
* Get the NFS Version, and verify server is up. Probably no
* longer need to start server down below.
@ -765,6 +789,15 @@ find_nfs_srvr(mntfs *mf)
if (STREQ(host, fs->fs_host) &&
nfs_version == fs->fs_version &&
STREQ(nfs_proto, fs->fs_proto)) {
/*
* fill in the IP address -- this is only needed
* if there is a chance an IP address will change
* between mounts.
* Mike Mitchell, mcm@unx.sas.com, 09/08/93
*/
if (hp && fs->fs_ip)
memmove((voidp) &fs->fs_ip->sin_addr, (voidp) hp->h_addr, sizeof(fs->fs_ip->sin_addr));
/*
* following if statement from Mike Mitchell
* <mcm@unx.sas.com>
@ -784,17 +817,9 @@ find_nfs_srvr(mntfs *mf)
* have failed.
*/
np->np_ttl = MAX_ALLOWED_PINGS * FAST_NFS_PING + clocktime() - 1;
start_nfs_pings(fs, pingval);
}
/*
* fill in the IP address -- this is only needed
* if there is a chance an IP address will change
* between mounts.
* Mike Mitchell, mcm@unx.sas.com, 09/08/93
*/
if (hp && fs->fs_ip)
memmove((voidp) &fs->fs_ip->sin_addr, (voidp) hp->h_addr, sizeof(fs->fs_ip->sin_addr));
start_nfs_pings(fs, pingval);
fs->fs_refc++;
if (ip)
XFREE(ip);

View File

@ -1,6 +1,6 @@
#! /bin/sh
#
# $NetBSD: amd2netbsd,v 1.1.1.1 2003/03/09 01:13:04 christos Exp $
# $NetBSD: amd2netbsd,v 1.2 2003/03/09 01:38:38 christos Exp $
#
# Copyright (c) 2000 The NetBSD Foundation, Inc.
# All rights reserved.

View File

@ -1,7 +1,7 @@
.\" $NetBSD: amq.8,v 1.3 2002/11/29 23:06:23 christos Exp $
.\" $NetBSD: amq.8,v 1.4 2003/03/09 01:38:41 christos Exp $
.\"
.\"
.\" Copyright (c) 1997-2002 Erez Zadok
.\" Copyright (c) 1997-2003 Erez Zadok
.\" Copyright (c) 1990 Jan-Simon Pendry
.\" Copyright (c) 1990 Imperial College of Science, Technology & Medicine
.\" Copyright (c) 1990 The Regents of the University of California.
@ -40,7 +40,7 @@
.\"
.\" %W% (Berkeley) %G%
.\"
.\" Id: amq.8,v 1.9 2002/01/07 07:36:21 ezk Exp
.\" Id: amq.8,v 1.10 2002/12/27 22:43:53 ezk Exp
.\"
.TH AMQ 8 "25 April 1989"
.SH NAME

View File

@ -1,7 +1,7 @@
/* $NetBSD: amq.c,v 1.4 2002/11/29 23:06:23 christos Exp $ */
/* $NetBSD: amq.c,v 1.5 2003/03/09 01:38:41 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: amq.c,v 1.14 2002/02/02 20:58:56 ezk Exp
* Id: amq.c,v 1.17 2002/12/27 22:43:53 ezk Exp
*
*/
@ -49,13 +49,13 @@
#ifndef lint
char copyright[] = "\
@(#)Copyright (c) 1997-2002 Erez Zadok\n\
@(#)Copyright (c) 1997-2003 Erez Zadok\n\
@(#)Copyright (c) 1990 Jan-Simon Pendry\n\
@(#)Copyright (c) 1990 Imperial College of Science, Technology & Medicine\n\
@(#)Copyright (c) 1990 The Regents of the University of California.\n\
@(#)All rights reserved.\n";
#if __GNUC__ < 2
static char rcsid[] = "Id: amq.c,v 1.14 2002/02/02 20:58:56 ezk Exp";
static char rcsid[] = "Id: amq.c,v 1.17 2002/12/27 22:43:53 ezk Exp";
#endif /* __GNUC__ < 2 */
#endif /* not lint */
@ -251,14 +251,7 @@ show_mi(amq_mount_info_list *ml, enum show_opt e, int *mwid, int *dwid, int *twi
mi->mi_up > 0 ? "up" :
mi->mi_up < 0 ? "starting" : "down");
if (mi->mi_error > 0) {
if (mi->mi_error < sys_nerr)
#ifdef HAVE_STRERROR
printf(" (%s)", strerror(mi->mi_error));
#else /* not HAVE_STRERROR */
printf(" (%s)", sys_errlist[mi->mi_error]);
#endif /* not HAVE_STRERROR */
else
printf(" (Error %d)", mi->mi_error);
printf(" (%s)", strerror(mi->mi_error));
} else if (mi->mi_error < 0) {
fputs(" (in progress)", stdout);
}

View File

@ -1,7 +1,7 @@
.\" $NetBSD: pawd.1,v 1.3 2002/11/29 23:06:23 christos Exp $
.\" $NetBSD: pawd.1,v 1.4 2003/03/09 01:38:41 christos Exp $
.\"
.\"
.\" Copyright (c) 1997-2002 Erez Zadok
.\" Copyright (c) 1997-2003 Erez Zadok
.\" Copyright (c) 1990 Jan-Simon Pendry
.\" Copyright (c) 1990 Imperial College of Science, Technology & Medicine
.\" Copyright (c) 1990 The Regents of the University of California.
@ -40,7 +40,7 @@
.\"
.\" %W% (Berkeley) %G%
.\"
.\" Id: pawd.1,v 1.5 2002/01/07 07:36:21 ezk Exp
.\" Id: pawd.1,v 1.6 2002/12/27 22:43:54 ezk Exp
.\"
.TH PAWD 1 "6 Jan 1998"
.SH NAME

View File

@ -1,7 +1,7 @@
/* $NetBSD: transp_sockets.c,v 1.4 2002/11/29 23:18:25 christos Exp $ */
/* $NetBSD: transp_sockets.c,v 1.5 2003/03/09 01:38:42 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: transp_sockets.c,v 1.15 2002/06/23 01:05:39 ib42 Exp
* Id: transp_sockets.c,v 1.21 2002/12/27 22:44:03 ezk Exp
*
* Socket specific utilities.
* -Erez Zadok <ezk@cs.columbia.edu>
@ -55,17 +55,40 @@
#define RPC_MAXDATASIZE 9000
#endif
/* provide a definition for systems that don't have this */
#ifndef INADDR_LOOPBACK
# define INADDR_LOOPBACK 0x7f000001
#endif /* not INADDR_LOOPBACK */
/*
* find the IP address that can be used to connect to the local host
*/
void
amu_get_myaddress(struct in_addr *iap)
{
#ifdef DEBUG
struct sockaddr_in sin;
/*
* Most modern systems should use 127.0.0.1 as the localhost address over
* which you can do NFS mounts. In the past we found that some NFS
* clients may not allow mounts from localhost. So we used
* get_myaddress() and that seemed to work. Alas, on some other systems,
* get_myaddress() may return one of the interface addresses at random,
* and thus use a less efficient IP address than 127.0.0.1. The solution
* is to hard-code 127.0.0.1, but still check if get_myaddress() returns a
* different value and warn about it.
*/
memset((char *) &sin, 0, sizeof(sin));
get_myaddress(&sin);
iap->s_addr = sin.sin_addr.s_addr;
if (sin.sin_addr.s_addr != htonl(INADDR_LOOPBACK))
dlog("amu_get_myaddress: myaddress conflict (0x%x vs. 0x%lx)",
sin.sin_addr.s_addr, (u_long) htonl(INADDR_LOOPBACK));
#endif /* DEBUG */
iap->s_addr = htonl(INADDR_LOOPBACK);
}
@ -185,7 +208,9 @@ amu_svc_getcaller(SVCXPRT *xprt)
* register an RPC server
*/
int
amu_svc_register(SVCXPRT *xprt, u_long prognum, u_long versnum, void (*dispatch)(struct svc_req *rqstp, SVCXPRT *transp), u_long protocol, struct netconfig *dummy)
amu_svc_register(SVCXPRT *xprt, u_long prognum, u_long versnum,
void (*dispatch)(struct svc_req *rqstp, SVCXPRT *transp),
u_long protocol, struct netconfig *dummy)
{
return svc_register(xprt, prognum, versnum, dispatch, protocol);
}
@ -226,7 +251,9 @@ create_nfs_service(int *soNFSp, u_short *nfs_portp, SVCXPRT **nfs_xprtp, void (*
* Create the amq service for amd (both TCP and UDP)
*/
int
create_amq_service(int *udp_soAMQp, SVCXPRT **udp_amqpp, struct netconfig **dummy1, int *tcp_soAMQp, SVCXPRT **tcp_amqpp, struct netconfig **dummy2)
create_amq_service(int *udp_soAMQp, SVCXPRT **udp_amqpp,
struct netconfig **dummy1, int *tcp_soAMQp,
SVCXPRT **tcp_amqpp, struct netconfig **dummy2)
{
int maxrec = RPC_MAXDATASIZE;
@ -387,3 +414,45 @@ try_again:
(int) nfs_version, proto, host);
return nfs_version;
}
#if defined(HAVE_FS_AUTOFS) && defined(AUTOFS_PROG)
/*
* Register the autofs service for amd
*/
int
register_autofs_service(char *autofs_conftype, void (*autofs_dispatch)(struct svc_req *rqstp, SVCXPRT *transp))
{
int autofs_socket;
autofs_socket = socket(AF_INET, SOCK_DGRAM, 0);
if (autofs_socket < 0 || bind_resv_port(autofs_socket, NULL) < 0) {
plog(XLOG_FATAL, "Can't create privileged autofs port (socket)");
return 1;
}
if ((autofs_xprt = svcudp_create(autofs_socket)) == NULL) {
plog(XLOG_FATAL, "Can't create autofs rpc/udp service");
return 2;
}
if (autofs_xprt->xp_port >= IPPORT_RESERVED) {
plog(XLOG_FATAL, "Can't create privileged autofs port");
return 1;
}
if (!svc_register(autofs_xprt, AUTOFS_PROG, AUTOFS_VERS, autofs_dispatch, 0)) {
plog(XLOG_FATAL, "unable to register (%ld, %ld, 0)",
(u_long) AUTOFS_PROG, (u_long) AUTOFS_VERS);
return 3;
}
return 0; /* all is well */
}
int
unregister_autofs_service(char *autofs_conftype)
{
svc_unregister(AUTOFS_PROG, AUTOFS_VERS);
return 0;
}
#endif /* HAVE_FS_AUTOFS && AUTOFS_PROG */

View File

@ -1,7 +1,7 @@
\input texinfo @c -*-texinfo-*-
@c $NetBSD: am-utils.texi,v 1.4 2002/11/29 23:06:24 christos Exp $
@c $NetBSD: am-utils.texi,v 1.5 2003/03/09 01:38:43 christos Exp $
@c
@c Copyright (c) 1997-2002 Erez Zadok
@c Copyright (c) 1997-2003 Erez Zadok
@c Copyright (c) 1989 Jan-Simon Pendry
@c Copyright (c) 1989 Imperial College of Science, Technology & Medicine
@c Copyright (c) 1989 The Regents of the University of California.
@ -39,7 +39,7 @@
@c
@c %W% (Berkeley) %G%
@c
@c Id: am-utils.texi,v 1.49 2002/06/23 00:57:38 ezk Exp
@c Id: am-utils.texi,v 1.56 2003/01/25 01:39:41 ib42 Exp
@c
@setfilename am-utils.info
@ -62,7 +62,7 @@
(Originally by Jan-Simon Pendry and Nick Williams)
@page
Copyright @copyright{} 1997-2002 Erez Zadok
Copyright @copyright{} 1997-2003 Erez Zadok
@*
Copyright @copyright{} 1989 Jan-Simon Pendry
@*
@ -640,9 +640,6 @@ Although this action does not protect user files, which are unique on
the network, or processes which do not access files via @i{Amd} or
already have open files on the hung filesystem, it can prevent most new
processes from hanging.
By default, fileserver state is not maintained for NFS/TCP mounts. The
remote fileserver is always assumed to be up.
@c
@c With a suitable combination of filesystem management and mount-maps,
@c machines can be protected against most server downtime. This can be
@ -2381,16 +2378,6 @@ Allow keyboard interrupts on hard mounts.
@cindex Mount flags; lock
Use the NFS locking protocol (default)
@item loop
@cindex Mount flags; loop
Support loop device mounts for CDFS (currently only on Linux). With
this option, you can mount ISO-9660 files as if they were normal
CD-ROMs:
@example
sw71 type:=cdfs;addopts:=loop;dev:=/misc/rh71cd.iso;rfs:=/mnt/RPMS
@end example
@item multi
@cindex Mount flags; multi
Perform multi-component lookup on files.
@ -2600,19 +2587,32 @@ never expire. This is also the default for some filesystem types.
The interval, in seconds, between keep-alive pings. When four
consecutive pings have failed the mount point is marked as hung. This
interval defaults to 30 seconds. If the ping interval is less than zero,
no pings are sent and the host is assumed to be always
up. By default, pings are not sent for an NFS/TCP mount.
no pings are sent and the host is assumed to be always up, which can
cause umounts to hang. See the @i{softlookup} option for a better alternative.
@item retry=@var{n}
@cindex Mount flags; retry=@var{n}
The number of times to retry the mount system call.
@item softlookup
@cindex Mount flags; softlookup
Configures amd's behavior with respect to already-mounted shares from
NFS fileservers that are unreachable. If softlookup is specified,
trying to access such a share will result in an error (EIO, which is
changed from the ENOENT 6.0 used to return). If it is not specified, a
regular symlink is provided and the access will probably hang during
in the NFS filesystem.
The default behavior depends on whether the mount is 'soft' or 'hard';
softlookup can be used to change this default. This is changed from 6.0
which always behaved as if softlookup was specified.
@item utimeout=@var{n}
@cindex Mount flags; utimeout=@var{n}
The interval, in seconds, by which the mount's
time-to-live is extended after an unmount attempt
has failed. In fact the interval is extended before the unmount is
attempted to avoid thrashing. The default value is 120 seconds (two
attempted, to avoid thrashing. The default value is 120 seconds (two
minutes) or as set by the @code{-w} command line option.
@item xlatecookie
@ -2704,7 +2704,7 @@ forks into the background.
Note: Even if @i{Amd} has been built with @samp{-DDEBUG} (via
@code{configure --enable-debug}), it will still background itself and
disassociate itself from the controlling terminal. To use a debugger it
is necessary to specify @samp{-D nodaemon} on the command line.
is necessary to specify @samp{-D daemon} on the command line.
However, even with all of this, mounts and unmounts are performed in the
background, and @i{Amd} will always fork before doing them. Therefore,
debugging what happens closely during un/mounts is more challenging.
@ -2925,7 +2925,7 @@ amd -p > /var/run/amd.pid ...
@end example
This option only has an affect if @i{Amd} is running in daemon mode.
If @i{Amd} is started with the @code{-D nodaemon} debug flag, this
If @i{Amd} is started with the @code{-D daemon} debug flag, this
option is ignored.
@c ----------------------------------------------------------------
@ -3161,11 +3161,11 @@ can be prefixed with @samp{no} to turn it off.
@item all
all options
@item amq
register for amq
do not register for amq
@item daemon
enter daemon mode
do not enter daemon mode
@item fork
fork server
do not fork server
@item full
program trace
@item hrtime
@ -4393,6 +4393,7 @@ The following parameters are applicable to the @samp{[global]} section only.
* ldap_cache_maxmem Parameter::
* ldap_cache_seconds Parameter::
* ldap_hostports Parameter::
* ldap_proto_version Parameter::
* local_domain Parameter::
* log_file Parameter::
* log_options Parameter::
@ -4583,7 +4584,7 @@ should use to cache LDAP entries.
entries in the cache.
@c ----------------------------------------------------------------
@node ldap_hostports Parameter, local_domain Parameter, ldap_cache_seconds Parameter, Global Parameters
@node ldap_hostports Parameter, ldap_proto_version Parameter, ldap_cache_seconds Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{ldap_hostports} Parameter
@cindex ldap_hostports Parameter
@ -4592,7 +4593,16 @@ entries in the cache.
Specify the LDAP host and port values.
@c ----------------------------------------------------------------
@node local_domain Parameter, log_file Parameter, ldap_hostports Parameter, Global Parameters
@node ldap_proto_version Parameter, local_domain Parameter, ldap_hostports Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{ldap_proto_version} Parameter
@cindex ldap_proto_version Parameter
(type=numeric, default=2). Specify the LDAP protocol version to use.
With a value of 3 will use LDAPv3 protocol.
@c ----------------------------------------------------------------
@node local_domain Parameter, log_file Parameter, ldap_proto_version Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{local_domain} Parameter
@cindex local_domain Parameter

View File

@ -1,7 +1,7 @@
.\" $NetBSD: fixmount.8,v 1.5 2002/11/29 23:06:24 christos Exp $
.\" $NetBSD: fixmount.8,v 1.6 2003/03/09 01:38:45 christos Exp $
.\"
.\"
.\" Copyright (c) 1997-2002 Erez Zadok
.\" Copyright (c) 1997-2003 Erez Zadok
.\" Copyright (c) 1990 Jan-Simon Pendry
.\" Copyright (c) 1990 Imperial College of Science, Technology & Medicine
.\" Copyright (c) 1990 The Regents of the University of California.
@ -40,7 +40,7 @@
.\"
.\" %W% (Berkeley) %G%
.\"
.\" Id: fixmount.8,v 1.6 2002/01/07 07:36:31 ezk Exp
.\" Id: fixmount.8,v 1.7 2002/12/27 22:44:05 ezk Exp
.\"
.TH FIXMOUNT 8 "26 Feb 1993"
.SH NAME

View File

@ -1,7 +1,7 @@
/* $NetBSD: fsi_analyze.c,v 1.2 2002/12/06 03:50:35 thorpej Exp $ */
/* $NetBSD: fsi_analyze.c,v 1.3 2003/03/09 01:38:45 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: fsi_analyze.c,v 1.6 2002/02/02 20:59:02 ezk Exp
* Id: fsi_analyze.c,v 1.7 2002/12/27 22:44:06 ezk Exp
*
*/

View File

@ -1,8 +1,8 @@
/* $NetBSD: fsi_lex.l,v 1.4 2002/11/29 23:06:24 christos Exp $ */
/* $NetBSD: fsi_lex.l,v 1.5 2003/03/09 01:38:45 christos Exp $ */
%{
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@ -40,7 +40,7 @@
* SUCH DAMAGE.
*
*
* Id: fsi_lex.l,v 1.8 2002/02/02 20:59:02 ezk Exp
* Id: fsi_lex.l,v 1.9 2002/12/27 22:44:07 ezk Exp
*
*/

View File

@ -1,7 +1,7 @@
/* $NetBSD: fsi_util.c,v 1.6 2002/12/06 03:50:35 thorpej Exp $ */
/* $NetBSD: fsi_util.c,v 1.7 2003/03/09 01:38:45 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
*
* Id: fsi_util.c,v 1.7 2002/02/02 20:59:02 ezk Exp
* Id: fsi_util.c,v 1.8 2002/12/27 22:44:07 ezk Exp
*
*/

View File

@ -1,7 +1,7 @@
.\" $NetBSD: fsinfo.8,v 1.3 2002/11/29 23:06:25 christos Exp $
.\" $NetBSD: fsinfo.8,v 1.4 2003/03/09 01:38:46 christos Exp $
.\"
.\"
.\" Copyright (c) 1997-2002 Erez Zadok
.\" Copyright (c) 1997-2003 Erez Zadok
.\" Copyright (c) 1993 Jan-Simon Pendry.
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@ -35,7 +35,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)fsinfo.8 8.1 (Berkeley) 6/28/93
.\" Id: fsinfo.8,v 1.5 2002/01/07 07:36:32 ezk Exp
.\" Id: fsinfo.8,v 1.6 2002/12/27 22:44:07 ezk Exp
.\"
.TH FSINFO 8 "June 28, 1993"
.SH NAME

View File

@ -1,7 +1,7 @@
/* $NetBSD: fsinfo.c,v 1.6 2002/12/06 03:50:35 thorpej Exp $ */
/* $NetBSD: fsinfo.c,v 1.7 2003/03/09 01:38:46 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: fsinfo.c,v 1.9 2002/02/02 20:59:02 ezk Exp
* Id: fsinfo.c,v 1.10 2002/12/27 22:44:07 ezk Exp
*
*/

View File

@ -1,7 +1,7 @@
/* $NetBSD: fsinfo.h,v 1.5 2002/12/06 03:50:36 thorpej Exp $ */
/* $NetBSD: fsinfo.h,v 1.6 2003/03/09 01:38:46 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: fsinfo.h,v 1.8 2002/02/02 20:59:02 ezk Exp
* Id: fsinfo.h,v 1.9 2002/12/27 22:44:07 ezk Exp
*
*/

View File

@ -1,7 +1,7 @@
/* $NetBSD: wr_fstab.c,v 1.2 2002/12/06 03:50:36 thorpej Exp $ */
/* $NetBSD: wr_fstab.c,v 1.3 2003/03/09 01:38:46 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: wr_fstab.c,v 1.6 2002/02/02 20:59:03 ezk Exp
* Id: wr_fstab.c,v 1.7 2002/12/27 22:44:08 ezk Exp
*
*/

View File

@ -1,7 +1,7 @@
.\" $NetBSD: hlfsd.8,v 1.3 2002/11/29 23:06:25 christos Exp $
.\" $NetBSD: hlfsd.8,v 1.4 2003/03/09 01:38:46 christos Exp $
.\"
.\"
.\" Copyright (c) 1997-2002 Erez Zadok
.\" Copyright (c) 1997-2003 Erez Zadok
.\" Copyright (c) 1989 Jan-Simon Pendry
.\" Copyright (c) 1989 Imperial College of Science, Technology & Medicine
.\" Copyright (c) 1989 The Regents of the University of California.
@ -38,7 +38,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" Id: hlfsd.8,v 1.5 2002/01/07 07:36:32 ezk Exp
.\" Id: hlfsd.8,v 1.6 2002/12/27 22:44:08 ezk Exp
.\"
.\" HLFSD was written at Columbia University Computer Science Department, by
.\" Erez Zadok <ezk@cs.columbia.edu> and Alexander Dupuy <dupuy@smarts.com>

View File

@ -1,7 +1,7 @@
/* $NetBSD: hlfsd.c,v 1.5 2002/12/06 03:57:24 thorpej Exp $ */
/* $NetBSD: hlfsd.c,v 1.6 2003/03/09 01:38:47 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: hlfsd.c,v 1.18 2002/06/23 01:05:40 ib42 Exp
* Id: hlfsd.c,v 1.22 2002/12/27 22:44:08 ezk Exp
*
* HLFSD was written at Columbia University Computer Science Department, by
* Erez Zadok <ezk@cs.columbia.edu> and Alexander Dupuy <dupuy@cs.columbia.edu>
@ -311,10 +311,10 @@ main(int argc, char *argv[])
if (logfile)
switch_to_logfile(logfile, orig_umask);
#if defined(DEBUG) && !defined(MOUNT_TABLE_ON_FILE)
if (debug_flags & D_MTAB)
#ifndef MOUNT_TABLE_ON_FILE
if (amuDebug(D_MTAB))
dlog("-D mtab option ignored");
#endif /* defined(DEBUG) && !defined(MOUNT_TABLE_ON_FILE) */
#endif /* not MOUNT_TABLE_ON_FILE */
/* avoid hanging on other NFS servers if started elsewhere */
if (chdir("/") < 0)
@ -442,13 +442,11 @@ main(int argc, char *argv[])
signal(SIGCHLD, reaper);
#endif /* not HAVE_SIGACTION */
#ifdef DEBUG
/*
* In the parent, if -D nodaemon (or -D daemon) , we don't need to
* In the parent, if -D daemon, we don't need to
* set this signal handler.
*/
amuDebug(D_DAEMON) {
#endif /* DEBUG */
if (!amuDebug(D_DAEMON)) {
/* XXX: port to use pure svr4 signals */
s = -99;
while (stoplight != SIGUSR2) {
@ -456,9 +454,7 @@ main(int argc, char *argv[])
s = sigpause(0); /* wait for child to set up */
sleep(1);
}
#ifdef DEBUG
}
#endif /* DEBUG */
/*
* setup options to mount table (/etc/{mtab,mnttab}) entry
@ -572,26 +568,21 @@ main(int argc, char *argv[])
clock_valid = 0; /* invalidate logging clock */
/*
* The following code could be cleverly ifdef-ed, but I duplicated the
* mount_fs call three times for simplicity and readability.
*/
#ifdef DEBUG
/*
* For some reason, this mount may have to be done in the background, if I am
* using -D nodebug. I suspect that the actual act of mounting requires
* using -D daemon. I suspect that the actual act of mounting requires
* calling to hlfsd itself to invoke one or more of its nfs calls, to stat
* /mail. That means that even if you say -D nodaemon, at least the mount
* /mail. That means that even if you say -D daemon, at least the mount
* of hlfsd itself on top of /mail will be done in the background.
* The other alternative I have is to run svc_run, but set a special
* signal handler to perform the mount in N seconds via some alarm.
* -Erez Zadok.
*/
amuDebug(D_DAEMON) { /* asked for -D daemon */
plog(XLOG_INFO, "parent NFS mounting hlfsd service points");
if (!amuDebug(D_DAEMON)) { /* Normal case */
plog(XLOG_INFO, "normal NFS mounting hlfsd service points");
if (mount_fs2(&mnt, dir_name, genflags, (caddr_t) &nfs_args, retry, type, 0, NULL, mnttab_file_name) < 0)
fatal("nfsmount: %m");
} else { /* asked for -D nodaemon */
} else { /* asked for -D daemon */
if (fork() == 0) { /* child runs mount */
am_set_mypid();
foreground = 0;
@ -604,11 +595,6 @@ main(int argc, char *argv[])
plog(XLOG_INFO, "parent waiting 1sec for mount...");
}
}
#else /* not DEBUG */
plog(XLOG_INFO, "normal NFS mounting hlfsd service points");
if (mount_fs2(&mnt, dir_name, genflags, (caddr_t) &nfs_args, retry, type, 2, "udp", mnttab_file_name) < 0)
fatal("nfsmount: %m");
#endif /* not DEBUG */
#ifdef HAVE_TRANSPORT_TYPE_TLI
/*
@ -627,12 +613,13 @@ main(int argc, char *argv[])
plog(XLOG_INFO, "hlfsd ready to serve");
/*
* If asked not to fork a daemon (-D nodaemon), then hlfsd_init()
* If asked not to fork a daemon (-D daemon), then hlfsd_init()
* will not run svc_run. We must start svc_run here.
*/
dlog("starting no-daemon debugging svc_run");
amuDebugNo(D_DAEMON)
if (amuDebug(D_DAEMON)) {
plog(XLOG_DEBUG, "starting no-daemon debugging svc_run");
svc_run();
}
cleanup(0); /* should never happen here */
return (0); /* everything went fine? */
@ -655,12 +642,10 @@ hlfsd_init(void)
plog(XLOG_INFO, "initializing hlfsd file handles");
hlfsd_init_filehandles();
#ifdef DEBUG
/*
* If -D daemon then we must fork.
* If not -D daemon then we must fork.
*/
amuDebug(D_DAEMON)
#endif /* DEBUG */
if (!amuDebug(D_DAEMON))
child = fork();
if (child < 0)
@ -757,15 +742,12 @@ hlfsd_init(void)
startup.nt_useconds = (u_int) start_time.tv_usec;
}
#ifdef DEBUG
/*
* If -D daemon, then start serving here in the child,
* and the parent will exit. But if -D nodaemon, then
* If not -D daemon, then start serving here in the child,
* and the parent will exit. But if -D daemon, then
* skip this code and make sure svc_run is entered elsewhere.
*/
amuDebug(D_DAEMON) {
#endif /* DEBUG */
if (!amuDebug(D_DAEMON)) {
/*
* Dissociate from the controlling terminal
*/
@ -780,9 +762,7 @@ hlfsd_init(void)
plog(XLOG_INFO, "starting svc_run");
svc_run();
cleanup(0); /* should never happen, just in case */
#ifdef DEBUG
} /* end of code that runs iff hlfsd daemonizes */
#endif /* DEBUG */
}
}
@ -855,27 +835,21 @@ cleanup(int signum)
clock_valid = 0; /* invalidate logging clock */
#ifdef DEBUG
amuDebug(D_DAEMON)
#endif /* DEBUG */
if (!amuDebug(D_DAEMON)) {
if (getpid() != masterpid)
return;
return;
#ifdef DEBUG
amuDebug(D_DAEMON)
#endif /* DEBUG */
if (fork() != 0) {
masterpid = 0;
am_set_mypid();
return;
masterpid = 0;
am_set_mypid();
return;
}
}
am_set_mypid();
for (;;) {
while ((umount_result = UMOUNT_FS(dir_name, dir_name, mnttab_file_name)) == EBUSY) {
#ifdef DEBUG
dlog("cleanup(): umount delaying for 10 seconds");
#endif /* DEBUG */
sleep(10);
}
if (stat(dir_name, &stbuf) == 0 && stbuf.st_ino == ROOTID) {
@ -887,16 +861,11 @@ cleanup(int signum)
break;
}
#ifdef DEBUG
dlog("cleanup(): killing processes and terminating");
amuDebug(D_DAEMON)
#endif /* DEBUG */
if (!amuDebug(D_DAEMON)) {
plog(XLOG_INFO, "cleanup(): killing processes and terminating");
kill(masterpid, SIGKILL);
#ifdef DEBUG
amuDebug(D_DAEMON)
#endif /* DEBUG */
kill(serverpid, SIGKILL);
}
plog(XLOG_INFO, "hlfsd terminating with status 0\n");
exit(0);
@ -943,17 +912,8 @@ fatal(char *mess)
strcpy(lessmess, mess);
lessmess[messlen - 4] = '\0';
if (errno < sys_nerr)
fprintf(stderr, "%s: %s: %s\n", am_get_progname(), lessmess,
#ifdef HAVE_STRERROR
strerror(errno)
#else /* not HAVE_STRERROR */
sys_errlist[errno]
#endif /* not HAVE_STRERROR */
);
else
fprintf(stderr, "%s: %s: Error %d\n",
am_get_progname(), lessmess, errno);
fprintf(stderr, "%s: %s: %s\n",
am_get_progname(), lessmess, strerror(errno));
}
}
plog(XLOG_FATAL, "%s", mess);

View File

@ -1,7 +1,7 @@
/* $NetBSD: hlfsd.h,v 1.3 2002/11/29 23:06:25 christos Exp $ */
/* $NetBSD: hlfsd.h,v 1.4 2003/03/09 01:38:47 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: hlfsd.h,v 1.10 2002/02/02 20:59:03 ezk Exp
* Id: hlfsd.h,v 1.12 2002/12/27 22:44:08 ezk Exp
*
* HLFSD was written at Columbia University Computer Science Department, by
* Erez Zadok <ezk@cs.columbia.edu> and Alexander Dupuy <dupuy@cs.columbia.edu>

View File

@ -1,7 +1,7 @@
/* $NetBSD: am_defs.h,v 1.3 2002/11/29 23:06:25 christos Exp $ */
/* $NetBSD: am_defs.h,v 1.4 2003/03/09 01:38:48 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: am_defs.h,v 1.30 2002/06/23 01:05:40 ib42 Exp
* Id: am_defs.h,v 1.37 2003/01/23 21:24:29 ib42 Exp
*
*/
@ -106,6 +106,15 @@ char *strchr(), *strrchr(), *strdup();
*/
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# ifdef _ALL_SOURCE
/*
* AIX 5.2 needs struct sigevent from signal.h to be defined, but I
* don't want to move the inclusion of signal.h this early into this
* file. Luckily, amd doesn't need the size of this structure in any
* other structure that it uses. So we sidestep it for now.
*/
struct sigevent;
# endif /* _ALL_SOURCE */
# include <time.h>
#else /* not TIME_WITH_SYS_TIME */
# if HAVE_SYS_TIME_H
@ -357,6 +366,13 @@ extern int errno;
# include <net/errno.h>
#endif /* HAVE_NET_ERRNO_H */
/*
* Actions to take if <net/if.h> exists.
*/
#ifdef HAVE_NET_IF_H
# include <net/if.h>
#endif /* HAVE_NET_IF_H */
/*
* Actions to take if <net/route.h> exists.
*/
@ -390,13 +406,6 @@ extern int errno;
# endif /* MFREE */
#endif /* HAVE_SYS_MBUF_H */
/*
* Actions to take if <net/if.h> exists.
*/
#ifdef HAVE_NET_IF_H
# include <net/if.h>
#endif /* HAVE_NET_IF_H */
/*
* Actions to take if <sys/mman.h> exists.
*/
@ -1467,8 +1476,14 @@ extern bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *auth);
* and those are probably declared in any of the above headers.
*/
#ifndef HAVE_HASMNTOPT
extern char *hasmntopt(mntent_t *mnt, char *opt);
#ifdef HAVE_HASMNTOPT
# ifdef HAVE_BAD_HASMNTOPT
extern char *amu_hasmntopt(mntent_t *mnt, char *opt);
# else /* not HAVE_BAD_HASMNTOPT */
# define amu_hasmntopt hasmntopt
# endif /* not HAVE_BAD_HASMNTOPT */
#else /* not HAVE_HASMNTOPT */
extern char *amu_hasmntopt(mntent_t *mnt, char *opt);
#endif /* not HAVE_HASMNTOPT */
/*

View File

@ -1,7 +1,7 @@
/* $NetBSD: am_utils.h,v 1.5 2002/11/29 23:14:04 christos Exp $ */
/* $NetBSD: am_utils.h,v 1.6 2003/03/09 01:38:48 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: am_utils.h,v 1.40 2002/06/23 01:05:40 ib42 Exp
* Id: am_utils.h,v 1.45 2002/12/27 22:44:09 ezk Exp
*
*/
@ -209,6 +209,7 @@ extern int umount_fs(char *mntdir, const char *mnttabname);
#define AMF_ROOT 0x0002 /* This is a root node */
#define AMF_AUTOFS 0x0004 /* This node is part of an autofs filesystem */
#define AMF_REMOUNT 0x0008 /* This node needs to be remounted */
#define AMF_SOFTLOOKUP 0x0010 /* This node returns EIO if server is down */
/*
* The following values can be tuned...
@ -576,6 +577,7 @@ extern am_node *find_mf(mntfs *);
extern am_node *next_map(int *);
extern am_node *root_ap(char *, int);
extern am_ops *ops_match(am_opts *, char *, char *, char *, char *, char *);
extern am_ops *ops_search(char *);
extern bool_t xdr_amq_string(XDR *xdrs, amq_string *objp);
extern bool_t xdr_dirpath(XDR *xdrs, dirpath *objp);
extern char **strsplit(char *, int, int);
@ -721,6 +723,11 @@ extern int get_knetconfig(struct knetconfig **kncpp, struct netconfig *in_ncp, c
extern struct netconfig *nfsncp;
extern void free_knetconfig(struct knetconfig *kncp);
#ifdef HAVE_FS_AUTOFS
extern int register_autofs_service(char *autofs_conftype, void (*autofs_dispatch)(struct svc_req *, SVCXPRT *));
extern int unregister_autofs_service(char *autofs_conftype);
#endif /* HAVE_FS_AUTOFS */
#else /* not HAVE_TRANSPORT_TYPE_TLI */
extern enum clnt_stat pmap_ping(struct sockaddr_in *address);
@ -923,35 +930,33 @@ extern am_ops amfs_union_ops; /* Union FS */
*/
#ifdef DEBUG
# define D_ALL (~(D_MTAB|D_HRTIME))
# define D_DAEMON 0x0001 /* Enter daemon mode */
# define D_ALL (~(D_MTAB|D_HRTIME|D_DAEMON|D_FORK|D_AMQ))
# define D_DAEMON 0x0001 /* Don't enter daemon mode */
# define D_TRACE 0x0002 /* Do protocol trace */
# define D_FULL 0x0004 /* Do full trace */
# define D_MTAB 0x0008 /* Use local mtab */
# define D_AMQ 0x0010 /* Register amq program */
# define D_AMQ 0x0010 /* Don't register amq program */
# define D_STR 0x0020 /* Debug string munging */
# ifdef DEBUG_MEM
# define D_MEM 0x0040 /* Trace memory allocations */
# endif /* DEBUG_MEM */
# define D_FORK 0x0080 /* Fork server */
# ifdef DEBUG_MEM
# define D_MEM 0x0040 /* Trace memory allocations */
# else
# define D_MEM 0x0000 /* Dummy */
# endif /* DEBUG_MEM */
# define D_FORK 0x0080 /* Don't fork server */
/* info service specific debugging (hesiod, nis, etc) */
# define D_INFO 0x0100
# define D_HRTIME 0x0200 /* Print high resolution time stamps */
# define D_XDRTRACE 0x0400 /* Trace xdr routines */
# define D_READDIR 0x0800 /* show browsable_dir progress */
# define D_READDIR 0x0800 /* Show browsable_dir progress */
/*
* Normally, don't enter daemon mode, don't register amq, and don't trace xdr
* Test mode is test mode: don't daemonize, don't register amq, don't fork,
* don't touch system mtab, etc.
*/
# ifdef DEBUG_MEM
# define D_TEST (~(D_DAEMON|D_MEM|D_STR|D_XDRTRACE))
# else /* not DEBUG_MEM */
# define D_TEST (~(D_DAEMON|D_STR|D_XDRTRACE))
# endif /* not DEBUG_MEM */
# define D_TEST (~(D_MEM|D_STR|D_XDRTRACE))
# define amuDebug(x) if (debug_flags & (x))
# define dlog amuDebug(D_FULL) dplog
# define amuDebugNo(x) if (!(debug_flags & (x)))
# define amuDebug(x) (debug_flags & (x))
# define dlog if (amuDebug(D_FULL)) dplog
/* debugging mount-table file to use */
# ifndef DEBUG_MNTTAB
@ -986,9 +991,8 @@ extern int debug_option (char *opt);
*/
# define XFREE(x) free(x)
#define amuDebug(x) if (0)
#define amuDebug(x) (0)
#define dlog if (0) dplog
#define amuDebugNo(x) if (0)
#define print_nfs_args(nap, nfs_version)
#define debug_option(x) (1)

View File

@ -1,7 +1,7 @@
/* $NetBSD: amq_defs.h,v 1.5 2002/11/29 23:06:26 christos Exp $ */
/* $NetBSD: amq_defs.h,v 1.6 2003/03/09 01:38:48 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: amq_defs.h,v 1.7 2002/02/02 20:59:04 ezk Exp
* Id: amq_defs.h,v 1.8 2002/12/27 22:44:09 ezk Exp
*
*/

View File

@ -1,7 +1,7 @@
/* $NetBSD: hasmntopt.c,v 1.3 2002/11/29 23:06:26 christos Exp $ */
/* $NetBSD: hasmntopt.c,v 1.4 2003/03/09 01:38:49 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@ -39,7 +39,7 @@ n * modification, are permitted provided that the following conditions
* SUCH DAMAGE.
*
*
* Id: hasmntopt.c,v 1.6 2002/02/02 20:59:04 ezk Exp
* Id: hasmntopt.c,v 1.9 2002/12/27 22:44:10 ezk Exp
*
*/
@ -70,7 +70,7 @@ nextmntopt(char **p)
/*
* Skip past white space
*/
while (*cp && isspace(*cp))
while (*cp && isspace((int) *cp))
cp++;
/*
@ -103,7 +103,7 @@ nextmntopt(char **p)
* replacement for hasmntopt if the system does not have it.
*/
char *
hasmntopt(mntent_t *mnt, char *opt)
amu_hasmntopt(mntent_t *mnt, char *opt)
{
char t[MNTMAXSTR];
char *f;

View File

@ -1,7 +1,7 @@
/* $NetBSD: misc_rpc.c,v 1.2 2002/12/06 03:57:44 thorpej Exp $ */
/* $NetBSD: misc_rpc.c,v 1.3 2003/03/09 01:38:49 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: misc_rpc.c,v 1.7 2002/02/02 20:59:04 ezk Exp
* Id: misc_rpc.c,v 1.10 2002/12/29 00:46:31 ib42 Exp
*
*/
@ -128,6 +128,13 @@ make_rpc_packet(char *buf, int buflen, u_long proc, struct rpc_msg *mp, voidp ar
{
XDR msg_xdr;
int len;
/*
* Never cast pointers between different integer types, it breaks badly
* on big-endian platforms if those types have different sizes.
*
* Cast to a local variable instead, and use that variable's address.
*/
enum_t local_proc = (enum_t) proc;
xdrmem_create(&msg_xdr, buf, buflen, XDR_ENCODE);
@ -140,7 +147,7 @@ make_rpc_packet(char *buf, int buflen, u_long proc, struct rpc_msg *mp, voidp ar
/*
* Called procedure number
*/
if (!xdr_enum(&msg_xdr, (void *) & proc))
if (!xdr_enum(&msg_xdr, &local_proc))
return -EIO;
/*

View File

@ -1,7 +1,7 @@
/* $NetBSD: mount_fs.c,v 1.6 2002/11/29 23:06:26 christos Exp $ */
/* $NetBSD: mount_fs.c,v 1.7 2003/03/09 01:38:49 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: mount_fs.c,v 1.26 2002/06/23 01:05:41 ib42 Exp
* Id: mount_fs.c,v 1.31 2003/01/23 21:24:29 ib42 Exp
*
*/
@ -139,7 +139,7 @@ compute_mount_flags(mntent_t *mntp)
* before and left the machine hung). This will allow a new amd or
* hlfsd to be remounted on top of another one.
*/
if (hasmntopt(mntp, MNTTAB_OPT_OVERLAY)) {
if (amu_hasmntopt(mntp, MNTTAB_OPT_OVERLAY)) {
flags |= MNT2_GEN_OPT_OVERLAY;
plog(XLOG_INFO, "using an overlay mount");
}
@ -150,7 +150,7 @@ compute_mount_flags(mntent_t *mntp)
* Crack basic mount options
*/
for (opt = mnt_flags; opt->opt; opt++) {
flags |= hasmntopt(mntp, opt->opt) ? opt->flag : 0;
flags |= amu_hasmntopt(mntp, opt->opt) ? opt->flag : 0;
}
return flags;
@ -200,10 +200,8 @@ mount_fs2(mntent_t *mnt, char *real_mntdir, int flags, caddr_t mnt_data, int ret
old_mnt_dir = mnt->mnt_dir;
mnt->mnt_dir = real_mntdir;
amuDebug(D_FULL) {
dlog("'%s' fstype " MTYPE_PRINTF_TYPE " (%s) flags %#x (%s)",
mnt->mnt_dir, type, mnt->mnt_type, flags, mnt->mnt_opts);
}
dlog("'%s' fstype " MTYPE_PRINTF_TYPE " (%s) flags %#x (%s)",
mnt->mnt_dir, type, mnt->mnt_type, flags, mnt->mnt_opts);
again:
clock_valid = 0;
@ -303,7 +301,7 @@ again:
* add the extra proto={tcp,udp} field to the mount table,
* unless already specified by user.
*/
if (nfs_proto && !hasmntopt(mnt, MNTTAB_OPT_PROTO)) {
if (nfs_proto && !amu_hasmntopt(mnt, MNTTAB_OPT_PROTO)) {
sprintf(optsbuf, "%s=%s", MNTTAB_OPT_PROTO, nfs_proto);
append_opts(zopts, optsbuf);
}
@ -321,7 +319,7 @@ again:
# endif /* HAVE_MNTENT_T_MNT_CNODE */
# ifdef HAVE_MNTENT_T_MNT_RO
mnt->mnt_ro = (hasmntopt(mnt, MNTTAB_OPT_RO) != NULL);
mnt->mnt_ro = (amu_hasmntopt(mnt, MNTTAB_OPT_RO) != NULL);
# endif /* HAVE_MNTENT_T_MNT_RO */
# ifdef HAVE_MNTENT_T_MNT_TIME
@ -493,7 +491,7 @@ compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct netconfig
#endif /* MNT2_NFS_OPT_ACDIRMAX */
#ifdef MNTTAB_OPT_NOAC /* don't cache attributes */
if (hasmntopt(mntp, MNTTAB_OPT_NOAC) != NULL)
if (amu_hasmntopt(mntp, MNTTAB_OPT_NOAC) != NULL)
nap->flags |= MNT2_NFS_OPT_NOAC;
#endif /* MNTTAB_OPT_NOAC */
@ -551,9 +549,9 @@ compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct netconfig
/************************************************************************/
#ifdef MNT2_NFS_OPT_NOCONN
/* check if user specified to use unconnected or connected sockets */
if (hasmntopt(mntp, MNTTAB_OPT_NOCONN) != NULL)
if (amu_hasmntopt(mntp, MNTTAB_OPT_NOCONN) != NULL)
nap->flags |= MNT2_NFS_OPT_NOCONN;
else if (hasmntopt(mntp, MNTTAB_OPT_CONN) != NULL)
else if (amu_hasmntopt(mntp, MNTTAB_OPT_CONN) != NULL)
nap->flags &= ~MNT2_NFS_OPT_NOCONN;
else {
/*
@ -581,7 +579,7 @@ compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct netconfig
#ifdef MNT2_NFS_OPT_RESVPORT
# ifdef MNTTAB_OPT_RESVPORT
if (hasmntopt(mntp, MNTTAB_OPT_RESVPORT) != NULL)
if (amu_hasmntopt(mntp, MNTTAB_OPT_RESVPORT) != NULL)
nap->flags |= MNT2_NFS_OPT_RESVPORT;
# else /* not MNTTAB_OPT_RESVPORT */
nap->flags |= MNT2_NFS_OPT_RESVPORT;
@ -643,11 +641,11 @@ compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct netconfig
nap->flags |= MNT2_NFS_OPT_BIODS;
#endif /* MNT2_NFS_OPT_BIODS */
if (hasmntopt(mntp, MNTTAB_OPT_SOFT) != NULL)
if (amu_hasmntopt(mntp, MNTTAB_OPT_SOFT) != NULL)
nap->flags |= MNT2_NFS_OPT_SOFT;
#ifdef MNT2_NFS_OPT_SPONGY
if (hasmntopt(mntp, MNTTAB_OPT_SPONGY) != NULL) {
if (amu_hasmntopt(mntp, MNTTAB_OPT_SPONGY) != NULL) {
nap->flags |= MNT2_NFS_OPT_SPONGY;
if (nap->flags & MNT2_NFS_OPT_SOFT) {
plog(XLOG_USER, "Mount opts soft and spongy are incompatible - soft ignored");
@ -663,7 +661,7 @@ compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct netconfig
#endif /* defined(MNT2_GEN_OPT_RONLY) && defined(MNT2_NFS_OPT_RONLY) */
#ifdef MNTTAB_OPT_INTR
if (hasmntopt(mntp, MNTTAB_OPT_INTR) != NULL)
if (amu_hasmntopt(mntp, MNTTAB_OPT_INTR) != NULL)
/*
* Either turn on the "allow interrupts" option, or
* turn off the "disallow interrupts" option"
@ -683,17 +681,17 @@ compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct netconfig
#endif /* MNTTAB_OPT_INTR */
#ifdef MNTTAB_OPT_NODEVS
if (hasmntopt(mntp, MNTTAB_OPT_NODEVS) != NULL)
if (amu_hasmntopt(mntp, MNTTAB_OPT_NODEVS) != NULL)
nap->flags |= MNT2_NFS_OPT_NODEVS;
#endif /* MNTTAB_OPT_NODEVS */
#ifdef MNTTAB_OPT_COMPRESS
if (hasmntopt(mntp, MNTTAB_OPT_COMPRESS) != NULL)
if (amu_hasmntopt(mntp, MNTTAB_OPT_COMPRESS) != NULL)
nap->flags |= MNT2_NFS_OPT_COMPRESS;
#endif /* MNTTAB_OPT_COMPRESS */
#ifdef MNTTAB_OPT_PRIVATE /* mount private, single-client tree */
if (hasmntopt(mntp, MNTTAB_OPT_PRIVATE) != NULL)
if (amu_hasmntopt(mntp, MNTTAB_OPT_PRIVATE) != NULL)
nap->flags |= MNT2_NFS_OPT_PRIVATE;
#endif /* MNTTAB_OPT_PRIVATE */
@ -708,19 +706,19 @@ compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct netconfig
#endif /* MNT2_NFS_OPT_PGTHRESH */
#if defined(MNT2_NFS_OPT_NOCTO) && defined(MNTTAB_OPT_NOCTO)
if (hasmntopt(mntp, MNTTAB_OPT_NOCTO) != NULL)
if (amu_hasmntopt(mntp, MNTTAB_OPT_NOCTO) != NULL)
nap->flags |= MNT2_NFS_OPT_NOCTO;
#endif /* defined(MNT2_NFS_OPT_NOCTO) && defined(MNTTAB_OPT_NOCTO) */
#if defined(MNT2_NFS_OPT_POSIX) && defined(MNTTAB_OPT_POSIX)
if (hasmntopt(mntp, MNTTAB_OPT_POSIX) != NULL) {
if (amu_hasmntopt(mntp, MNTTAB_OPT_POSIX) != NULL) {
nap->flags |= MNT2_NFS_OPT_POSIX;
nap->pathconf = NULL;
}
#endif /* MNT2_NFS_OPT_POSIX && MNTTAB_OPT_POSIX */
#if defined(MNT2_NFS_OPT_PROPLIST) && defined(MNTTAB_OPT_PROPLIST)
if (hasmntopt(mntp, MNTTAB_OPT_PROPLIST) != NULL)
if (amu_hasmntopt(mntp, MNTTAB_OPT_PROPLIST) != NULL)
nap->flags |= MNT2_NFS_OPT_PROPLIST;
#endif /* defined(MNT2_NFS_OPT_PROPLIST) && defined(MNTTAB_OPT_PROPLIST) */
@ -731,12 +729,12 @@ compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct netconfig
#endif /* defined(MNT2_NFS_OPT_MAXGRPS) && defined(MNTTAB_OPT_MAXGROUPS) */
#if defined(MNT2_NFS_OPT_NONLM) && defined(MNTTAB_OPT_NOLOCK)
if (hasmntopt(mntp, MNTTAB_OPT_NOLOCK) != NULL)
if (amu_hasmntopt(mntp, MNTTAB_OPT_NOLOCK) != NULL)
nap->flags |= MNT2_NFS_OPT_NONLM;
#endif /* defined(MNT2_NFS_OPT_NONLM) && defined(MNTTAB_OPT_NOLOCK) */
#if defined(MNT2_NFS_OPT_XLATECOOKIE) && defined(MNTTAB_OPT_XLATECOOKIE)
if (hasmntopt(mntp, MNTTAB_OPT_XLATECOOKIE) != NULL)
if (amu_hasmntopt(mntp, MNTTAB_OPT_XLATECOOKIE) != NULL)
nap->flags |= MNT2_NFS_OPT_XLATECOOKIE;
#endif /* defined(MNT2_NFS_OPT_XLATECOOKIE) && defined(MNTTAB_OPT_XLATECOOKIE) */

View File

@ -1,7 +1,7 @@
/* $NetBSD: wire.c,v 1.5 2002/11/29 23:06:26 christos Exp $ */
/* $NetBSD: wire.c,v 1.6 2003/03/09 01:38:49 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: wire.c,v 1.17 2002/02/02 20:59:05 ezk Exp
* Id: wire.c,v 1.18 2002/12/27 22:44:11 ezk Exp
*
*/

View File

@ -1,7 +1,7 @@
/* $NetBSD: xutil.c,v 1.6 2002/11/29 23:06:26 christos Exp $ */
/* $NetBSD: xutil.c,v 1.7 2003/03/09 01:38:50 christos Exp $ */
/*
* Copyright (c) 1997-2002 Erez Zadok
* Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
*
* Id: xutil.c,v 1.23 2002/06/23 01:05:41 ib42 Exp
* Id: xutil.c,v 1.29 2002/12/28 22:28:57 ib42 Exp
*
*/
@ -90,23 +90,21 @@ static void real_plog(int lvl, const char *fmt, va_list vargs)
*/
struct opt_tab dbg_opt[] =
{
{"all", D_ALL}, /* All */
{"amq", D_AMQ}, /* Register for AMQ program */
{"daemon", D_DAEMON}, /* Enter daemon mode */
{"fork", D_FORK}, /* Fork server (nofork = don't fork) */
{"all", D_ALL}, /* All non-disruptive options */
{"amq", D_AMQ}, /* Don't register for AMQ program */
{"daemon", D_DAEMON}, /* Don't enter daemon mode */
{"fork", D_FORK}, /* Don't fork server */
{"full", D_FULL}, /* Program trace */
#ifdef HAVE_CLOCK_GETTIME
{"hrtime", D_HRTIME}, /* Print high resolution time stamps */
#endif /* HAVE_CLOCK_GETTIME */
/* info service specific debugging (hesiod, nis, etc) */
{"info", D_INFO},
# ifdef DEBUG_MEM
{"mem", D_MEM}, /* Trace memory allocations */
# endif /* DEBUG_MEM */
{"mtab", D_MTAB}, /* Use local mtab file */
{"readdir", D_READDIR}, /* check on browsable_dirs progress */
{"readdir", D_READDIR}, /* Check on browsable_dirs progress */
{"str", D_STR}, /* Debug string munging */
{"test", D_TEST}, /* Full debug - but no daemon */
{"test", D_TEST}, /* Full debug - no daemon, no amq, local mtab */
{"trace", D_TRACE}, /* Protocol trace */
{"xdrtrace", D_XDRTRACE}, /* Trace xdr routines */
{0, 0}
@ -186,10 +184,8 @@ xmalloc(int len)
do {
p = (voidp) malloc((unsigned) len);
if (p) {
#if defined(DEBUG) && defined(DEBUG_MEM)
amuDebug(D_MEM)
plog(XLOG_DEBUG, "Allocated size %d; block %#x", len, p);
#endif /* defined(DEBUG) && defined(DEBUG_MEM) */
if (amuDebug(D_MEM))
plog(XLOG_DEBUG, "Allocated size %d; block %p", len, p);
return p;
}
if (retries > 0) {
@ -222,10 +218,8 @@ xzalloc(int len)
voidp
xrealloc(voidp ptr, int len)
{
#if defined(DEBUG) && defined(DEBUG_MEM)
amuDebug(D_MEM)
plog(XLOG_DEBUG, "Reallocated size %d; block %#x", len, ptr);
#endif /* defined(DEBUG) && defined(DEBUG_MEM) */
if (amuDebug(D_MEM))
plog(XLOG_DEBUG, "Reallocated size %d; block %p", len, ptr);
if (len == 0)
len = 1;
@ -244,20 +238,18 @@ xrealloc(voidp ptr, int len)
}
#if defined(DEBUG) && defined(DEBUG_MEM)
#ifdef DEBUG_MEM
void
dxfree(char *file, int line, voidp ptr)
{
amuDebug(D_MEM)
if (amuDebug(D_MEM))
plog(XLOG_DEBUG, "Free in %s:%d: block %#x", file, line, ptr);
/* this is the only place that must NOT use XFREE()!!! */
free(ptr);
ptr = NULL; /* paranoid */
}
#endif /* defined(DEBUG) && defined(DEBUG_MEM) */
#ifdef DEBUG_MEM
static void
checkup_mem(void)
{
@ -291,15 +283,6 @@ checkup_mem(void)
static const char *
expand_error(const char *f, char *e, int maxlen)
{
#ifndef HAVE_STRERROR
/*
* XXX: we are assuming that if a system doesn't has strerror,
* then it has sys_nerr. If this assumption turns out to be wrong on
* some systems, we'll have to write a separate test to detect if
* a system has sys_nerr. -Erez
*/
extern int sys_nerr;
#endif /* not HAVE_STRERROR */
const char *p;
char *q;
int error = errno;
@ -307,23 +290,7 @@ expand_error(const char *f, char *e, int maxlen)
for (p = f, q = e; (*q = *p) && len < maxlen; len++, q++, p++) {
if (p[0] == '%' && p[1] == 'm') {
const char *errstr;
#ifdef HAVE_STRERROR
if (error < 0)
#else /* not HAVE_STRERROR */
if (error < 0 || error >= sys_nerr)
#endif /* not HAVE_STRERROR */
errstr = NULL;
else
#ifdef HAVE_STRERROR
errstr = strerror(error);
#else /* not HAVE_STRERROR */
errstr = sys_errlist[error];
#endif /* not HAVE_STRERROR */
if (errstr)
strcpy(q, errstr);
else
sprintf(q, "Error %d", error);
strcpy(q, strerror(error));
len += strlen(q) - 1;
q += strlen(q) - 1;
p++;
@ -356,7 +323,7 @@ show_time_host_and_name(int lvl)
*/
if (clock_gettime(CLOCK_REALTIME, &ts) == 0) {
t = ts.tv_sec;
amuDebug(D_HRTIME)
if (amuDebug(D_HRTIME))
sprintf(nsecs, ".%09ld", ts.tv_nsec);
}
else
@ -853,9 +820,7 @@ switch_to_logfile(char *logfile, int old_umask)
void
unregister_amq(void)
{
#ifdef DEBUG
amuDebug(D_AMQ)
#endif /* DEBUG */
if (!amuDebug(D_AMQ))
/* find which instance of amd to unregister */
pmap_unset(get_amd_program_number(), AMQ_VERSION);
}
@ -915,24 +880,14 @@ amu_release_controlling_tty(void)
#endif /* TIOCNOTTY */
int tempfd;
#ifdef HAVE_SETSID
/* XXX: one day maybe use vhangup(2) */
if (setsid() < 0) {
plog(XLOG_WARNING, "Could not release controlling tty using setsid(): %m");
} else {
plog(XLOG_INFO, "released controlling tty using setsid()");
return;
}
#endif /* HAVE_SETSID */
/*
* In daemon mode, leaving open file descriptors to terminals or pipes
* can be a really bad idea.
* Case in point: the redhat startup script calls us through their 'initlog'
* program, which exits as soon as the original amd process exits. If, at some
* point, a misbehaved library function decides to print something to the screen,
* we get a SIGPIPE and die.
* More precisely: NIS libc functions will attempt to print to stderr
* program, which exits as soon as the original amd process exits. If,
* at some point, a misbehaved library function decides to print something
* to the screen, we get a SIGPIPE and die.
* And guess what: NIS glibc functions will attempt to print to stderr
* "YPBINDPROC_DOMAIN: Domain not bound" if ypbind is running but can't find
* a ypserver.
*
@ -947,6 +902,16 @@ amu_release_controlling_tty(void)
fflush(stderr); close(2); dup2(tempfd, 2);
close(tempfd);
#ifdef HAVE_SETSID
/* XXX: one day maybe use vhangup(2) */
if (setsid() < 0) {
plog(XLOG_WARNING, "Could not release controlling tty using setsid(): %m");
} else {
plog(XLOG_INFO, "released controlling tty using setsid()");
return;
}
#endif /* HAVE_SETSID */
#ifdef TIOCNOTTY
fd = open("/dev/tty", O_RDWR);
if (fd < 0) {

View File

@ -1,7 +1,7 @@
.\" $NetBSD: mk-amd-map.8,v 1.3 2002/11/29 23:06:26 christos Exp $
.\" $NetBSD: mk-amd-map.8,v 1.4 2003/03/09 01:38:50 christos Exp $
.\"
.\"
.\" Copyright (c) 1997-2002 Erez Zadok
.\" Copyright (c) 1997-2003 Erez Zadok
.\" Copyright (c) 1993 Jan-Simon Pendry
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@ -35,7 +35,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)mk-amd-map.8 8.1 (Berkeley) 6/28/93
.\" Id: mk-amd-map.8,v 1.5 2002/01/07 07:36:35 ezk Exp
.\" Id: mk-amd-map.8,v 1.6 2002/12/27 22:44:12 ezk Exp
.\"
.TH MK-AMD-MAP 8 "June 28, 1993"
.SH NAME

View File

@ -1,7 +1,7 @@
.\" $NetBSD: amd.conf.5,v 1.6 2002/11/29 23:06:27 christos Exp $
.\" $NetBSD: amd.conf.5,v 1.7 2003/03/09 01:38:51 christos Exp $
.\"
.\"
.\" Copyright (c) 1997-2002 Erez Zadok
.\" Copyright (c) 1997-2003 Erez Zadok
.\" Copyright (c) 1990 Jan-Simon Pendry
.\" Copyright (c) 1990 Imperial College of Science, Technology & Medicine
.\" Copyright (c) 1990 The Regents of the University of California.
@ -40,7 +40,7 @@
.\"
.\" %W% (Berkeley) %G%
.\"
.\" Id: amd.conf.5,v 1.15 2002/06/22 20:52:45 ezk Exp
.\" Id: amd.conf.5,v 1.17 2002/12/27 22:44:12 ezk Exp
.\"
.TH AMD.CONF 5 "7 August 1997"
.SH NAME
@ -282,6 +282,10 @@ Specify the number of seconds to keep entries in the cache.
.BR ldap_hostports " (string, default not set)"
Specify the LDAP host and port values.
.TP
.BR ldap_proto_version " (numeric, default=2)"
Specify the version of the LDAP protocol to use.
.TP
.BR local_domain " (string, default no sub-domain)"
Same as the

View File

@ -1,7 +1,7 @@
.\" $NetBSD: automount2amd.8,v 1.3 2002/11/29 23:06:27 christos Exp $
.\" $NetBSD: automount2amd.8,v 1.4 2003/03/09 01:38:51 christos Exp $
.\"
.\"
.\" Copyright (c) 1997-2002 Erez Zadok
.\" Copyright (c) 1997-2003 Erez Zadok
.\" Copyright (c) 1990 Jan-Simon Pendry
.\" Copyright (c) 1990 Imperial College of Science, Technology & Medicine
.\" Copyright (c) 1990 The Regents of the University of California.
@ -40,7 +40,7 @@
.\"
.\" %W% (Berkeley) %G%
.\"
.\" Id: automount2amd.8,v 1.4 2002/01/07 07:36:35 ezk Exp
.\" Id: automount2amd.8,v 1.5 2002/12/27 22:44:12 ezk Exp
.\"
.TH AUTOMOUNT2AMD 8L "24 May 1993"
.SH NAME

View File

@ -1,4 +1,4 @@
.\" $NetBSD: expn.1,v 1.2 2002/07/11 10:53:20 wiz Exp $
.\" $NetBSD: expn.1,v 1.3 2003/03/09 01:38:51 christos Exp $
.\"
#!@PERL@
'di ';
@ -18,7 +18,7 @@ $sockaddr = 'S n a4 x8';
# system requirements:
# must have 'nslookup' and 'hostname' programs.
# Header: /proj/bank/cvsroot/am-utils/scripts/expn.1,v 1.1.1.1 1998/11/05 02:04:58 ezk Exp
# Header: /proj/bank/cvsroot/am-utils/scripts/expn.1,v 1.2 2002/07/11 14:28:20 ezk Exp
# TODO:
# less magic should apply to command-line addresses
@ -62,7 +62,7 @@ $sockaddr = 'S n a4 x8';
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# This copyright notice derrived from material copyrighted by the Regents
# This copyright notice derived from material copyrighted by the Regents
# of the University of California.
#
# Contributions accepted.
@ -260,7 +260,7 @@ while (@hosts) {
# on the results of our query until we have looked
# at the complete output. @toFinal stores expansions
# that will be final if we take them. @toExpn stores
# expnansions that are not final. @isValid keeps
# expansions that are not final. @isValid keeps
# track of our ability to send mail to each of the
# expansions.
#
@ -786,7 +786,7 @@ sub domainify
}
#
# There are several weird situtations that need to be
# There are several weird situations that need to be
# accounted for. They have to do with domain relay hosts.
#
# Examples:
@ -957,7 +957,7 @@ sub mxredirect
return undef;
}
# follow mx records, return a hostname
# also follow temporary redirections comming from &domainify and
# also follow temporary redirections coming from &domainify and
# &mxlookup
sub mx
{
@ -1035,7 +1035,7 @@ sub mxlookup
}
if (/Non-existent domain/) {
#
# These addresss are hosed. Kaput! Dead!
# These addresses are hosed. Kaput! Dead!
# However, if we created the address in the
# first place then there is a chance of
# salvation.
@ -1094,7 +1094,7 @@ sub mxunroll
print "looking for mxbacktrace{$addr *** $host}\n"
if ($debug > 1);
while (defined $mxbacktrace{"$addr *** $host"}) {
print "Unrolling MX expnasion: \@$host:$addr -> "
print "Unrolling MX expansion: \@$host:$addr -> "
if ($debug || $verbose);
$host = $mxbacktrace{"$addr *** $host"};
print "\@$host:$addr\n"

View File

@ -15,7 +15,7 @@ $SOCK_STREAM = &SOCK_STREAM;
# system requirements:
# must have 'nslookup' and 'hostname' programs.
# Header: /proj/bank/cvsroot/am-utils/scripts/expn.in,v 1.4 2000/11/05 13:03:14 ib42 Exp
# Header: /proj/bank/cvsroot/am-utils/scripts/expn.in,v 1.5 2002/07/11 14:28:20 ezk Exp
# TODO:
# less magic should apply to command-line addresses
@ -59,7 +59,7 @@ $SOCK_STREAM = &SOCK_STREAM;
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# This copyright notice derrived from material copyrighted by the Regents
# This copyright notice derived from material copyrighted by the Regents
# of the University of California.
#
# Contributions accepted.
@ -257,7 +257,7 @@ while (@hosts) {
# on the results of our query until we have looked
# at the complete output. @toFinal stores expansions
# that will be final if we take them. @toExpn stores
# expnansions that are not final. @isValid keeps
# expansions that are not final. @isValid keeps
# track of our ability to send mail to each of the
# expansions.
#
@ -783,7 +783,7 @@ sub domainify
}
#
# There are several weird situtations that need to be
# There are several weird situations that need to be
# accounted for. They have to do with domain relay hosts.
#
# Examples:
@ -954,7 +954,7 @@ sub mxredirect
return undef;
}
# follow mx records, return a hostname
# also follow temporary redirections comming from &domainify and
# also follow temporary redirections coming from &domainify and
# &mxlookup
sub mx
{
@ -1032,7 +1032,7 @@ sub mxlookup
}
if (/Non-existent domain/) {
#
# These addresss are hosed. Kaput! Dead!
# These addresses are hosed. Kaput! Dead!
# However, if we created the address in the
# first place then there is a chance of
# salvation.
@ -1091,7 +1091,7 @@ sub mxunroll
print "looking for mxbacktrace{$addr *** $host}\n"
if ($debug > 1);
while (defined $mxbacktrace{"$addr *** $host"}) {
print "Unrolling MX expnasion: \@$host:$addr -> "
print "Unrolling MX expansion: \@$host:$addr -> "
if ($debug || $verbose);
$host = $mxbacktrace{"$addr *** $host"};
print "\@$host:$addr\n"
@ -1103,7 +1103,7 @@ sub mxunroll
if ($host =~ /\./);
return 0;
}
# register a completed expnasion. Make the final address as
# register a completed expansion. Make the final address as
# simple as possible.
sub final
{

View File

@ -1,7 +1,7 @@
.\" $NetBSD: wire-test.8,v 1.5 2002/11/29 23:06:27 christos Exp $
.\" $NetBSD: wire-test.8,v 1.6 2003/03/09 01:38:52 christos Exp $
.\"
.\"
.\" Copyright (c) 1997-2002 Erez Zadok
.\" Copyright (c) 1997-2003 Erez Zadok
.\" Copyright (c) 1990 Jan-Simon Pendry
.\" Copyright (c) 1990 Imperial College of Science, Technology & Medicine
.\" Copyright (c) 1990 The Regents of the University of California.
@ -40,7 +40,7 @@
.\"
.\" %W% (Berkeley) %G%
.\"
.\" Id: wire-test.8,v 1.6 2002/01/07 07:36:35 ezk Exp
.\" Id: wire-test.8,v 1.7 2002/12/27 22:44:13 ezk Exp
.\"
.TH WIRE-TEST 8 "26 Feb 1993"
.SH NAME