1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-28 11:57:28 +00:00

Merge from Lite2 (use new getvfsbyname() and mount(2) interface)

This commit is contained in:
Peter Wemm 1997-03-11 12:40:45 +00:00
parent b94d6bf4d7
commit 4a4c52857e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=23680
40 changed files with 293 additions and 262 deletions

View File

@ -5,6 +5,7 @@ SRCS= mount_cd9660.c getmntopts.c
MAN8= mount_cd9660.8
MOUNT= ${.CURDIR}/../mount
CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${MOUNT}
.PATH: ${MOUNT}

View File

@ -35,7 +35,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)mount_cd9660.c 8.4 (Berkeley) 3/27/94
* @(#)mount_cd9660.c 8.7 (Berkeley) 5/1/95
*/
#ifndef lint
@ -46,15 +46,15 @@ static char copyright[] =
#ifndef lint
/*
static char sccsid[] = "@(#)mount_cd9660.c 8.4 (Berkeley) 3/27/94";
static char sccsid[] = "@(#)mount_cd9660.c 8.7 (Berkeley) 5/1/95";
*/
static const char rcsid[] =
"$Id$";
"$Id: mount_cd9660.c,v 1.9 1997/02/22 14:32:44 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
#define CD9660
#include <sys/mount.h>
#include <sys/../isofs/cd9660/cd9660_mount.h>
#include <err.h>
#include <stdlib.h>
@ -84,7 +84,8 @@ main(argc, argv)
struct iso_args args;
int ch, mntflags, opts;
char *dev, *dir;
struct vfsconf *vfc;
struct vfsconf vfc;
int error;
mntflags = opts = 0;
while ((ch = getopt(argc, argv, "ego:r")) != EOF)
@ -115,30 +116,27 @@ main(argc, argv)
dir = argv[1];
#define DEFAULT_ROOTUID -2
args.fspec = dev;
args.export.ex_root = DEFAULT_ROOTUID;
/*
* ISO 9660 filesystems are not writeable.
*/
mntflags |= MNT_RDONLY;
args.export.ex_flags = MNT_EXRDONLY;
args.fspec = dev;
args.export.ex_root = DEFAULT_ROOTUID;
args.flags = opts;
vfc = getvfsbyname("cd9660");
if(!vfc && vfsisloadable("cd9660")) {
if(vfsload("cd9660")) {
error = getvfsbyname("cd9660", &vfc);
if (error && vfsisloadable("cd9660")) {
if (vfsload("cd9660"))
err(EX_OSERR, "vfsload(cd9660)");
}
endvfsent(); /* flush cache */
vfc = getvfsbyname("cd9660");
error = getvfsbyname("cd9660", &vfc);
}
if (!vfc)
errx(EX_OSERR, "cd9660 filesystem not available");
if (error)
errx(1, "cd9660 filesystem is not available");
if (mount(vfc->vfc_index, dir, mntflags, &args) < 0)
err(EX_OSERR, "%s", dev);
if (mount(vfc.vfc_name, dir, mntflags, &args) < 0)
err(1, NULL);
exit(0);
}

View File

@ -5,6 +5,7 @@ SRCS= mount_ext2fs.c getmntopts.c
MAN8= mount_ext2fs.8
MOUNT= ${.CURDIR}/../mount
CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${MOUNT}
.PATH: ${MOUNT}

View File

@ -42,7 +42,7 @@ static char copyright[] =
static char sccsid[] = "@(#)mount_lfs.c 8.3 (Berkeley) 3/27/94";
*/
static const char rcsid[] =
"$Id$";
"$Id: mount_ext2fs.c,v 1.6 1997/02/22 14:32:45 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -55,6 +55,8 @@ static const char rcsid[] =
#include <sysexits.h>
#include <unistd.h>
#include <ufs/ufs/ufsmount.h>
#include "mntopts.h"
struct mntopt mopts[] = {
@ -73,7 +75,8 @@ main(argc, argv)
struct ufs_args args;
int ch, mntflags;
char *fs_name, *options;
struct vfsconf *vfc;
struct vfsconf vfc;
int error;
options = NULL;
mntflags = 0;
@ -102,18 +105,18 @@ main(argc, argv)
else
args.export.ex_flags = 0;
vfc = getvfsbyname("ext2fs");
if(!vfc && vfsisloadable("ext2fs")) {
if(vfsload("ext2fs")) {
error = getvfsbyname("ext2fs", &vfc);
if (error && vfsisloadable("ext2fs")) {
if (vfsload("ext2fs")) {
err(EX_OSERR, "vfsload(ext2fs)");
}
endvfsent(); /* flush cache */
vfc = getvfsbyname("ext2fs");
error = getvfsbyname("ext2fs", &vfc);
}
if (!vfc)
errx(EX_OSERR, "ext2fs filesystem not available");
if (error)
errx(EX_OSERR, "ext2fs filesystem is not available");
if (mount(vfc->vfc_index, fs_name, mntflags, &args) < 0)
if (mount(vfc.vfc_name, fs_name, mntflags, &args) < 0)
err(EX_OSERR, "%s", args.fspec);
exit(0);
}

View File

@ -5,6 +5,7 @@ SRCS= mount_lfs.c getmntopts.c
MAN8= mount_lfs.8
MOUNT= ${.CURDIR}/../mount
CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${MOUNT}
.PATH: ${MOUNT}

View File

@ -39,14 +39,15 @@ static char copyright[] =
#ifndef lint
/*
static char sccsid[] = "@(#)mount_lfs.c 8.3 (Berkeley) 3/27/94";
static char sccsid[] = "@(#)mount_lfs.c 8.4 (Berkeley) 4/26/95";
*/
static const char rcsid[] =
"$Id$";
"$Id: mount_lfs.c,v 1.7 1997/02/22 14:32:46 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
#include <sys/mount.h>
#include <ufs/ufs/ufsmount.h>
#include <err.h>
#include <stdio.h>
@ -75,7 +76,8 @@ main(argc, argv)
struct ufs_args args;
int ch, mntflags, noclean;
char *fs_name, *options;
struct vfsconf *vfc;
struct vfsconf vfc;
int error;
int short_rds, cleaner_debug;
@ -115,18 +117,18 @@ main(argc, argv)
else
args.export.ex_flags = 0;
vfc = getvfsbyname("lfs");
if(!vfc && vfsisloadable("lfs")) {
error = getvfsbyname("lfs", &vfc);
if (error && vfsisloadable("lfs")) {
if(vfsload("lfs"))
err(EX_OSERR, "vfsload(lfs)");
endvfsent(); /* flush cache */
vfc = getvfsbyname("lfs");
endvfsent(); /* clear cache */
error = getvfsbyname("lfs", &vfc);
}
if (!vfc)
if (error)
errx(EX_OSERR, "lfs filesystem is not available");
if (mount(vfc ? vfc->vfc_index : MOUNT_LFS, fs_name, mntflags, &args))
err(EX_OSERR, args.fspec);
if (mount(vfc.vfc_name, fs_name, mntflags, &args))
err(1, NULL);
if (!noclean)
invoke_cleaner(fs_name, short_rds, cleaner_debug);

View File

@ -5,6 +5,7 @@ SRCS= mount_nfs.c getmntopts.c
MAN8= mount_nfs.8
MOUNT= ${.CURDIR}/../mount
CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -DNFS -I${MOUNT}
.PATH: ${MOUNT}

View File

@ -1,4 +1,4 @@
.\" Copyright (c) 1992, 1993, 1994
.\" Copyright (c) 1992, 1993, 1994, 1995
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@ -29,11 +29,11 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)mount_nfs.8 8.2 (Berkeley) 3/27/94
.\" @(#)mount_nfs.8 8.3 (Berkeley) 3/29/95
.\"
.\" $Id$
.\" $Id: mount_nfs.8,v 1.7 1997/02/22 14:32:47 peter Exp $
.\""
.Dd March 27, 1994
.Dd March 29, 1995
.Dt MOUNT_NFS 8
.Os BSD 4.4
.Sh NAME
@ -226,7 +226,8 @@ Same as
.Fl T.
.El
.It Fl q
Use the leasing extensions to the NFS Version 3 protocol to maintain cache consistency.
Use the leasing extensions to the NFS Version 3 protocol
to maintain cache consistency.
This protocol Version 2, referred to as Not Quite Nfs (NQNFS),
is only supported by this updated release of NFS code.
(It is not backwards compatible with the release of NQNFS that went out on

View File

@ -42,10 +42,10 @@ static char copyright[] =
#ifndef lint
/*
static char sccsid[] = "@(#)mount_nfs.c 8.3 (Berkeley) 3/27/94";
static char sccsid[] = "@(#)mount_nfs.c 8.11 (Berkeley) 5/4/95";
*/
static const char rcsid[] =
"$Id$";
"$Id: mount_nfs.c,v 1.16 1997/02/22 14:32:48 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -64,15 +64,15 @@ static const char rcsid[] =
#endif
#ifdef NFSKERB
#include <des.h>
#include <kerberosIV/des.h>
#include <kerberosIV/krb.h>
#endif
#include <nfs/rpcv2.h>
#include <nfs/nfsproto.h>
#define _KERNEL
#define KERNEL
#include <nfs/nfs.h>
#undef _KERNEL
#undef KERNEL
#include <nfs/nqnfs.h>
#include <arpa/inet.h>
@ -91,7 +91,6 @@ static const char rcsid[] =
#include "mntopts.h"
#ifdef __FreeBSD__
#define ALTF_BG 0x1
#define ALTF_NOCONN 0x2
#define ALTF_DUMBTIMR 0x4
@ -131,16 +130,9 @@ struct mntopt mopts[] = {
{ "port=", 0, ALTF_PORT, 1 },
{ NULL }
};
#else
struct mntopt mopts[] = {
MOPT_STDOPTS,
MOPT_FORCE,
MOPT_UPDATE,
{ NULL }
};
#endif
struct nfs_args nfsdefargs = {
NFS_ARGSVERSION,
(struct sockaddr *)0,
sizeof (struct sockaddr_in),
SOCK_DGRAM,
@ -211,7 +203,8 @@ main(argc, argv)
struct nfsd_cargs ncd;
int mntflags, altflags, i, nfssvc_flag, num;
char *name, *p, *spec;
struct vfsconf *vfc;
struct vfsconf vfc;
int error = 0;
#ifdef NFSKERB
uid_t last_ruid;
@ -300,7 +293,6 @@ main(argc, argv)
break;
#endif
case 'o':
#ifdef __FreeBSD__
getmntopts(optarg, mopts, &mntflags, &altflags);
if(altflags & ALTF_BG)
opflags |= BGRND;
@ -337,9 +329,6 @@ main(argc, argv)
if(altflags & ALTF_PORT)
port_no = atoi(strstr(optarg, "port=") + 5);
altflags = 0;
#else
getmntopts(optarg, mopts, &mntflags);
#endif
break;
case 'P':
nfsargsp->flags |= NFSMNT_RESVPORT;
@ -403,8 +392,10 @@ main(argc, argv)
argc -= optind;
argv += optind;
if (argc != 2)
if (argc != 2) {
usage();
/* NOTREACHED */
}
spec = *argv++;
name = *argv;
@ -413,21 +404,22 @@ main(argc, argv)
exit(1);
#ifdef __FreeBSD__
vfc = getvfsbyname("nfs");
if(!vfc && vfsisloadable("nfs")) {
error = getvfsbyname("nfs", &vfc);
if (error && vfsisloadable("nfs")) {
if(vfsload("nfs"))
err(EX_OSERR, "vfsload(nfs)");
endvfsent(); /* flush cache */
vfc = getvfsbyname("nfs");
endvfsent(); /* clear cache */
error = getvfsbyname("nfs", &vfc);
}
if (!vfc)
errx(EX_OSERR, "nfs filesystem is not loadable");
if (error)
errx(EX_OSERR, "nfs filesystem is not available");
if (mount(vfc->vfc_index, name, mntflags, nfsargsp))
#else
if (mount(MOUNT_NFS, name, mntflags, nfsargsp))
#endif
if (mount(vfc.vfc_name, name, mntflags, nfsargsp))
err(1, "%s", name);
#else
if (mount("nfs", name, mntflags, nfsargsp))
err(1, "%s", name);
#endif
if (nfsargsp->flags & (NFSMNT_NQNFS | NFSMNT_KERB)) {
if ((opflags & ISBGRND) == 0) {
if (i = fork()) {
@ -498,7 +490,7 @@ main(argc, argv)
3 * NFSX_UNSIGNED;
ncd.ncd_verfstr = (u_char *)&kverf;
ncd.ncd_verflen = sizeof (kverf);
bcopy((caddr_t)kcr.session, (caddr_t)ncd.ncd_key,
memmove(ncd.ncd_key, kcr.session,
sizeof (kcr.session));
kin.t1 = htonl(ktv.tv_sec);
kin.t2 = htonl(ktv.tv_usec);
@ -587,14 +579,13 @@ getnfsargs(spec, nfsargsp)
warnx("bad ISO address");
return (0);
}
bzero((caddr_t)&isoaddr, sizeof (isoaddr));
bcopy((caddr_t)isop, (caddr_t)&isoaddr.siso_addr,
sizeof (struct iso_addr));
memset(&isoaddr, 0, sizeof (isoaddr));
memmove(&isoaddr.siso_addr, isop, sizeof (struct iso_addr));
isoaddr.siso_len = sizeof (isoaddr);
isoaddr.siso_family = AF_ISO;
isoaddr.siso_tlen = 2;
isoport = htons(NFS_PORT);
bcopy((caddr_t)&isoport, TSEL(&isoaddr), isoaddr.siso_tlen);
memmove(TSEL(&isoaddr), &isoport, isoaddr.siso_tlen);
hostp = delimp + 1;
}
#endif /* ISO */
@ -608,9 +599,9 @@ getnfsargs(spec, nfsargsp)
warnx("bad net address %s", hostp);
return (0);
}
} else if ((hp = gethostbyname(hostp)) != NULL) {
bcopy(hp->h_addr, (caddr_t)&saddr.sin_addr, hp->h_length);
} else {
} else if ((hp = gethostbyname(hostp)) != NULL)
memmove(&saddr.sin_addr, hp->h_addr, hp->h_length);
else {
warnx("can't get net id for host");
return (0);
}
@ -621,7 +612,7 @@ getnfsargs(spec, nfsargsp)
warnx("can't reverse resolve net address");
return (0);
}
bcopy(hp->h_addr, (caddr_t)&saddr.sin_addr, hp->h_length);
memmove(&saddr.sin_addr, hp->h_addr, hp->h_length);
strncpy(inst, hp->h_name, INST_SZ);
inst[INST_SZ - 1] = '\0';
if (cp = strchr(inst, '.'))
@ -701,8 +692,7 @@ getnfsargs(spec, nfsargsp)
if (nfhret.stat) {
if (opflags & ISBGRND)
exit(1);
errno = nfhret.stat;
warn("can't access %s", spec);
warnx("can't access %s: %s", spec, strerror(nfhret.stat));
return (0);
}
saddr.sin_port = htons(tport);
@ -764,7 +754,6 @@ xdr_fh(xdrsp, np)
if (auth == np->auth)
authfnd++;
}
/*
* Some servers, such as DEC's OSF/1 return a nil authenticator
* list to indicate RPCAUTH_UNIX.

View File

@ -5,6 +5,7 @@ SRCS= mount_null.c getmntopts.c
MAN8= mount_null.8
MOUNT= ${.CURDIR}/../mount
CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT}
.PATH: ${MOUNT}

View File

@ -34,15 +34,16 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)mount_null.8 8.4 (Berkeley) 4/19/94
.\" $Id$
.\" @(#)mount_null.8 8.6 (Berkeley) 5/1/95
.\" $Id: mount_null.8,v 1.7 1997/02/22 14:32:50 peter Exp $
.\"
.Dd April 19, 1994
.Dd May 1, 1995
.Dt MOUNT_NULL 8
.Os BSD 4.4
.Sh NAME
.Nm mount_null
.Nd demonstrate the use of a null file system layer
.Nd mount a loopback filesystem sub-tree;
demonstrate the use of a null file system layer
.Sh SYNOPSIS
.Nm mount_null
.Op Fl o Ar options
@ -54,11 +55,22 @@ The
command creates a
null layer, duplicating a sub-tree of the file system
name space under another part of the global file system namespace.
In this respect, it is
similar to the loopback file system (see
.Xr mount_lofs 8 ) .
It differs from
the loopback file system in two respects: it is implemented using
This allows existing files and directories to be accessed
using a different pathname.
.Pp
The primary differences between a virtual copy of the filesystem
and a symbolic link are that
.Xr getcwd 3
functions correctly in the virtual copy, and that other filesystems
may be mounted on the virtual copy without affecting the original.
A different device number for the virtual copy is returned by
.Xr stat 2 ,
but in other respects it is indistinguishable from the original.
.Pp
The
.Nm mount_null
filesystem differs from a traditional
loopback file system in two respects: it is implemented using
a stackable layers techniques, and it's
.Do
null-node

View File

@ -42,10 +42,10 @@ char copyright[] =
#ifndef lint
/*
static char sccsid[] = "@(#)mount_null.c 8.5 (Berkeley) 3/27/94";
static char sccsid[] = "@(#)mount_null.c 8.6 (Berkeley) 4/26/95";
*/
static const char rcsid[] =
"$Id$";
"$Id: mount_null.c,v 1.7 1997/02/22 14:32:51 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -77,7 +77,8 @@ main(argc, argv)
struct null_args args;
int ch, mntflags;
char target[MAXPATHLEN];
struct vfsconf *vfc;
struct vfsconf vfc;
int error;
mntflags = 0;
while ((ch = getopt(argc, argv, "o:")) != EOF)
@ -104,18 +105,18 @@ main(argc, argv)
args.target = target;
vfc = getvfsbyname("null");
if(!vfc && vfsisloadable("null")) {
error = getvfsbyname("null", &vfc);
if (error && vfsisloadable("null")) {
if(vfsload("null"))
err(EX_OSERR, "vfsload(null)");
endvfsent(); /* flush cache */
vfc = getvfsbyname("null");
endvfsent();
error = getvfsbyname("null", &vfc);
}
if (!vfc)
errx(EX_OSERR, "null filesystem is not available");
if (error)
errx(EX_OSERR, "null/loopback filesystem is not available");
if (mount(vfc->vfc_index, argv[1], mntflags, &args))
err(EX_OSERR, target);
if (mount(vfc.vfc_name, argv[1], mntflags, &args))
err(1, NULL);
exit(0);
}

View File

@ -5,6 +5,7 @@ SRCS= mount_null.c getmntopts.c
MAN8= mount_null.8
MOUNT= ${.CURDIR}/../mount
CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT}
.PATH: ${MOUNT}

View File

@ -34,15 +34,16 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)mount_null.8 8.4 (Berkeley) 4/19/94
.\" $Id$
.\" @(#)mount_null.8 8.6 (Berkeley) 5/1/95
.\" $Id: mount_null.8,v 1.7 1997/02/22 14:32:50 peter Exp $
.\"
.Dd April 19, 1994
.Dd May 1, 1995
.Dt MOUNT_NULL 8
.Os BSD 4.4
.Sh NAME
.Nm mount_null
.Nd demonstrate the use of a null file system layer
.Nd mount a loopback filesystem sub-tree;
demonstrate the use of a null file system layer
.Sh SYNOPSIS
.Nm mount_null
.Op Fl o Ar options
@ -54,11 +55,22 @@ The
command creates a
null layer, duplicating a sub-tree of the file system
name space under another part of the global file system namespace.
In this respect, it is
similar to the loopback file system (see
.Xr mount_lofs 8 ) .
It differs from
the loopback file system in two respects: it is implemented using
This allows existing files and directories to be accessed
using a different pathname.
.Pp
The primary differences between a virtual copy of the filesystem
and a symbolic link are that
.Xr getcwd 3
functions correctly in the virtual copy, and that other filesystems
may be mounted on the virtual copy without affecting the original.
A different device number for the virtual copy is returned by
.Xr stat 2 ,
but in other respects it is indistinguishable from the original.
.Pp
The
.Nm mount_null
filesystem differs from a traditional
loopback file system in two respects: it is implemented using
a stackable layers techniques, and it's
.Do
null-node

View File

@ -42,10 +42,10 @@ char copyright[] =
#ifndef lint
/*
static char sccsid[] = "@(#)mount_null.c 8.5 (Berkeley) 3/27/94";
static char sccsid[] = "@(#)mount_null.c 8.6 (Berkeley) 4/26/95";
*/
static const char rcsid[] =
"$Id$";
"$Id: mount_null.c,v 1.7 1997/02/22 14:32:51 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -77,7 +77,8 @@ main(argc, argv)
struct null_args args;
int ch, mntflags;
char target[MAXPATHLEN];
struct vfsconf *vfc;
struct vfsconf vfc;
int error;
mntflags = 0;
while ((ch = getopt(argc, argv, "o:")) != EOF)
@ -104,18 +105,18 @@ main(argc, argv)
args.target = target;
vfc = getvfsbyname("null");
if(!vfc && vfsisloadable("null")) {
error = getvfsbyname("null", &vfc);
if (error && vfsisloadable("null")) {
if(vfsload("null"))
err(EX_OSERR, "vfsload(null)");
endvfsent(); /* flush cache */
vfc = getvfsbyname("null");
endvfsent();
error = getvfsbyname("null", &vfc);
}
if (!vfc)
errx(EX_OSERR, "null filesystem is not available");
if (error)
errx(EX_OSERR, "null/loopback filesystem is not available");
if (mount(vfc->vfc_index, argv[1], mntflags, &args))
err(EX_OSERR, target);
if (mount(vfc.vfc_name, argv[1], mntflags, &args))
err(1, NULL);
exit(0);
}

View File

@ -1,5 +1,5 @@
# From: @(#)Makefile 8.3 (Berkeley) 3/27/94
# $Id$
# $Id: Makefile,v 1.6 1997/02/22 14:32:52 peter Exp $
PROG= mount_portal
SRCS= mount_portal.c activate.c conf.c getmntopts.c pt_conf.c \
@ -7,6 +7,7 @@ SRCS= mount_portal.c activate.c conf.c getmntopts.c pt_conf.c \
MAN8= mount_portal.8
MOUNT= ${.CURDIR}/../mount
CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT}
.PATH: ${MOUNT}

View File

@ -34,9 +34,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)activate.c 8.2 (Berkeley) 3/27/94
* @(#)activate.c 8.3 (Berkeley) 4/28/95
*
* $Id$
* $Id: activate.c,v 1.3 1997/02/22 14:32:53 peter Exp $
*/
#include <stdio.h>
@ -89,7 +89,7 @@ int klen;
iov[1].iov_base = key;
iov[1].iov_len = klen;
bzero((char *) &msg, sizeof(msg));
memset(&msg, 0, sizeof(msg));
msg.msg_iov = iov;
msg.msg_iovlen = 2;
@ -129,7 +129,7 @@ int error;
/*
* Build a msghdr
*/
bzero((char *) &msg, sizeof(msg));
memset(&msg, 0, sizeof(msg));
msg.msg_iov = &iov;
msg.msg_iovlen = 1;

View File

@ -42,10 +42,10 @@ char copyright[] =
#ifndef lint
/*
static char sccsid[] = "@(#)mount_portal.c 8.4 (Berkeley) 3/27/94";
static char sccsid[] = "@(#)mount_portal.c 8.6 (Berkeley) 4/26/95";
*/
static const char rcsid[] =
"$Id$";
"$Id: mount_portal.c,v 1.9 1997/02/22 14:32:53 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -93,7 +93,7 @@ int sig;
;
/* wrtp - waitpid _doesn't_ return 0 when no children! */
#ifdef notdef
if (pid < 0)
if (pid < 0 && errno != ECHILD)
syslog(LOG_WARNING, "waitpid: %s", strerror(errno));
#endif
}
@ -109,7 +109,7 @@ main(argc, argv)
char *mountpt;
int mntflags = 0;
char tag[32];
struct vfsconf *vfc;
struct vfsconf vfc;
qelem q;
int rc;
@ -171,26 +171,24 @@ main(argc, argv)
sprintf(tag, "portal:%d", getpid());
args.pa_config = tag;
vfc = getvfsbyname("portal");
if(!vfc && vfsisloadable("portal")) {
if(vfsload("portal"))
error = getvfsbyname("portal", &vfc);
if (error && vfsisloadable("portal")) {
if (vfsload("portal"))
err(EX_OSERR, "vfsload(portal)");
endvfsent(); /* flush cache */
vfc = getvfsbyname("portal");
endvfsent();
error = getvfsbyname("portal", &vfc);
}
if (!vfc)
if (error)
errx(EX_OSERR, "portal filesystem is not available");
rc = mount(vfc ? vfc->vfc_index : MOUNT_PORTAL, mountpt, mntflags, &args);
rc = mount(vfc.vfc_name, mountpt, mntflags, &args);
if (rc < 0)
err(1, NULL);
#ifdef notdef
/*
* Everything is ready to go - now is a good time to fork
*/
daemon(0, 0);
#endif
/*
* Start logging (and change name)
@ -272,7 +270,7 @@ main(argc, argv)
case 0:
(void) close(so);
activate(&q, so2);
exit(0); /* stupid errors.... tidied up... wrtp*/
exit(0);
default:
(void) close(so2);
break;

View File

@ -34,9 +34,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)pt_file.c 8.2 (Berkeley) 3/27/94
* @(#)pt_file.c 8.3 (Berkeley) 7/3/94
*
* $Id$
* $Id: pt_file.c,v 1.5 1997/02/22 14:32:56 peter Exp $
*/
#include <stdio.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1992, 1993
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
* All rights reserved.
*
@ -34,9 +34,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)pt_tcp.c 8.3 (Berkeley) 3/27/94
* @(#)pt_tcp.c 8.5 (Berkeley) 4/28/95
*
* $Id$
* $Id: pt_tcp.c,v 1.4 1997/02/22 14:32:56 peter Exp $
*/
#include <stdio.h>
@ -62,11 +62,11 @@
* An unrecognised suffix is an error.
*/
int portal_tcp(pcr, key, v, kso, fdp)
struct portal_cred *pcr;
char *key;
char **v;
int kso;
int *fdp;
struct portal_cred *pcr;
char *key;
char **v;
int kso;
int *fdp;
{
char host[MAXHOSTNAMELEN];
char port[MAXHOSTNAMELEN];
@ -125,15 +125,16 @@ int *fdp;
if (sp != NULL)
s_port = (u_short)sp->s_port;
else {
s_port = htons ((u_short)strtol (port, (char**)NULL, 10));
if (s_port == 0)
s_port = strtoul(port, &p, 0);
if (s_port == 0 || *p != '\0')
return (EINVAL);
s_port = htons(s_port);
}
#ifdef DEBUG
printf ("port number for %s is %d\n", port, s_port);
#endif
bzero(&sain, sizeof(sain));
memset(&sain, 0, sizeof(sain));
sain.sin_len = sizeof(sain);
sain.sin_family = AF_INET;
sain.sin_port = s_port;

View File

@ -1,5 +1,5 @@
# From: @(#)Makefile 8.3 (Berkeley) 3/27/94
# $Id$
# $Id: Makefile,v 1.6 1997/02/22 14:32:52 peter Exp $
PROG= mount_portal
SRCS= mount_portal.c activate.c conf.c getmntopts.c pt_conf.c \
@ -7,6 +7,7 @@ SRCS= mount_portal.c activate.c conf.c getmntopts.c pt_conf.c \
MAN8= mount_portal.8
MOUNT= ${.CURDIR}/../mount
CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT}
.PATH: ${MOUNT}

View File

@ -34,9 +34,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)activate.c 8.2 (Berkeley) 3/27/94
* @(#)activate.c 8.3 (Berkeley) 4/28/95
*
* $Id$
* $Id: activate.c,v 1.3 1997/02/22 14:32:53 peter Exp $
*/
#include <stdio.h>
@ -89,7 +89,7 @@ int klen;
iov[1].iov_base = key;
iov[1].iov_len = klen;
bzero((char *) &msg, sizeof(msg));
memset(&msg, 0, sizeof(msg));
msg.msg_iov = iov;
msg.msg_iovlen = 2;
@ -129,7 +129,7 @@ int error;
/*
* Build a msghdr
*/
bzero((char *) &msg, sizeof(msg));
memset(&msg, 0, sizeof(msg));
msg.msg_iov = &iov;
msg.msg_iovlen = 1;

View File

@ -42,10 +42,10 @@ char copyright[] =
#ifndef lint
/*
static char sccsid[] = "@(#)mount_portal.c 8.4 (Berkeley) 3/27/94";
static char sccsid[] = "@(#)mount_portal.c 8.6 (Berkeley) 4/26/95";
*/
static const char rcsid[] =
"$Id$";
"$Id: mount_portal.c,v 1.9 1997/02/22 14:32:53 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -93,7 +93,7 @@ int sig;
;
/* wrtp - waitpid _doesn't_ return 0 when no children! */
#ifdef notdef
if (pid < 0)
if (pid < 0 && errno != ECHILD)
syslog(LOG_WARNING, "waitpid: %s", strerror(errno));
#endif
}
@ -109,7 +109,7 @@ main(argc, argv)
char *mountpt;
int mntflags = 0;
char tag[32];
struct vfsconf *vfc;
struct vfsconf vfc;
qelem q;
int rc;
@ -171,26 +171,24 @@ main(argc, argv)
sprintf(tag, "portal:%d", getpid());
args.pa_config = tag;
vfc = getvfsbyname("portal");
if(!vfc && vfsisloadable("portal")) {
if(vfsload("portal"))
error = getvfsbyname("portal", &vfc);
if (error && vfsisloadable("portal")) {
if (vfsload("portal"))
err(EX_OSERR, "vfsload(portal)");
endvfsent(); /* flush cache */
vfc = getvfsbyname("portal");
endvfsent();
error = getvfsbyname("portal", &vfc);
}
if (!vfc)
if (error)
errx(EX_OSERR, "portal filesystem is not available");
rc = mount(vfc ? vfc->vfc_index : MOUNT_PORTAL, mountpt, mntflags, &args);
rc = mount(vfc.vfc_name, mountpt, mntflags, &args);
if (rc < 0)
err(1, NULL);
#ifdef notdef
/*
* Everything is ready to go - now is a good time to fork
*/
daemon(0, 0);
#endif
/*
* Start logging (and change name)
@ -272,7 +270,7 @@ main(argc, argv)
case 0:
(void) close(so);
activate(&q, so2);
exit(0); /* stupid errors.... tidied up... wrtp*/
exit(0);
default:
(void) close(so2);
break;

View File

@ -34,9 +34,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)pt_file.c 8.2 (Berkeley) 3/27/94
* @(#)pt_file.c 8.3 (Berkeley) 7/3/94
*
* $Id$
* $Id: pt_file.c,v 1.5 1997/02/22 14:32:56 peter Exp $
*/
#include <stdio.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1992, 1993
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
* All rights reserved.
*
@ -34,9 +34,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)pt_tcp.c 8.3 (Berkeley) 3/27/94
* @(#)pt_tcp.c 8.5 (Berkeley) 4/28/95
*
* $Id$
* $Id: pt_tcp.c,v 1.4 1997/02/22 14:32:56 peter Exp $
*/
#include <stdio.h>
@ -62,11 +62,11 @@
* An unrecognised suffix is an error.
*/
int portal_tcp(pcr, key, v, kso, fdp)
struct portal_cred *pcr;
char *key;
char **v;
int kso;
int *fdp;
struct portal_cred *pcr;
char *key;
char **v;
int kso;
int *fdp;
{
char host[MAXHOSTNAMELEN];
char port[MAXHOSTNAMELEN];
@ -125,15 +125,16 @@ int *fdp;
if (sp != NULL)
s_port = (u_short)sp->s_port;
else {
s_port = htons ((u_short)strtol (port, (char**)NULL, 10));
if (s_port == 0)
s_port = strtoul(port, &p, 0);
if (s_port == 0 || *p != '\0')
return (EINVAL);
s_port = htons(s_port);
}
#ifdef DEBUG
printf ("port number for %s is %d\n", port, s_port);
#endif
bzero(&sain, sizeof(sain));
memset(&sain, 0, sizeof(sain));
sain.sin_len = sizeof(sain);
sain.sin_family = AF_INET;
sain.sin_port = s_port;

View File

@ -5,6 +5,7 @@ SRCS= mount_umap.c getmntopts.c
MAN8= mount_umap.8
MOUNT= ${.CURDIR}/../mount
CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT}
.PATH: ${MOUNT}

View File

@ -33,9 +33,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)mount_umap.8 8.3 (Berkeley) 3/27/94
.\" @(#)mount_umap.8 8.4 (Berkeley) 5/1/95
.\"
.Dd "March 27, 1994"
.Dd "May 1, 1995"
.Dt MOUNT_UMAP 8
.Os BSD 4.4
.Sh NAME

