changeset 21393:b2ac1bdfc9d1

11060 sys/zone.h exposes more than it should Reviewed by: Andrew Stormont <andyjstormont@gmail.com> Reviewed by: Toomas Soome <tsoome@me.com> Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com> Reviewed by: Michal Nowak <mnowak@startmail.com> Approved by: Richard Lowe <richlowe@richlowe.net>
author Gordon Ross <gwr@nexenta.com>
date Wed, 22 May 2019 18:11:33 -0400
parents f61333f502f3
children 82bd57df837e
files usr/src/cmd/lp/include/printers.h usr/src/cmd/smbsrv/smbstat/smbstat.c usr/src/uts/common/sys/tsol/tndb.h usr/src/uts/common/sys/zone.h
diffstat 4 files changed, 19 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/lp/include/printers.h	Sun Apr 30 20:35:53 2017 -0400
+++ b/usr/src/cmd/lp/include/printers.h	Wed May 22 18:11:33 2019 -0400
@@ -32,16 +32,6 @@
 #define	_LP_PRINTERS_H
 
 /*
- * The following conflicts are also defined in sys/processor.h.
- */
-#if defined PS_FAULTED
-#undef  PS_FAULTED
-#endif
-#if defined PS_DISABLED
-#undef  PS_DISABLED
-#endif
-
-/*
  * Define the following to support administrator configurable
  * streams modules:
  */
--- a/usr/src/cmd/smbsrv/smbstat/smbstat.c	Sun Apr 30 20:35:53 2017 -0400
+++ b/usr/src/cmd/smbsrv/smbstat/smbstat.c	Wed May 22 18:11:33 2019 -0400
@@ -102,6 +102,7 @@
 #include <math.h>
 #include <umem.h>
 #include <locale.h>
+#include <sys/processor.h>
 #include <smbsrv/smb_kstat.h>
 
 #if !defined(TEXT_DOMAIN)
--- a/usr/src/uts/common/sys/tsol/tndb.h	Sun Apr 30 20:35:53 2017 -0400
+++ b/usr/src/uts/common/sys/tsol/tndb.h	Wed May 22 18:11:33 2019 -0400
@@ -248,6 +248,7 @@
 } tsol_zcent_t;
 #define	TSOL_MLP_END(mlp)	((mlp)->mlp_ipp == 0 && (mlp)->mlp_port == 0)
 
+#if (defined(_KERNEL) || defined(_KMEMUSER))
 typedef struct tsol_tpc {
 	kmutex_t		tpc_lock;	/* lock for structure */
 	uint_t			tpc_refcnt;	/* reference count */
@@ -265,6 +266,7 @@
 	char			rhc_isbcast;	/* broadcast address */
 	char			rhc_local;	/* loopback or local interace */
 } tsol_tnrhc_t;
+#endif	/* _KERNEL || _KMEMUSER */
 
 /* Size of remote host hash tables in kernel */
 #define	TNRHC_SIZE 256
@@ -361,11 +363,13 @@
 	in_addr_t		ip_address;
 } tsol_address_t;
 
+#if (defined(_KERNEL) || defined(_KMEMUSER))
 /* This is shared between tcache and mdb */
 typedef struct tnrhc_hash_s {
 	tsol_tnrhc_t *tnrh_list;
 	kmutex_t tnrh_lock;
 } tnrhc_hash_t;
+#endif	/* _KERNEL || _KMEMUSER */
 
 #ifdef _KERNEL
 typedef enum {
--- a/usr/src/uts/common/sys/zone.h	Sun Apr 30 20:35:53 2017 -0400
+++ b/usr/src/uts/common/sys/zone.h	Wed May 22 18:11:33 2019 -0400
@@ -21,7 +21,7 @@
 /*
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2018 Joyent, Inc.
- * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2019 Nexenta Systems, Inc. All rights reserved.
  * Copyright 2014 Igor Kozhukhov <ikozhukhov@gmail.com>.
  */
 
@@ -29,20 +29,29 @@
 #define	_SYS_ZONE_H
 
 #include <sys/types.h>
+#include <sys/param.h>
+#include <sys/tsol/label.h>
+#include <sys/uadmin.h>
+#include <netinet/in.h>
+
+#ifdef _KERNEL
+/*
+ * Many includes are kernel-only to reduce namespace pollution of
+ * userland applications.
+ */
 #include <sys/mutex.h>
-#include <sys/param.h>
 #include <sys/rctl.h>
 #include <sys/ipc_rctl.h>
 #include <sys/pset.h>
-#include <sys/tsol/label.h>
 #include <sys/cred.h>
 #include <sys/netstack.h>
-#include <sys/uadmin.h>
 #include <sys/ksynch.h>
 #include <sys/socket_impl.h>
 #include <sys/secflags.h>
-#include <netinet/in.h>
 #include <sys/cpu_uarray.h>
+#include <sys/list.h>
+#include <sys/loadavg.h>
+#endif	/* _KERNEL */
 
 #ifdef	__cplusplus
 extern "C" {
@@ -322,13 +331,6 @@
 
 #ifdef _KERNEL
 
-/*
- * We need to protect the definition of 'list_t' from userland applications and
- * libraries which may be defining ther own versions.
- */
-#include <sys/list.h>
-#include <sys/loadavg.h>
-
 #define	GLOBAL_ZONEUNIQID	0	/* uniqid of the global zone */
 
 /*