From 8f6b3bafaf8d8193f28c43c7ab41b1a453bb4f10 Mon Sep 17 00:00:00 2001 From: deraadt Date: Fri, 16 Jan 2015 00:03:37 +0000 Subject: [PATCH] first batch of programs adapting to the namespace cleanup (pfvar.h nameser.h proc.h ucred.h) ok guenther millert, and some review from doug as well. --- usr.bin/systat/cpu.c | 4 ++-- usr.bin/systat/if.c | 6 +++--- usr.bin/systat/inetname.c | 4 ++-- usr.bin/systat/iostat.c | 5 +++-- usr.bin/systat/main.c | 5 ++--- usr.bin/systat/malloc.c | 5 +++-- usr.bin/systat/mbufs.c | 7 ++++--- usr.bin/systat/netstat.c | 6 ++++-- usr.bin/systat/nfs.c | 5 +++-- usr.bin/systat/pf.c | 3 ++- usr.bin/systat/pftop.c | 5 +++-- usr.bin/systat/pigs.c | 5 +++-- usr.bin/systat/pool.c | 5 +++-- usr.bin/systat/sensors.c | 5 +++-- usr.bin/systat/swap.c | 5 +++-- usr.bin/systat/vmstat.c | 13 ++++++++----- 16 files changed, 51 insertions(+), 37 deletions(-) diff --git a/usr.bin/systat/cpu.c b/usr.bin/systat/cpu.c index 512a8807db9..520bb9389f8 100644 --- a/usr.bin/systat/cpu.c +++ b/usr.bin/systat/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.3 2014/09/15 19:08:21 miod Exp $ */ +/* $OpenBSD: cpu.c,v 1.4 2015/01/16 00:03:37 deraadt Exp $ */ /* * Copyright (c) 2013 Reyk Floeter @@ -46,7 +46,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include diff --git a/usr.bin/systat/if.c b/usr.bin/systat/if.c index 9f83ad943b1..18e9a4f4706 100644 --- a/usr.bin/systat/if.c +++ b/usr.bin/systat/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.22 2014/10/08 04:10:04 doug Exp $ */ +/* $OpenBSD: if.c,v 1.23 2015/01/16 00:03:37 deraadt Exp $ */ /* * Copyright (c) 2004 Markus Friedl * @@ -15,8 +15,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include -#include +#include /* roundup */ +#include #include #include #include diff --git a/usr.bin/systat/inetname.c b/usr.bin/systat/inetname.c index effa249b26d..3503ce5b6b5 100644 --- a/usr.bin/systat/inetname.c +++ b/usr.bin/systat/inetname.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inetname.c,v 1.1 2010/07/22 12:33:29 giovanni Exp $ */ +/* $OpenBSD: inetname.c,v 1.2 2015/01/16 00:03:37 deraadt Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -29,7 +29,7 @@ * SUCH DAMAGE. */ -#include +#include #include #include diff --git a/usr.bin/systat/iostat.c b/usr.bin/systat/iostat.c index cb3601e1a69..902084214ec 100644 --- a/usr.bin/systat/iostat.c +++ b/usr.bin/systat/iostat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iostat.c,v 1.44 2014/11/23 04:34:48 guenther Exp $ */ +/* $OpenBSD: iostat.c,v 1.45 2015/01/16 00:03:37 deraadt Exp $ */ /* $NetBSD: iostat.c,v 1.5 1996/05/10 23:16:35 thorpej Exp $ */ /* @@ -30,8 +30,9 @@ * SUCH DAMAGE. */ -#include +#include #include +#include #include #include #include diff --git a/usr.bin/systat/main.c b/usr.bin/systat/main.c index 258603a5adb..9a7ff7194a1 100644 --- a/usr.bin/systat/main.c +++ b/usr.bin/systat/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.60 2013/09/07 11:43:50 reyk Exp $ */ +/* $Id: main.c,v 1.61 2015/01/16 00:03:37 deraadt Exp $ */ /* * Copyright (c) 2001, 2007 Can Erkin Acar * Copyright (c) 2001 Daniel Hartmeier @@ -31,7 +31,6 @@ */ #include -#include #include @@ -65,7 +64,7 @@ double naptime = 5.0; int verbose = 1; /* to report kvm read errs */ int nflag = 1; int ut, hz, stathz; -char hostname[MAXHOSTNAMELEN]; +char hostname[HOST_NAME_MAX+1]; WINDOW *wnd; int CMDLINE; char timebuf[26]; diff --git a/usr.bin/systat/malloc.c b/usr.bin/systat/malloc.c index 7d93c396030..bd7fb631547 100644 --- a/usr.bin/systat/malloc.c +++ b/usr.bin/systat/malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.c,v 1.2 2011/03/02 06:48:17 jasper Exp $ */ +/* $OpenBSD: malloc.c,v 1.3 2015/01/16 00:03:37 deraadt Exp $ */ /* * Copyright (c) 2008 Can Erkin Acar * @@ -16,12 +16,13 @@ */ #include -#include +#include #include #include #include #include #include +#include #include "systat.h" diff --git a/usr.bin/systat/mbufs.c b/usr.bin/systat/mbufs.c index 158d5ed91d1..e9b2fe315ba 100644 --- a/usr.bin/systat/mbufs.c +++ b/usr.bin/systat/mbufs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mbufs.c,v 1.37 2014/11/06 12:50:55 dlg Exp $ */ +/* $OpenBSD: mbufs.c,v 1.38 2015/01/16 00:03:37 deraadt Exp $ */ /* * Copyright (c) 2008 Can Erkin Acar * @@ -14,8 +14,9 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include -#include + +#include /* MSIZE */ +#include #include #include #include diff --git a/usr.bin/systat/netstat.c b/usr.bin/systat/netstat.c index ae8d9366ed5..e40bc186c19 100644 --- a/usr.bin/systat/netstat.c +++ b/usr.bin/systat/netstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netstat.c,v 1.42 2014/10/24 10:18:49 schwarze Exp $ */ +/* $OpenBSD: netstat.c,v 1.43 2015/01/16 00:03:37 deraadt Exp $ */ /* $NetBSD: netstat.c,v 1.3 1995/06/18 23:53:07 cgd Exp $ */ /*- @@ -33,7 +33,9 @@ /* * netstat */ -#include + +#include /* MSIZE */ +#include #include #include #include diff --git a/usr.bin/systat/nfs.c b/usr.bin/systat/nfs.c index c082ffa8db2..cb74afdca11 100644 --- a/usr.bin/systat/nfs.c +++ b/usr.bin/systat/nfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs.c,v 1.6 2011/03/02 06:48:17 jasper Exp $ */ +/* $OpenBSD: nfs.c,v 1.7 2015/01/16 00:03:37 deraadt Exp $ */ /* * Copyright (c) 2009 Jasper Lievisse Adriaanse @@ -17,8 +17,9 @@ * */ -#include +#include #include +#include #include #include #include diff --git a/usr.bin/systat/pf.c b/usr.bin/systat/pf.c index 0cfc56d887a..08336183d34 100644 --- a/usr.bin/systat/pf.c +++ b/usr.bin/systat/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.6 2014/08/14 12:55:50 mpi Exp $ */ +/* $OpenBSD: pf.c,v 1.7 2015/01/16 00:03:37 deraadt Exp $ */ /* * Copyright (c) 2001, 2007 Can Erkin Acar * @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include diff --git a/usr.bin/systat/pftop.c b/usr.bin/systat/pftop.c index 582fd016d8d..33fed4501f4 100644 --- a/usr.bin/systat/pftop.c +++ b/usr.bin/systat/pftop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pftop.c,v 1.29 2014/10/11 04:30:56 doug Exp $ */ +/* $OpenBSD: pftop.c,v 1.30 2015/01/16 00:03:37 deraadt Exp $ */ /* * Copyright (c) 2001, 2007 Can Erkin Acar * Copyright (c) 2001 Daniel Hartmeier @@ -54,6 +54,7 @@ #include #include #include +#include #include #include "systat.h" @@ -997,7 +998,7 @@ read_anchor_rules(char *anchor) } struct anchor_name { - char name[MAXPATHLEN]; + char name[PATH_MAX]; struct anchor_name *next; u_int32_t ref; }; diff --git a/usr.bin/systat/pigs.c b/usr.bin/systat/pigs.c index 57ef13a9038..515d9f22409 100644 --- a/usr.bin/systat/pigs.c +++ b/usr.bin/systat/pigs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pigs.c,v 1.28 2014/10/08 04:10:04 doug Exp $ */ +/* $OpenBSD: pigs.c,v 1.29 2015/01/16 00:03:37 deraadt Exp $ */ /* $NetBSD: pigs.c,v 1.3 1995/04/29 05:54:50 cgd Exp $ */ /*- @@ -34,7 +34,8 @@ * Pigs display from Bill Reeves at Lucasfilm */ -#include +#include /* MAXCOMLEN */ +#include #include #include #include diff --git a/usr.bin/systat/pool.c b/usr.bin/systat/pool.c index b4d3a24e04b..460d49967bb 100644 --- a/usr.bin/systat/pool.c +++ b/usr.bin/systat/pool.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pool.c,v 1.9 2014/10/08 04:10:04 doug Exp $ */ +/* $OpenBSD: pool.c,v 1.10 2015/01/16 00:03:37 deraadt Exp $ */ /* * Copyright (c) 2008 Can Erkin Acar * @@ -16,12 +16,13 @@ */ #include -#include +#include #include #include #include #include #include +#include #include "systat.h" diff --git a/usr.bin/systat/sensors.c b/usr.bin/systat/sensors.c index 16861750462..971a139562e 100644 --- a/usr.bin/systat/sensors.c +++ b/usr.bin/systat/sensors.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sensors.c,v 1.29 2014/10/08 04:10:04 doug Exp $ */ +/* $OpenBSD: sensors.c,v 1.30 2015/01/16 00:03:38 deraadt Exp $ */ /* * Copyright (c) 2007 Deanna Phillips @@ -19,7 +19,8 @@ * */ -#include +#include +#include #include #include diff --git a/usr.bin/systat/swap.c b/usr.bin/systat/swap.c index f15d4157906..b0cf4d1958a 100644 --- a/usr.bin/systat/swap.c +++ b/usr.bin/systat/swap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: swap.c,v 1.25 2014/11/23 04:34:48 guenther Exp $ */ +/* $OpenBSD: swap.c,v 1.26 2015/01/16 00:03:38 deraadt Exp $ */ /* $NetBSD: swap.c,v 1.9 1998/12/26 07:05:08 marc Exp $ */ /*- @@ -31,7 +31,8 @@ * SUCH DAMAGE. */ -#include +#include +#include #include #include #include diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c index a3dddd7cef1..6a644946f28 100644 --- a/usr.bin/systat/vmstat.c +++ b/usr.bin/systat/vmstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmstat.c,v 1.78 2014/11/23 04:34:48 guenther Exp $ */ +/* $OpenBSD: vmstat.c,v 1.79 2015/01/16 00:03:38 deraadt Exp $ */ /* $NetBSD: vmstat.c,v 1.5 1996/05/10 23:16:40 thorpej Exp $ */ /*- @@ -34,7 +34,8 @@ * Cursed vmstat -- from Robert Elz. */ -#include +#include /* MAXCOMLEN */ +#include #include #include #include @@ -53,6 +54,9 @@ #include #include "systat.h" +#include "dkstats.h" + +#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b)) static struct Info { long time[CPUSTATES]; @@ -63,7 +67,6 @@ static struct Info { u_quad_t *intrcnt; } s, s1, s2, s3, z; -#include "dkstats.h" extern struct _disk cur; #define cnt s.Cnt @@ -279,7 +282,7 @@ labelkre(void) mvprintw(DISKROW + 4, DISKCOL, " sec"); for (i = 0, j = 0; i < cur.dk_ndrive && j < DRIVESPACE; i++) if (cur.dk_select[i] && (j + strlen(dr_name[i])) < DRIVESPACE) { - l = MAX(5, strlen(dr_name[i])); + l = MAXIMUM(5, strlen(dr_name[i])); mvprintw(DISKROW, DISKCOL + 5 + j, " %*s", l, dr_name[i]); j += 1 + l; @@ -427,7 +430,7 @@ showkre(void) mvprintw(DISKROW, DISKCOL + 5, " "); for (i = 0, c = 0; i < cur.dk_ndrive && c < DRIVESPACE; i++) if (cur.dk_select[i] && (c + strlen(dr_name[i])) < DRIVESPACE) { - l = MAX(5, strlen(dr_name[i])); + l = MAXIMUM(5, strlen(dr_name[i])); mvprintw(DISKROW, DISKCOL + 5 + c, " %*s", l, dr_name[i]); c += 1 + l; -- 2.20.1