View File

@ -42,10 +42,10 @@ char copyright[] =
#ifndef lint
/*
static char sccsid[] = "@(#)mount_umap.c 8.3 (Berkeley) 3/27/94";
static char sccsid[] = "@(#)mount_umap.c 8.5 (Berkeley) 4/26/95";
*/
static const char rcsid[] =
"$Id$";
"$Id: mount_umap.c,v 1.9 1997/02/22 14:33:00 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -100,7 +100,8 @@ main(argc, argv)
u_long gmapdata[GMAPFILEENTRIES][2], mapdata[MAPFILEENTRIES][2];
int ch, count, gnentries, mntflags, nentries;
char *gmapfile, *mapfile, *source, *target, buf[20];
struct vfsconf *vfc;
struct vfsconf vfc;
int error;
mntflags = 0;
mapfile = gmapfile = NULL;
@ -224,18 +225,17 @@ main(argc, argv)
args.gnentries = gnentries;
args.gmapdata = gmapdata;
vfc = getvfsbyname("umap");
if(!vfc && vfsisloadable("umap")) {
error = getvfsbyname("umap", &vfc);
if (error && vfsisloadable("umap")) {
if(vfsload("umap"))
err(1, "vfsload(umap)");
endvfsent(); /* flush cache */
vfc = getvfsbyname("umap");
}
if (!vfc) {
errx(1, "umap filesystem not available");
endvfsent();
error = getvfsbyname("umap", &vfc);
}
if (error)
errx(1, "umap filesystem is not available");
if (mount(vfc->vfc_index, argv[1], mntflags, &args))
if (mount(vfc.vfc_name, argv[1], mntflags, &args))
err(1, NULL);
exit(0);
}

