[Midnightbsd-cvs] src [11542] trunk/usr.bin/fstat: make some stuff static
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Jul 7 16:38:56 EDT 2018
Revision: 11542
http://svnweb.midnightbsd.org/src/?rev=11542
Author: laffer1
Date: 2018-07-07 16:38:56 -0400 (Sat, 07 Jul 2018)
Log Message:
-----------
make some stuff static
Modified Paths:
--------------
trunk/usr.bin/fstat/Makefile
trunk/usr.bin/fstat/fstat.1
trunk/usr.bin/fstat/fstat.c
trunk/usr.bin/fstat/fuser.c
Property Changed:
----------------
trunk/usr.bin/fstat/fstat.1
Modified: trunk/usr.bin/fstat/Makefile
===================================================================
--- trunk/usr.bin/fstat/Makefile 2018-07-07 20:38:03 UTC (rev 11541)
+++ trunk/usr.bin/fstat/Makefile 2018-07-07 20:38:56 UTC (rev 11542)
@@ -1,10 +1,11 @@
+# $MidnightBSD$
# @(#)Makefile 8.1 (Berkeley) 6/6/93
-# $MidnightBSD$
+# $FreeBSD: stable/10/usr.bin/fstat/Makefile 235642 2012-05-19 05:07:03Z marcel $
PROG= fstat
SRCS= fstat.c fuser.c main.c
LINKS= ${BINDIR}/fstat ${BINDIR}/fuser
-DPADD= ${LIBKVM}
+DPADD= ${LIBKVM} ${LIBUTIL} ${LIBPROCSTAT}
LDADD= -lkvm -lutil -lprocstat
MAN1= fuser.1 fstat.1
Modified: trunk/usr.bin/fstat/fstat.1
===================================================================
--- trunk/usr.bin/fstat/fstat.1 2018-07-07 20:38:03 UTC (rev 11541)
+++ trunk/usr.bin/fstat/fstat.1 2018-07-07 20:38:56 UTC (rev 11542)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
.\" Copyright (c) 1987, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
@@ -26,9 +27,9 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)fstat.1 8.3 (Berkeley) 2/25/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.bin/fstat/fstat.1 250223 2013-05-03 21:11:57Z jhb $
.\"
-.Dd July 9, 2009
+.Dd September 28, 2011
.Dt FSTAT 1
.Os
.Sh NAME
@@ -142,7 +143,7 @@
If the
.Fl n
flag is specified, this header is present and is the
-major/minor number of the device that this file resides in.
+number of the device that this file resides in.
.It Li INUM
The inode number of the file.
.It Li MODE
@@ -155,6 +156,8 @@
otherwise, the mode is printed
as an octal number.
.It Li SZ\&|DV
+If the file is a semaphore,
+prints the current value of the semaphore.
If the file is not a character or block special, prints the size of
the file in bytes.
Otherwise, if the
Property changes on: trunk/usr.bin/fstat/fstat.1
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.bin/fstat/fstat.c
===================================================================
--- trunk/usr.bin/fstat/fstat.c 2018-07-07 20:38:03 UTC (rev 11541)
+++ trunk/usr.bin/fstat/fstat.c 2018-07-07 20:38:56 UTC (rev 11542)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2009 Stanislav Sedov <stas at FreeBSD.org>
* Copyright (c) 1988, 1993
@@ -29,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/fstat/fstat.c 250223 2013-05-03 21:11:57Z jhb $");
#include <sys/param.h>
#include <sys/user.h>
@@ -57,13 +58,13 @@
#include "functions.h"
-int fsflg, /* show files on same filesystem as file(s) argument */
- pflg, /* show files open by a particular pid */
- uflg; /* show files open by a particular (effective) user */
-int checkfile; /* true if restricting to particular files or filesystems */
-int nflg; /* (numerical) display f.s. and rdev as dev_t */
-int mflg; /* include memory-mapped files */
-int vflg; /* be verbose */
+static int fsflg, /* show files on same filesystem as file(s) argument */
+ pflg, /* show files open by a particular pid */
+ uflg; /* show files open by a particular (effective) user */
+static int checkfile; /* restrict to particular files or filesystems */
+static int nflg; /* (numerical) display f.s. and rdev as dev_t */
+static int mflg; /* include memory-mapped files */
+static int vflg; /* be verbose */
typedef struct devs {
struct devs *next;
@@ -72,8 +73,8 @@
const char *name;
} DEVS;
-DEVS *devs;
-char *memf, *nlistf;
+static DEVS *devs;
+static char *memf, *nlistf;
static int getfname(const char *filename);
static void dofiles(struct procstat *procstat, struct kinfo_proc *p);
@@ -84,6 +85,8 @@
struct filestat *fst);
static void print_pts_info(struct procstat *procstat,
struct filestat *fst);
+static void print_sem_info(struct procstat *procstat,
+ struct filestat *fst);
static void print_shm_info(struct procstat *procstat,
struct filestat *fst);
static void print_socket_info(struct procstat *procstat,
@@ -152,7 +155,7 @@
if (getfname(*argv))
checkfile = 1;
}
- if (!checkfile) /* file(s) specified, but none accessable */
+ if (!checkfile) /* file(s) specified, but none accessible */
exit(1);
}
@@ -244,7 +247,7 @@
for (d = devs; d != NULL; d = d->next)
if (d->fsid == vn.vn_fsid) {
fsmatch = 1;
- if ((unsigned)d->ino == vn.vn_fileid) {
+ if (d->ino == vn.vn_fileid) {
filename = d->name;
break;
}
@@ -294,6 +297,9 @@
case PS_FST_TYPE_SHM:
print_shm_info(procstat, fst);
break;
+ case PS_FST_TYPE_SEM:
+ print_sem_info(procstat, fst);
+ break;
default:
if (vflg)
fprintf(stderr,
@@ -416,7 +422,7 @@
}
printf("* pseudo-terminal master ");
if (nflg || !*pts.devname) {
- printf("%10d,%-2d", major(pts.dev), minor(pts.dev));
+ printf("%#10jx", (uintmax_t)pts.dev);
} else {
printf("%10s", pts.devname);
}
@@ -424,6 +430,30 @@
}
static void
+print_sem_info(struct procstat *procstat, struct filestat *fst)
+{
+ struct semstat sem;
+ char errbuf[_POSIX2_LINE_MAX];
+ char mode[15];
+ int error;
+
+ error = procstat_get_sem_info(procstat, fst, &sem, errbuf);
+ if (error != 0) {
+ printf("* error");
+ return;
+ }
+ if (nflg) {
+ printf(" ");
+ (void)snprintf(mode, sizeof(mode), "%o", sem.mode);
+ } else {
+ printf(" %-15s", fst->fs_path != NULL ? fst->fs_path : "-");
+ strmode(sem.mode, mode);
+ }
+ printf(" %10s %6u", mode, sem.value);
+ print_access_flags(fst->fs_fflags);
+}
+
+static void
print_shm_info(struct procstat *procstat, struct filestat *fst)
{
struct shmstat shm;
@@ -470,7 +500,7 @@
}
if (nflg)
- printf(" %2d,%-2d", major(vn.vn_fsid), minor(vn.vn_fsid));
+ printf(" %#5jx", (uintmax_t)vn.vn_fsid);
else if (vn.vn_mntdir != NULL)
(void)printf(" %-8s", vn.vn_mntdir);
@@ -486,7 +516,7 @@
if (vn.vn_type == PS_FST_VTYPE_VBLK || vn.vn_type == PS_FST_VTYPE_VCHR) {
if (nflg || !*vn.vn_devname)
- printf(" %2d,%-2d", major(vn.vn_dev), minor(vn.vn_dev));
+ printf(" %#6jx", (uintmax_t)vn.vn_dev);
else {
printf(" %6s", vn.vn_devname);
}
Modified: trunk/usr.bin/fstat/fuser.c
===================================================================
--- trunk/usr.bin/fstat/fuser.c 2018-07-07 20:38:03 UTC (rev 11541)
+++ trunk/usr.bin/fstat/fuser.c 2018-07-07 20:38:56 UTC (rev 11542)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2005-2009 Stanislav Sedov <stas at FreeBSD.org>
* All rights reserved.
@@ -25,7 +26,7 @@
*
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/fstat/fuser.c 227239 2011-11-06 18:49:36Z ed $");
#include <sys/queue.h>
#include <sys/stat.h>
@@ -52,7 +53,7 @@
/*
* File access mode flags table.
*/
-struct {
+static const struct {
int flag;
char ch;
} fflags[] = {
@@ -67,7 +68,7 @@
/*
* Usage flags translation table.
*/
-struct {
+static const struct {
int flag;
char ch;
} uflags[] = {
More information about the Midnightbsd-cvs
mailing list