[Midnightbsd-cvs] src [10788] sync w with freebsd.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Jun 9 22:52:08 EDT 2018
Revision: 10788
http://svnweb.midnightbsd.org/src/?rev=10788
Author: laffer1
Date: 2018-06-09 22:52:07 -0400 (Sat, 09 Jun 2018)
Log Message:
-----------
sync w with freebsd.
Modified Paths:
--------------
trunk/usr.bin/w/Makefile
trunk/usr.bin/w/extern.h
trunk/usr.bin/w/pr_time.c
trunk/usr.bin/w/proc_compare.c
trunk/usr.bin/w/uptime.1
trunk/usr.bin/w/w.1
trunk/usr.bin/w/w.c
Property Changed:
----------------
trunk/usr.bin/w/uptime.1
trunk/usr.bin/w/w.1
Modified: trunk/usr.bin/w/Makefile
===================================================================
--- trunk/usr.bin/w/Makefile 2018-06-10 02:51:36 UTC (rev 10787)
+++ trunk/usr.bin/w/Makefile 2018-06-10 02:52:07 UTC (rev 10788)
@@ -1,5 +1,6 @@
+# $MidnightBSD$
# @(#)Makefile 8.1 (Berkeley) 6/6/93
-# $MidnightBSD$
+# $FreeBSD: stable/10/usr.bin/w/Makefile 288139 2015-09-23 01:07:45Z delphij $
PROG= w
SRCS= fmt.c pr_time.c proc_compare.c w.c
@@ -6,8 +7,6 @@
MAN= w.1 uptime.1
DPADD= ${LIBKVM} ${LIBUTIL}
LDADD= -lkvm -lutil
-#BINGRP= kmem
-#BINMODE=2555
LINKS= ${BINDIR}/w ${BINDIR}/uptime
.PATH: ${.CURDIR}/../../bin/ps
Modified: trunk/usr.bin/w/extern.h
===================================================================
--- trunk/usr.bin/w/extern.h 2018-06-10 02:51:36 UTC (rev 10787)
+++ trunk/usr.bin/w/extern.h 2018-06-10 02:52:07 UTC (rev 10788)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
@@ -27,10 +28,9 @@
* SUCH DAMAGE.
*
* @(#)extern.h 8.1 (Berkeley) 6/6/93
- * $MidnightBSD$
+ * $FreeBSD: stable/10/usr.bin/w/extern.h 243183 2012-11-17 16:47:05Z ed $
*/
-
extern int use_ampm;
struct kinfo_proc;
Modified: trunk/usr.bin/w/pr_time.c
===================================================================
--- trunk/usr.bin/w/pr_time.c 2018-06-10 02:51:36 UTC (rev 10787)
+++ trunk/usr.bin/w/pr_time.c 2018-06-10 02:52:07 UTC (rev 10788)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -29,7 +30,7 @@
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/w/pr_time.c 216370 2010-12-11 08:32:16Z joel $");
#ifndef lint
static const char sccsid[] = "@(#)pr_time.c 8.2 (Berkeley) 4/4/94";
Modified: trunk/usr.bin/w/proc_compare.c
===================================================================
--- trunk/usr.bin/w/proc_compare.c 2018-06-10 02:51:36 UTC (rev 10787)
+++ trunk/usr.bin/w/proc_compare.c 2018-06-10 02:52:07 UTC (rev 10788)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -34,7 +35,7 @@
#endif
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/w/proc_compare.c 243183 2012-11-17 16:47:05Z ed $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -62,11 +63,11 @@
* TODO - consider whether pctcpu should be used.
*/
-#define ISRUN(p) (((p)->ki_stat == SRUN) || ((p)->ki_stat == SIDL))
-#define TESTAB(a, b) ((a)<<1 | (b))
-#define ONLYA 2
-#define ONLYB 1
-#define BOTH 3
+#define ISRUN(p) (((p)->ki_stat == SRUN) || ((p)->ki_stat == SIDL))
+#define TESTAB(a, b) ((a)<<1 | (b))
+#define ONLYA 2
+#define ONLYB 1
+#define BOTH 3
int
proc_compare(struct kinfo_proc *p1, struct kinfo_proc *p2)
@@ -93,7 +94,7 @@
return (p2->ki_pid > p1->ki_pid); /* tie - return highest pid */
}
/*
- * weed out zombies
+ * weed out zombies
*/
switch (TESTAB(p1->ki_stat == SZOMB, p2->ki_stat == SZOMB)) {
case ONLYA:
Modified: trunk/usr.bin/w/uptime.1
===================================================================
--- trunk/usr.bin/w/uptime.1 2018-06-10 02:51:36 UTC (rev 10787)
+++ trunk/usr.bin/w/uptime.1 2018-06-10 02:52:07 UTC (rev 10788)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
.\" Copyright (c) 1980, 1990, 1993, 1994
.\" The Regents of the University of California. All rights reserved.
.\"
@@ -26,7 +27,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)uptime.1 8.2 (Berkeley) 4/18/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.bin/w/uptime.1 216370 2010-12-11 08:32:16Z joel $
.\"
.Dd April 18, 1994
.Dt UPTIME 1
Property changes on: trunk/usr.bin/w/uptime.1
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.bin/w/w.1
===================================================================
--- trunk/usr.bin/w/w.1 2018-06-10 02:51:36 UTC (rev 10787)
+++ trunk/usr.bin/w/w.1 2018-06-10 02:52:07 UTC (rev 10788)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
.\" Copyright (c) 1980, 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
@@ -26,7 +27,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)w.1 8.1 (Berkeley) 6/6/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.bin/w/w.1 240506 2012-09-14 17:50:42Z eadler $
.\"
.Dd January 21, 2010
.Dt W 1
Property changes on: trunk/usr.bin/w/w.1
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.bin/w/w.c
===================================================================
--- trunk/usr.bin/w/w.c 2018-06-10 02:51:36 UTC (rev 10787)
+++ trunk/usr.bin/w/w.c 2018-06-10 02:52:07 UTC (rev 10788)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -29,7 +30,7 @@
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/w/w.c 288139 2015-09-23 01:07:45Z delphij $");
#ifndef lint
static const char copyright[] =
@@ -85,25 +86,24 @@
#include "extern.h"
-struct timeval boottime;
-struct utmpx *utmp;
-struct winsize ws;
-kvm_t *kd;
-time_t now; /* the current time of day */
-int ttywidth; /* width of tty */
-int argwidth; /* width of tty */
-int header = 1; /* true if -h flag: don't print heading */
-int nflag; /* true if -n flag: don't convert addrs */
-int dflag; /* true if -d flag: output debug info */
-int sortidle; /* sort by idle time */
+static struct utmpx *utmp;
+static struct winsize ws;
+static kvm_t *kd;
+static time_t now; /* the current time of day */
+static int ttywidth; /* width of tty */
+static int argwidth; /* width of tty */
+static int header = 1; /* true if -h flag: don't print heading */
+static int nflag; /* true if -n flag: don't convert addrs */
+static int dflag; /* true if -d flag: output debug info */
+static int sortidle; /* sort by idle time */
int use_ampm; /* use AM/PM time */
-int use_comma; /* use comma as floats separator */
-char **sel_users; /* login array of particular users selected */
+static int use_comma; /* use comma as floats separator */
+static char **sel_users; /* login array of particular users selected */
/*
* One of these per active utmp entry.
*/
-struct entry {
+static struct entry {
struct entry *next;
struct utmpx utmp;
dev_t tdev; /* dev_t of terminal */
@@ -133,7 +133,7 @@
struct kinfo_proc *dkp;
struct stat *stp;
time_t touched;
- int ch, i, nentries, nusers, wcmd, longidle, longattime, dropgid;
+ int ch, i, nentries, nusers, wcmd, longidle, longattime;
const char *memf, *nlistf, *p;
char *x_suffix;
char buf[MAXHOSTNAMELEN], errbuf[_POSIX2_LINE_MAX];
@@ -153,7 +153,6 @@
p = "dhiflM:N:nsuw";
}
- dropgid = 0;
memf = _PATH_DEVNULL;
nlistf = NULL;
while ((ch = getopt(argc, argv, p)) != -1)
@@ -170,11 +169,9 @@
case 'M':
header = 0;
memf = optarg;
- dropgid = 1;
break;
case 'N':
nlistf = optarg;
- dropgid = 1;
break;
case 'n':
nflag = 1;
@@ -194,13 +191,6 @@
_res.retrans = 2; /* resolver timeout to 2 seconds per try */
_res.retry = 1; /* only try once.. */
- /*
- * Discard setgid privileges if not the running kernel so that bad
- * guys can't print interesting stuff from kernel memory.
- */
- if (dropgid)
- setgid(getgid());
-
if ((kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf)) == NULL)
errx(1, "%s", errbuf);
More information about the Midnightbsd-cvs
mailing list