View File

@ -5,6 +5,7 @@ SRCS= mount_umap.c getmntopts.c
MAN8= mount_umap.8
MOUNT= ${.CURDIR}/../mount
CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT}
.PATH: ${MOUNT}

View File

@ -33,9 +33,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)mount_umap.8 8.3 (Berkeley) 3/27/94
.\" @(#)mount_umap.8 8.4 (Berkeley) 5/1/95
.\"
.Dd "March 27, 1994"
.Dd "May 1, 1995"
.Dt MOUNT_UMAP 8
.Os BSD 4.4
.Sh NAME

View File

@ -42,10 +42,10 @@ char copyright[] =
#ifndef lint
/*
static char sccsid[] = "@(#)mount_umap.c 8.3 (Berkeley) 3/27/94";
static char sccsid[] = "@(#)mount_umap.c 8.5 (Berkeley) 4/26/95";
*/
static const char rcsid[] =
"$Id$";
"$Id: mount_umap.c,v 1.9 1997/02/22 14:33:00 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -100,7 +100,8 @@ main(argc, argv)
u_long gmapdata[GMAPFILEENTRIES][2], mapdata[MAPFILEENTRIES][2];
int ch, count, gnentries, mntflags, nentries;
char *gmapfile, *mapfile, *source, *target, buf[20];
struct vfsconf *vfc;
struct vfsconf vfc;
int error;
mntflags = 0;
mapfile = gmapfile = NULL;
@ -224,18 +225,17 @@ main(argc, argv)
args.gnentries = gnentries;
args.gmapdata = gmapdata;
vfc = getvfsbyname("umap");
if(!vfc && vfsisloadable("umap")) {
error = getvfsbyname("umap", &vfc);
if (error && vfsisloadable("umap")) {
if(vfsload("umap"))
err(1, "vfsload(umap)");
endvfsent(); /* flush cache */
vfc = getvfsbyname("umap");
}
if (!vfc) {
errx(1, "umap filesystem not available");
endvfsent();
error = getvfsbyname("umap", &vfc);
}
if (error)
errx(1, "umap filesystem is not available");
if (mount(vfc->vfc_index, argv[1], mntflags, &args))
if (mount(vfc.vfc_name, argv[1], mntflags, &args))
err(1, NULL);
exit(0);
}

