Sync with 4.4lite2
This commit is contained in:
parent
2c7359091d
commit
3f2b3b5a18
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: lastcomm.c,v 1.6 1994/12/22 01:07:03 jtc Exp $ */
|
/* $NetBSD: lastcomm.c,v 1.7 1995/08/31 22:31:06 jtc Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1980, 1993
|
* Copyright (c) 1980, 1993
|
||||||
@ -41,9 +41,9 @@ static char copyright[] =
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)lastcomm.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)lastcomm.c 8.2 (Berkeley) 4/29/95";
|
||||||
#endif
|
#endif
|
||||||
static char rcsid[] = "$NetBSD: lastcomm.c,v 1.6 1994/12/22 01:07:03 jtc Exp $";
|
static char rcsid[] = "$NetBSD: lastcomm.c,v 1.7 1995/08/31 22:31:06 jtc Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -188,13 +188,10 @@ requested(argv, acp)
|
|||||||
register char *argv[];
|
register char *argv[];
|
||||||
register struct acct *acp;
|
register struct acct *acp;
|
||||||
{
|
{
|
||||||
register char *p;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
p = user_from_uid(acp->ac_uid, 0);
|
if (!strcmp(user_from_uid(acp->ac_uid, 0), *argv))
|
||||||
if (!strcmp(p, *argv))
|
|
||||||
return (1);
|
return (1);
|
||||||
if ((p = getdev(acp->ac_tty)) && !strcmp(p, *argv))
|
if (!strcmp(getdev(acp->ac_tty), *argv))
|
||||||
return (1);
|
return (1);
|
||||||
if (!strncmp(acp->ac_comm, *argv, fldsiz(acct, ac_comm)))
|
if (!strncmp(acp->ac_comm, *argv, fldsiz(acct, ac_comm)))
|
||||||
return (1);
|
return (1);
|
||||||
@ -214,7 +211,8 @@ getdev(dev)
|
|||||||
if (dev == lastdev) /* One-element cache. */
|
if (dev == lastdev) /* One-element cache. */
|
||||||
return (lastname);
|
return (lastname);
|
||||||
lastdev = dev;
|
lastdev = dev;
|
||||||
lastname = devname(dev, S_IFCHR);
|
if ((lastname = devname(dev, S_IFCHR)) == NULL)
|
||||||
|
lastname = "??";
|
||||||
return (lastname);
|
return (lastname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.\" $NetBSD: leave.1,v 1.4 1994/12/22 01:09:51 jtc Exp $
|
.\" $NetBSD: leave.1,v 1.5 1995/08/31 22:32:10 jtc Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1980, 1990, 1993
|
.\" Copyright (c) 1980, 1990, 1993
|
||||||
.\" The Regents of the University of California. All rights reserved.
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
@ -31,9 +31,9 @@
|
|||||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.\" @(#)leave.1 8.2 (Berkeley) 4/18/94
|
.\" @(#)leave.1 8.3 (Berkeley) 4/28/95
|
||||||
.\"
|
.\"
|
||||||
.Dd April 18, 1994
|
.Dd April 28, 1995
|
||||||
.Dt LEAVE 1
|
.Dt LEAVE 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.\" $NetBSD: showmount.8,v 1.4 1994/12/21 08:48:08 jtc Exp $
|
.\" $NetBSD: showmount.8,v 1.5 1995/08/31 22:26:07 jtc Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1989, 1991, 1993
|
.\" Copyright (c) 1989, 1991, 1993
|
||||||
.\" The Regents of the University of California. All rights reserved.
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
@ -34,9 +34,9 @@
|
|||||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.\" @(#)showmount.8 8.2 (Berkeley) 12/11/93
|
.\" @(#)showmount.8 8.3 (Berkeley) 3/29/95
|
||||||
.\"
|
.\"
|
||||||
.Dd December 11, 1993
|
.Dd March 29, 1995
|
||||||
.Dt SHOWMOUNT 8
|
.Dt SHOWMOUNT 8
|
||||||
.Os BSD 4
|
.Os BSD 4
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -44,7 +44,7 @@
|
|||||||
.Nd show remote nfs mounts on host
|
.Nd show remote nfs mounts on host
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm showmount
|
.Nm showmount
|
||||||
.Op Fl ade
|
.Op Fl ade3
|
||||||
.Op Ar host
|
.Op Ar host
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm Showmount
|
.Nm Showmount
|
||||||
@ -58,7 +58,10 @@ file systems mounted
|
|||||||
on the host. See
|
on the host. See
|
||||||
.%T "NFS: Network File System Protocol Specification" ,
|
.%T "NFS: Network File System Protocol Specification" ,
|
||||||
RFC 1094,
|
RFC 1094,
|
||||||
Appendix A ,
|
Appendix A,
|
||||||
|
and
|
||||||
|
.%T "NFS: Network File System Version 3 Protocol Specification" ,
|
||||||
|
Appendix I,
|
||||||
for a detailed description of the protocol.
|
for a detailed description of the protocol.
|
||||||
.Bl -tag -width Ds
|
.Bl -tag -width Ds
|
||||||
.It Fl a
|
.It Fl a
|
||||||
@ -72,6 +75,8 @@ List directory paths of mount points instead of hosts
|
|||||||
Show the
|
Show the
|
||||||
.Ar host Ns 's
|
.Ar host Ns 's
|
||||||
exports list
|
exports list
|
||||||
|
.It Fl 3
|
||||||
|
Use mount protocol Version 3, compatible with NFS Version 3.
|
||||||
.El
|
.El
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr mount 1 ,
|
.Xr mount 1 ,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* $NetBSD: showmount.c,v 1.4 1994/12/24 17:38:52 cgd Exp $ */
|
/* $NetBSD: showmount.c,v 1.5 1995/08/31 22:26:08 jtc Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1989, 1993
|
* Copyright (c) 1989, 1993, 1995
|
||||||
* The Regents of the University of California. All rights reserved.
|
* The Regents of the University of California. All rights reserved.
|
||||||
*
|
*
|
||||||
* This code is derived from software contributed to Berkeley by
|
* This code is derived from software contributed to Berkeley by
|
||||||
@ -38,29 +38,32 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
static char copyright[] =
|
||||||
"@(#) Copyright (c) 1989, 1993\n\
|
"@(#) Copyright (c) 1989, 1993, 1995\n\
|
||||||
The Regents of the University of California. All rights reserved.\n";
|
The Regents of the University of California. All rights reserved.\n";
|
||||||
#endif not lint
|
#endif not lint
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)showmount.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)showmount.c 8.3 (Berkeley) 3/29/95";
|
||||||
#endif
|
#endif
|
||||||
static char rcsid[] = "$NetBSD: showmount.c,v 1.4 1994/12/24 17:38:52 cgd Exp $";
|
static char rcsid[] = "$NetBSD: showmount.c,v 1.5 1995/08/31 22:26:08 jtc Exp $";
|
||||||
#endif not lint
|
#endif not lint
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/socketvar.h>
|
#include <sys/socketvar.h>
|
||||||
|
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <rpc/rpc.h>
|
#include <rpc/rpc.h>
|
||||||
#include <rpc/pmap_clnt.h>
|
#include <rpc/pmap_clnt.h>
|
||||||
#include <rpc/pmap_prot.h>
|
#include <rpc/pmap_prot.h>
|
||||||
#include <nfs/rpcv2.h>
|
#include <nfs/rpcv2.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
/* Constant defs */
|
/* Constant defs */
|
||||||
#define ALL 1
|
#define ALL 1
|
||||||
@ -90,29 +93,30 @@ struct exportslist {
|
|||||||
static struct mountlist *mntdump;
|
static struct mountlist *mntdump;
|
||||||
static struct exportslist *exports;
|
static struct exportslist *exports;
|
||||||
static int type = 0;
|
static int type = 0;
|
||||||
int xdr_mntdump(), xdr_exports();
|
|
||||||
|
void print_dump __P((struct mountlist *));
|
||||||
|
void usage __P((void));
|
||||||
|
int xdr_mntdump __P((XDR *, struct mountlist **));
|
||||||
|
int xdr_exports __P((XDR *, struct exportslist **));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This command queries the NFS mount daemon for it's mount list and/or
|
* This command queries the NFS mount daemon for it's mount list and/or
|
||||||
* it's exports list and prints them out.
|
* it's exports list and prints them out.
|
||||||
* See "NFS: Network File System Protocol Specification, RFC1094, Appendix A"
|
* See "NFS: Network File System Protocol Specification, RFC1094, Appendix A"
|
||||||
|
* and the "Network File System Protocol XXX.."
|
||||||
* for detailed information on the protocol.
|
* for detailed information on the protocol.
|
||||||
*/
|
*/
|
||||||
|
int
|
||||||
main(argc, argv)
|
main(argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
{
|
{
|
||||||
register struct mountlist *mntp;
|
struct exportslist *exp;
|
||||||
register struct exportslist *exp;
|
struct grouplist *grp;
|
||||||
register struct grouplist *grp;
|
int estat, rpcs = 0, mntvers = 1;
|
||||||
extern char *optarg;
|
char ch, *host;
|
||||||
extern int optind;
|
|
||||||
register int rpcs = 0;
|
|
||||||
char ch;
|
|
||||||
char *host;
|
|
||||||
int estat;
|
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "ade")) != EOF)
|
while ((ch = getopt(argc, argv, "ade3")) != EOF)
|
||||||
switch((char)ch) {
|
switch((char)ch) {
|
||||||
case 'a':
|
case 'a':
|
||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
@ -131,6 +135,9 @@ main(argc, argv)
|
|||||||
case 'e':
|
case 'e':
|
||||||
rpcs |= DOEXPORTS;
|
rpcs |= DOEXPORTS;
|
||||||
break;
|
break;
|
||||||
|
case '3':
|
||||||
|
mntvers = 3;
|
||||||
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
@ -147,19 +154,19 @@ main(argc, argv)
|
|||||||
rpcs = DODUMP;
|
rpcs = DODUMP;
|
||||||
|
|
||||||
if (rpcs & DODUMP)
|
if (rpcs & DODUMP)
|
||||||
if ((estat = callrpc(host, RPCPROG_MNT, RPCMNT_VER1,
|
if ((estat = callrpc(host, RPCPROG_MNT, mntvers,
|
||||||
RPCMNT_DUMP, xdr_void, (char *)0,
|
RPCMNT_DUMP, xdr_void, (char *)0,
|
||||||
xdr_mntdump, (char *)&mntdump)) != 0) {
|
xdr_mntdump, (char *)&mntdump)) != 0) {
|
||||||
clnt_perrno(estat);
|
clnt_perrno(estat);
|
||||||
fprintf(stderr, "Can't do Mountdump rpc\n");
|
fprintf(stderr, ": Can't do Mountdump rpc\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (rpcs & DOEXPORTS)
|
if (rpcs & DOEXPORTS)
|
||||||
if ((estat = callrpc(host, RPCPROG_MNT, RPCMNT_VER1,
|
if ((estat = callrpc(host, RPCPROG_MNT, mntvers,
|
||||||
RPCMNT_EXPORT, xdr_void, (char *)0,
|
RPCMNT_EXPORT, xdr_void, (char *)0,
|
||||||
xdr_exports, (char *)&exports)) != 0) {
|
xdr_exports, (char *)&exports)) != 0) {
|
||||||
clnt_perrno(estat);
|
clnt_perrno(estat);
|
||||||
fprintf(stderr, "Can't do Exports rpc\n");
|
fprintf(stderr, ": Can't do Exports rpc\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,20 +203,20 @@ main(argc, argv)
|
|||||||
exp = exp->ex_next;
|
exp = exp->ex_next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Xdr routine for retrieving the mount dump list
|
* Xdr routine for retrieving the mount dump list
|
||||||
*/
|
*/
|
||||||
|
int
|
||||||
xdr_mntdump(xdrsp, mlp)
|
xdr_mntdump(xdrsp, mlp)
|
||||||
XDR *xdrsp;
|
XDR *xdrsp;
|
||||||
struct mountlist **mlp;
|
struct mountlist **mlp;
|
||||||
{
|
{
|
||||||
register struct mountlist *mp;
|
struct mountlist *mp, **otp, *tp;
|
||||||
register struct mountlist *tp;
|
int bool, val, val2;
|
||||||
register struct mountlist **otp;
|
|
||||||
int val, val2;
|
|
||||||
int bool;
|
|
||||||
char *strp;
|
char *strp;
|
||||||
|
|
||||||
*mlp = (struct mountlist *)0;
|
*mlp = (struct mountlist *)0;
|
||||||
@ -282,12 +289,13 @@ next:
|
|||||||
/*
|
/*
|
||||||
* Xdr routine to retrieve exports list
|
* Xdr routine to retrieve exports list
|
||||||
*/
|
*/
|
||||||
|
int
|
||||||
xdr_exports(xdrsp, exp)
|
xdr_exports(xdrsp, exp)
|
||||||
XDR *xdrsp;
|
XDR *xdrsp;
|
||||||
struct exportslist **exp;
|
struct exportslist **exp;
|
||||||
{
|
{
|
||||||
register struct exportslist *ep;
|
struct exportslist *ep;
|
||||||
register struct grouplist *gp;
|
struct grouplist *gp;
|
||||||
int bool, grpbool;
|
int bool, grpbool;
|
||||||
char *strp;
|
char *strp;
|
||||||
|
|
||||||
@ -324,8 +332,10 @@ xdr_exports(xdrsp, exp)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
|
|
||||||
fprintf(stderr, "usage: showmount [-ade] host\n");
|
fprintf(stderr, "usage: showmount [-ade] host\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -333,6 +343,7 @@ usage()
|
|||||||
/*
|
/*
|
||||||
* Print the binary tree in inorder so that output is sorted.
|
* Print the binary tree in inorder so that output is sorted.
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
print_dump(mp)
|
print_dump(mp)
|
||||||
struct mountlist *mp;
|
struct mountlist *mp;
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user