View File

@ -5,6 +5,7 @@ SRCS= mount_union.c getmntopts.c
MAN8= mount_union.8
MOUNT= ${.CURDIR}/../mount
CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT}
.PATH: ${MOUNT}

View File

@ -74,7 +74,8 @@ main(argc, argv)
struct union_args args;
int ch, mntflags;
char target[MAXPATHLEN];
struct vfsconf *vfc;
struct vfsconf vfc;
int error;
mntflags = 0;
args.mntflags = UNMNT_ABOVE;
@ -111,17 +112,17 @@ main(argc, argv)
args.target = target;
vfc = getvfsbyname("union");
if(!vfc && vfsisloadable("union")) {
if(vfsload("union"))
err(1, "vfsload(union)");
error = getvfsbyname("union", &vfc);
if (error && vfsisloadable("union")) {
if (vfsload("union"))
err(EX_OSERR, "vfsload(union)");
endvfsent(); /* flush cache */
vfc = getvfsbyname("union");
error = getvfsbyname("union", &vfc);
}
if (!vfc)
if (error)
errx(EX_OSERR, "union filesystem is not available");
if (mount(vfc->vfc_index, argv[1], mntflags, &args))
if (mount(vfc.vfc_name, argv[1], mntflags, &args))
err(EX_OSERR, target);
exit(0);
}

View File

@ -5,6 +5,7 @@ SRCS= mount_union.c getmntopts.c
MAN8= mount_union.8
MOUNT= ${.CURDIR}/../mount
CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT}
.PATH: ${MOUNT}

View File

@ -74,7 +74,8 @@ main(argc, argv)
struct union_args args;
int ch, mntflags;
char target[MAXPATHLEN];
struct vfsconf *vfc;
struct vfsconf vfc;
int error;
mntflags = 0;
args.mntflags = UNMNT_ABOVE;
@ -111,17 +112,17 @@ main(argc, argv)
args.target = target;
vfc = getvfsbyname("union");
if(!vfc && vfsisloadable("union")) {
if(vfsload("union"))
err(1, "vfsload(union)");
error = getvfsbyname("union", &vfc);
if (error && vfsisloadable("union")) {
if (vfsload("union"))
err(EX_OSERR, "vfsload(union)");
endvfsent(); /* flush cache */
vfc = getvfsbyname("union");
error = getvfsbyname("union", &vfc);
}
if (!vfc)
if (error)
errx(EX_OSERR, "union filesystem is not available");
if (mount(vfc->vfc_index, argv[1], mntflags, &args))
if (mount(vfc.vfc_name, argv[1], mntflags, &args))
err(EX_OSERR, target);
exit(0);
}

View File

@ -1,5 +1,5 @@
# From: @(#)Makefile 8.3 (Berkeley) 3/27/94
# $Id$
# $Id: Makefile,v 1.6 1997/02/22 14:32:52 peter Exp $
PROG= mount_portal
SRCS= mount_portal.c activate.c conf.c getmntopts.c pt_conf.c \
@ -7,6 +7,7 @@ SRCS= mount_portal.c activate.c conf.c getmntopts.c pt_conf.c \
MAN8= mount_portal.8
MOUNT= ${.CURDIR}/../mount
CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT}
.PATH: ${MOUNT}

View File

@ -34,9 +34,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)activate.c 8.2 (Berkeley) 3/27/94
* @(#)activate.c 8.3 (Berkeley) 4/28/95
*
* $Id$
* $Id: activate.c,v 1.3 1997/02/22 14:32:53 peter Exp $
*/
#include <stdio.h>
@ -89,7 +89,7 @@ int klen;
iov[1].iov_base = key;
iov[1].iov_len = klen;
bzero((char *) &msg, sizeof(msg));
memset(&msg, 0, sizeof(msg));
msg.msg_iov = iov;
msg.msg_iovlen = 2;
@ -129,7 +129,7 @@ int error;
/*
* Build a msghdr
*/
bzero((char *) &msg, sizeof(msg));
memset(&msg, 0, sizeof(msg));
msg.msg_iov = &iov;
msg.msg_iovlen = 1;

View File

@ -42,10 +42,10 @@ char copyright[] =
#ifndef lint
/*
static char sccsid[] = "@(#)mount_portal.c 8.4 (Berkeley) 3/27/94";
static char sccsid[] = "@(#)mount_portal.c 8.6 (Berkeley) 4/26/95";
*/
static const char rcsid[] =
"$Id$";
"$Id: mount_portal.c,v 1.9 1997/02/22 14:32:53 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -93,7 +93,7 @@ int sig;
;
/* wrtp - waitpid _doesn't_ return 0 when no children! */
#ifdef notdef
if (pid < 0)
if (pid < 0 && errno != ECHILD)
syslog(LOG_WARNING, "waitpid: %s", strerror(errno));
#endif
}
@ -109,7 +109,7 @@ main(argc, argv)
char *mountpt;
int mntflags = 0;
char tag[32];
struct vfsconf *vfc;
struct vfsconf vfc;
qelem q;
int rc;
@ -171,26 +171,24 @@ main(argc, argv)
sprintf(tag, "portal:%d", getpid());
args.pa_config = tag;
vfc = getvfsbyname("portal");
if(!vfc && vfsisloadable("portal")) {
if(vfsload("portal"))
error = getvfsbyname("portal", &vfc);
if (error && vfsisloadable("portal")) {
if (vfsload("portal"))
err(EX_OSERR, "vfsload(portal)");
endvfsent(); /* flush cache */
vfc = getvfsbyname("portal");
endvfsent();
error = getvfsbyname("portal", &vfc);
}
if (!vfc)
if (error)
errx(EX_OSERR, "portal filesystem is not available");
rc = mount(vfc ? vfc->vfc_index : MOUNT_PORTAL, mountpt, mntflags, &args);
rc = mount(vfc.vfc_name, mountpt, mntflags, &args);
if (rc < 0)
err(1, NULL);
#ifdef notdef
/*
* Everything is ready to go - now is a good time to fork
*/
daemon(0, 0);
#endif
/*
* Start logging (and change name)
@ -272,7 +270,7 @@ main(argc, argv)
case 0:
(void) close(so);
activate(&q, so2);
exit(0); /* stupid errors.... tidied up... wrtp*/
exit(0);
default:
(void) close(so2);
break;

View File

@ -34,9 +34,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)pt_file.c 8.2 (Berkeley) 3/27/94
* @(#)pt_file.c 8.3 (Berkeley) 7/3/94
*
* $Id$
* $Id: pt_file.c,v 1.5 1997/02/22 14:32:56 peter Exp $
*/
#include <stdio.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1992, 1993
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
* All rights reserved.
*
@ -34,9 +34,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)pt_tcp.c 8.3 (Berkeley) 3/27/94
* @(#)pt_tcp.c 8.5 (Berkeley) 4/28/95
*
* $Id$
* $Id: pt_tcp.c,v 1.4 1997/02/22 14:32:56 peter Exp $
*/
#include <stdio.h>
@ -62,11 +62,11 @@
* An unrecognised suffix is an error.
*/
int portal_tcp(pcr, key, v, kso, fdp)
struct portal_cred *pcr;
char *key;
char **v;
int kso;
int *fdp;
struct portal_cred *pcr;
char *key;
char **v;
int kso;
int *fdp;
{
char host[MAXHOSTNAMELEN];
char port[MAXHOSTNAMELEN];
@ -125,15 +125,16 @@ int *fdp;
if (sp != NULL)
s_port = (u_short)sp->s_port;
else {
s_port = htons ((u_short)strtol (port, (char**)NULL, 10));
if (s_port == 0)
s_port = strtoul(port, &p, 0);
if (s_port == 0 || *p != '\0')
return (EINVAL);
s_port = htons(s_port);
}
#ifdef DEBUG
printf ("port number for %s is %d\n", port, s_port);
#endif
bzero(&sain, sizeof(sain));
memset(&sain, 0, sizeof(sain));
sain.sin_len = sizeof(sain);
sain.sin_family = AF_INET;
sain.sin_port = s_port;