summaryrefslogtreecommitdiff
path: root/usr/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/lib')
-rw-r--r--usr/src/lib/brand/lx/lx_init/lxinit.c221
-rw-r--r--usr/src/lib/libc/Makefile.targ2
-rw-r--r--usr/src/lib/libc/inc/libc.h5
-rw-r--r--usr/src/lib/libc/sparc/Makefile.com4
-rw-r--r--usr/src/lib/libc/sparc/fp/_D_cplx_mul.c4
-rw-r--r--usr/src/lib/libc/sparc/fp/_F_cplx_mul.c4
-rw-r--r--usr/src/lib/libc/sparc/fp/_Q_cplx_div.c4
-rw-r--r--usr/src/lib/libc/sparc/fp/_Q_cplx_div_ix.c4
-rw-r--r--usr/src/lib/libc/sparc/fp/_Q_cplx_div_rx.c4
-rw-r--r--usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div.c4
-rw-r--r--usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div_ix.c4
-rw-r--r--usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div_rx.c4
-rw-r--r--usr/src/lib/libc/sparc/fp/_Q_cplx_lr_mul.c4
-rw-r--r--usr/src/lib/libc/sparc/fp/_Q_cplx_mul.c4
-rw-r--r--usr/src/lib/libc/sparc/gen/getctxt.c9
-rw-r--r--usr/src/lib/libc/sparcv9/Makefile.com4
-rw-r--r--usr/src/lib/libc/sparcv9/gen/getctxt.c9
-rw-r--r--usr/src/lib/libdns_sd/Makefile.com2
-rw-r--r--usr/src/lib/libfru/libfruraw/fruraw.c11
-rw-r--r--usr/src/lib/libfru/libfruraw/raw_access.c2
-rw-r--r--usr/src/lib/libsldap/common/ns_confmgr.c28
-rw-r--r--usr/src/lib/libsldap/common/ns_reads.c14
-rw-r--r--usr/src/lib/nsswitch/ldap/common/getexecattr.c32
-rw-r--r--usr/src/lib/sun_sas/common/Sun_sasFreeLibrary.c1
-rw-r--r--usr/src/lib/sun_sas/common/Sun_sasLoadLibrary.c44
-rw-r--r--usr/src/lib/sun_sas/common/devtree_hba_disco.c2
-rw-r--r--usr/src/lib/sun_sas/common/sun_sas.h12
27 files changed, 265 insertions, 177 deletions
diff --git a/usr/src/lib/brand/lx/lx_init/lxinit.c b/usr/src/lib/brand/lx/lx_init/lxinit.c
index 983318c7eb..5f98d4598e 100644
--- a/usr/src/lib/brand/lx/lx_init/lxinit.c
+++ b/usr/src/lib/brand/lx/lx_init/lxinit.c
@@ -490,11 +490,34 @@ lxi_iface_ipv6_link_local(const char *iface)
return (0);
}
+static int lxi_route_send_msg(struct rt_msghdr *rtm)
+{
+ int sockfd, len;
+
+ if ((sockfd = socket(PF_ROUTE, SOCK_RAW, AF_INET)) < 0) {
+ lxi_warn("socket(PF_ROUTE): %s\n", strerror(errno));
+ return (-1);
+ }
+
+ if ((len = write(sockfd, (const void *)rtm, rtm->rtm_msglen)) < 0) {
+ lxi_warn("could not write rtmsg: %s", strerror(errno));
+ close(sockfd);
+ return (-1);
+ } else if (len < rtm->rtm_msglen) {
+ lxi_warn("write() rtmsg incomplete");
+ close(sockfd);
+ return (-1);
+ }
+
+ close(sockfd);
+ return (0);
+}
+
static int
lxi_iface_gateway(const char *iface, const char *dst, int dstpfx,
- const char *gwaddr)
+ const char *gwaddr, boolean_t llroute)
{
- int idx, len, sockfd;
+ int idx;
char rtbuf[RTMBUFSZ];
struct rt_msghdr *rtm = (struct rt_msghdr *)rtbuf;
struct sockaddr_in *dst_sin = (struct sockaddr_in *)
@@ -504,7 +527,10 @@ lxi_iface_gateway(const char *iface, const char *dst, int dstpfx,
(void) bzero(rtm, RTMBUFSZ);
rtm->rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK;
- rtm->rtm_flags = RTF_UP | RTF_STATIC | RTF_GATEWAY;
+
+ if (!llroute)
+ rtm->rtm_flags = RTF_UP | RTF_STATIC | RTF_GATEWAY;
+
rtm->rtm_msglen = sizeof (rtbuf);
rtm->rtm_pid = getpid();
rtm->rtm_type = RTM_ADD;
@@ -516,6 +542,15 @@ lxi_iface_gateway(const char *iface, const char *dst, int dstpfx,
* which represents the default gateway. If we were passed a more
* specific destination network, use that instead.
*/
+
+ if (dstpfx == -1) {
+ /*
+ * no prefix was specified; assume a prefix length of 32,
+ * which seems in line with the behavior of vmadm.
+ */
+ dstpfx = 32;
+ }
+
dst_sin->sin_family = AF_INET;
netmask_sin->sin_family = AF_INET;
if (dst != NULL) {
@@ -543,23 +578,7 @@ lxi_iface_gateway(const char *iface, const char *dst, int dstpfx,
rtm->rtm_index = idx;
}
- if ((sockfd = socket(PF_ROUTE, SOCK_RAW, AF_INET)) < 0) {
- lxi_warn("socket(PF_ROUTE): %s\n", strerror(errno));
- return (-1);
- }
-
- if ((len = write(sockfd, rtbuf, rtm->rtm_msglen)) < 0) {
- lxi_warn("could not write rtmsg: %s", strerror(errno));
- close(sockfd);
- return (-1);
- } else if (len < rtm->rtm_msglen) {
- lxi_warn("write() rtmsg incomplete");
- close(sockfd);
- return (-1);
- }
-
- close(sockfd);
- return (0);
+ return (lxi_route_send_msg(rtm));
}
static void
@@ -634,7 +653,7 @@ lxi_net_setup(zone_dochandle_t handle)
while (zonecfg_getnwifent(handle, &lookup) == Z_OK) {
const char *iface = lookup.zone_nwif_physical;
struct zone_res_attrtab *attrs = lookup.zone_nwif_attrp;
- const char *ipaddrs, *primary, *gateway;
+ const char *ipaddrs;
char ipaddrs_copy[MAXNAMELEN], cidraddr[BUFSIZ],
*ipaddr, *tmp, *lasts;
boolean_t first_ipv4_configured = B_FALSE;
@@ -684,12 +703,6 @@ lxi_net_setup(zone_dochandle_t handle)
"to interface %s", ipaddr, iface);
}
}
-
- if (zone_find_attr(attrs, "primary", &primary) == 0 &&
- strncmp(primary, "true", MAXNAMELEN) == 0 &&
- zone_find_attr(attrs, "gateway", &gateway) == 0) {
- lxi_iface_gateway(iface, NULL, 0, gateway);
- }
}
if (do_addrconf) {
@@ -700,31 +713,52 @@ lxi_net_setup(zone_dochandle_t handle)
}
static void
-lxi_net_static_route(const char *line)
+lxi_net_setup_gateways(zone_dochandle_t handle)
{
- /*
- * Each static route line is a string of the form:
- *
- * "10.77.77.2|10.1.1.0/24|false"
- *
- * i.e. gateway address, destination network, and whether this is
- * a "link local" route or a next hop route.
- */
- custr_t *cu = NULL;
- char *gw = NULL, *dst = NULL;
- int pfx = -1;
- int i;
+ struct zone_nwiftab lookup;
- if (custr_alloc(&cu) != 0) {
- lxi_err("custr_alloc failure");
+ if (zonecfg_setnwifent(handle) != Z_OK)
+ return;
+
+ while (zonecfg_getnwifent(handle, &lookup) == Z_OK) {
+ const char *iface = lookup.zone_nwif_physical;
+ struct zone_res_attrtab *attrs = lookup.zone_nwif_attrp;
+ const char *primary, *gateway;
+
+ if (zone_find_attr(attrs, "primary", &primary) == 0 &&
+ strcmp(primary, "true") == 0 &&
+ zone_find_attr(attrs, "gateway", &gateway) == 0) {
+ lxi_iface_gateway(iface, NULL, 0, gateway, B_FALSE);
+ }
}
+ (void) zonecfg_endnwifent(handle);
+}
+
+/*
+ * Parse a static route line string of the form:
+ *
+ * "10.77.77.2|10.1.1.0/24|false"
+ *
+ * i.e. gateway address, destination network, and whether this is
+ * a "link local" route or a next hop route.
+ */
+static void
+lxi_parse_route_line(const char *line, custr_t *cu, char *gw, char *dst,
+ int *pfx, size_t gwlen, size_t dstlen)
+{
+ int i;
+ boolean_t havegw = B_FALSE, havedst = B_FALSE, nopfx = B_FALSE;
+
for (i = 0; line[i] != '\0'; i++) {
- if (gw == NULL) {
+ if (!havegw) {
if (line[i] == '|') {
- if ((gw = strdup(custr_cstr(cu))) == NULL) {
- lxi_err("strdup failure");
- }
+ if (strlcpy(gw, custr_cstr(cu), gwlen)
+ >= gwlen) {
+ lxi_err("strlcpy failure");
+ } else {
+ havegw = B_TRUE;
+ }
custr_reset(cu);
} else {
if (custr_appendc(cu, line[i]) != 0) {
@@ -734,10 +768,16 @@ lxi_net_static_route(const char *line)
continue;
}
- if (dst == NULL) {
- if (line[i] == '/') {
- if ((dst = strdup(custr_cstr(cu))) == NULL) {
- lxi_err("strdup failure");
+ if (!havedst) {
+ if (line[i] == '/' || line[i] == '|') {
+ if ((strlcpy(dst, custr_cstr(cu), dstlen))
+ >= dstlen) {
+ lxi_err("strlcpy failure");
+ } else {
+ havedst = B_TRUE;
+ if (line[i] == '|') {
+ nopfx = B_TRUE;
+ }
}
custr_reset(cu);
} else {
@@ -748,9 +788,9 @@ lxi_net_static_route(const char *line)
continue;
}
- if (pfx == -1) {
+ if (*pfx == -1 && !nopfx) {
if (line[i] == '|') {
- pfx = atoi(custr_cstr(cu));
+ *pfx = atoi(custr_cstr(cu));
custr_reset(cu);
} else {
if (custr_appendc(cu, line[i]) != 0) {
@@ -764,26 +804,59 @@ lxi_net_static_route(const char *line)
lxi_err("custr_appendc failure");
}
}
+}
- /*
- * We currently only support "next hop" routes, so ensure that
- * "linklocal" is false:
- */
- if (strcmp(custr_cstr(cu), "false") != 0) {
- lxi_warn("invalid static route: %s", line);
+static void
+lxi_net_process_route_line(const char *line, boolean_t llonly)
+{
+ custr_t *cu = NULL;
+ int pfx = -1;
+ char gw[INET6_ADDRSTRLEN];
+ char dst[INET6_ADDRSTRLEN];
+
+ if (custr_alloc(&cu) != 0) {
+ lxi_err("custr_alloc failure");
}
- if (lxi_iface_gateway(NULL, dst, pfx, gw) != 0) {
- lxi_err("failed to add route: %s/%d -> %s", dst, pfx, gw);
+ lxi_parse_route_line(line, cu, gw, dst, &pfx, sizeof (gw),
+ sizeof (dst));
+
+ if (llonly && strcmp(custr_cstr(cu), "true") == 0) {
+ if (lxi_iface_gateway(NULL, dst, pfx, gw, B_TRUE) != 0) {
+ lxi_err("failed to add link-local route: %s/%d -> %s",
+ dst, pfx, gw);
+ }
+ } else if (!llonly && strcmp(custr_cstr(cu), "false") == 0) {
+ if (lxi_iface_gateway(NULL, dst, pfx, gw, B_FALSE) != 0) {
+ lxi_err("failed to add next-hop route: %s/%d -> %s",
+ dst, pfx, gw);
+ }
+ } else if (strcmp(custr_cstr(cu), "true") != 0 &&
+ strcmp(custr_cstr(cu), "false") != 0) {
+ /*
+ * try to be helpful when we run into something we don't expect.
+ */
+ lxi_warn("skipping unknown static route defined in line %s, "
+ " parsed link-local flag=%s", line, custr_cstr(cu));
}
custr_free(cu);
- free(gw);
- free(dst);
}
static void
-lxi_net_static_routes(void)
+lxi_net_static_route(const char *line)
+{
+ lxi_net_process_route_line(line, B_FALSE);
+}
+
+static void
+lxi_net_linklocal_route(const char *line)
+{
+ lxi_net_process_route_line(line, B_TRUE);
+}
+
+static void
+lxi_run_routeinfo(void * callback)
{
const char *cmd = "/native/usr/lib/brand/lx/routeinfo";
char *const argv[] = { "routeinfo", NULL };
@@ -796,7 +869,8 @@ lxi_net_static_routes(void)
/*
* This binary is (potentially) shipped from another
* consolidation. If it does not exist, then the platform does
- * not currently support static routes for LX-branded zones.
+ * not currently support link-local or static routes for
+ * LX-branded zones.
*/
return;
}
@@ -807,12 +881,25 @@ lxi_net_static_routes(void)
* is complete.
*/
if (run_command(cmd, argv, envp, errbuf, sizeof (errbuf),
- lxi_net_static_route, &code) != 0 || code != 0) {
+ callback, &code) != 0 || code != 0) {
lxi_err("failed to run \"%s\": %s", cmd, errbuf);
}
}
static void
+lxi_net_linklocal_routes(void)
+{
+ lxi_run_routeinfo(lxi_net_linklocal_route);
+}
+
+
+static void
+lxi_net_static_routes(void)
+{
+ lxi_run_routeinfo(lxi_net_static_route);
+}
+
+static void
lxi_config_close(zone_dochandle_t handle)
{
zonecfg_fini_handle(handle);
@@ -917,6 +1004,10 @@ main(int argc, char *argv[])
handle = lxi_config_open();
lxi_net_loopback();
lxi_net_setup(handle);
+
+ lxi_net_linklocal_routes();
+ lxi_net_setup_gateways(handle);
+
lxi_config_close(handle);
lxi_net_static_routes();
diff --git a/usr/src/lib/libc/Makefile.targ b/usr/src/lib/libc/Makefile.targ
index 9b2d6d35bd..fceb9b27b4 100644
--- a/usr/src/lib/libc/Makefile.targ
+++ b/usr/src/lib/libc/Makefile.targ
@@ -320,7 +320,7 @@ pics/%.o: $(LIBCBASE)/../port/threads/%.d $(THREADSOBJS:%=pics/%)
# assym rules
-LDFLAGS.native = $(LDASSERTS) $(ZASSERTDEFLIB)=libc.so $(BDIRECT)
+LDFLAGS.native = $(LDASSERTS) $(BDIRECT)
#
# genassym is a funny fish: it's run on the build machine, so should use the
diff --git a/usr/src/lib/libc/inc/libc.h b/usr/src/lib/libc/inc/libc.h
index 90a2859b33..98872ac161 100644
--- a/usr/src/lib/libc/inc/libc.h
+++ b/usr/src/lib/libc/inc/libc.h
@@ -222,6 +222,11 @@ extern int _so_getsockopt(int, int, int, char *, int *);
extern int lsign(dl_t);
/*
+ * defined in getctxt.c
+ */
+extern int _getcontext(ucontext_t *) __RETURNS_TWICE;
+
+/*
* defined in ucontext.s
*/
extern int __getcontext(ucontext_t *);
diff --git a/usr/src/lib/libc/sparc/Makefile.com b/usr/src/lib/libc/sparc/Makefile.com
index 217cd58dc8..2b20606aa6 100644
--- a/usr/src/lib/libc/sparc/Makefile.com
+++ b/usr/src/lib/libc/sparc/Makefile.com
@@ -1381,7 +1381,9 @@ $(ASSYMDEP_OBJS:%=pics/%): assym.h
assym.h := CFLAGS += $(CCGDEBUG)
GENASSYM_C = $(LIBCDIR)/$(MACH)/genassym.c
-LDFLAGS.native = $(LDASSERTS) $(ZASSERTDEFLIB)=libc.so $(BDIRECT)
+LDFLAGS.native = $(LDASSERTS) $(BDIRECT)
+
+genassym := NATIVE_LIBS += libc.so
genassym: $(GENASSYM_C)
$(NATIVECC) $(NATIVE_CFLAGS) -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc \
diff --git a/usr/src/lib/libc/sparc/fp/_D_cplx_mul.c b/usr/src/lib/libc/sparc/fp/_D_cplx_mul.c
index 6e32418f72..bfb92e1789 100644
--- a/usr/src/lib/libc/sparc/fp/_D_cplx_mul.c
+++ b/usr/src/lib/libc/sparc/fp/_D_cplx_mul.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* _D_cplx_mul(z, w) returns z * w with infinities handled according
* to C99.
@@ -82,7 +80,7 @@ testinf(double x)
double _Complex
_D_cplx_mul(double _Complex z, double _Complex w)
{
- double _Complex v;
+ double _Complex v = 0;
double a, b, c, d, x, y;
int recalc, i, j;
diff --git a/usr/src/lib/libc/sparc/fp/_F_cplx_mul.c b/usr/src/lib/libc/sparc/fp/_F_cplx_mul.c
index f4073e9327..026a60c7a4 100644
--- a/usr/src/lib/libc/sparc/fp/_F_cplx_mul.c
+++ b/usr/src/lib/libc/sparc/fp/_F_cplx_mul.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* _F_cplx_mul(z, w) returns z * w with infinities handled according
* to C99.
@@ -79,7 +77,7 @@ testinff(float x)
float _Complex
_F_cplx_mul(float _Complex z, float _Complex w)
{
- float _Complex v;
+ float _Complex v = 0;
float a, b, c, d;
double x, y;
int recalc, i, j;
diff --git a/usr/src/lib/libc/sparc/fp/_Q_cplx_div.c b/usr/src/lib/libc/sparc/fp/_Q_cplx_div.c
index b529c5eecf..8740c42f54 100644
--- a/usr/src/lib/libc/sparc/fp/_Q_cplx_div.c
+++ b/usr/src/lib/libc/sparc/fp/_Q_cplx_div.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* On SPARC V8, _Q_cplx_div(v, z, w) sets *v = *z / *w with infin-
* ities handling according to C99.
@@ -85,7 +83,7 @@ testinfl(long double x)
long double _Complex
_Q_cplx_div(const long double _Complex *z, const long double _Complex *w)
{
- long double _Complex v;
+ long double _Complex v = 0;
#else
void
_Q_cplx_div(long double _Complex *v, const long double _Complex *z,
diff --git a/usr/src/lib/libc/sparc/fp/_Q_cplx_div_ix.c b/usr/src/lib/libc/sparc/fp/_Q_cplx_div_ix.c
index 2d9c18ba02..fa2b595406 100644
--- a/usr/src/lib/libc/sparc/fp/_Q_cplx_div_ix.c
+++ b/usr/src/lib/libc/sparc/fp/_Q_cplx_div_ix.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* On SPARC V8, _Q_cplx_div_ix(v, b, w) sets *v = (I * *b / *w) with
* infinities handling according to C99.
@@ -80,7 +78,7 @@ testinfl(long double x)
long double _Complex
_Q_cplx_div_ix(const long double *pb, const long double _Complex *w)
{
- long double _Complex v;
+ long double _Complex v = 0;
#else
void
_Q_cplx_div_ix(long double _Complex *v, const long double *pb,
diff --git a/usr/src/lib/libc/sparc/fp/_Q_cplx_div_rx.c b/usr/src/lib/libc/sparc/fp/_Q_cplx_div_rx.c
index 80f050bd94..a500db400f 100644
--- a/usr/src/lib/libc/sparc/fp/_Q_cplx_div_rx.c
+++ b/usr/src/lib/libc/sparc/fp/_Q_cplx_div_rx.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* On SPARC V8, _Q_cplx_div_rx(v, a, w) sets *v = *a / *w with in-
* finities handling according to C99.
@@ -80,7 +78,7 @@ testinfl(long double x)
long double _Complex
_Q_cplx_div_rx(const long double *pa, const long double _Complex *w)
{
- long double _Complex v;
+ long double _Complex v = 0;
#else
void
_Q_cplx_div_rx(long double _Complex *v, const long double *pa,
diff --git a/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div.c b/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div.c
index 92473041e3..120b94f38b 100644
--- a/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div.c
+++ b/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* On SPARC V8, _Q_cplx_lr_div(v, z, w) sets *v = *z / *w computed
* by the textbook formula without regard to exceptions or special
@@ -45,7 +43,7 @@
long double _Complex
_Q_cplx_lr_div(const long double _Complex *z, const long double _Complex *w)
{
- long double _Complex v;
+ long double _Complex v = 0;
#else
void
_Q_cplx_lr_div(long double _Complex *v, const long double _Complex *z,
diff --git a/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div_ix.c b/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div_ix.c
index ca968d809a..916d239159 100644
--- a/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div_ix.c
+++ b/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div_ix.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* On SPARC V8, _Q_cplx_lr_div_ix(v, b, w) sets *v = (I * *b / *w)
* compute by the textbook formula without regard to exceptions or
@@ -45,7 +43,7 @@
long double _Complex
_Q_cplx_lr_div_ix(const long double *pb, const long double _Complex *w)
{
- long double _Complex v;
+ long double _Complex v = 0;
#else
void
_Q_cplx_lr_div_ix(long double _Complex *v, const long double *pb,
diff --git a/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div_rx.c b/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div_rx.c
index b6b91ddf48..8159e10ab0 100644
--- a/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div_rx.c
+++ b/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div_rx.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* On SPARC V8, _Q_cplx_lr_div_rx(v, a, w) sets *v = *a / *w computed
* by the textbook formula without regard to exceptions or special
@@ -45,7 +43,7 @@
long double _Complex
_Q_cplx_lr_div_rx(const long double *pa, const long double _Complex *w)
{
- long double _Complex v;
+ long double _Complex v = 0;
#else
void
_Q_cplx_lr_div_rx(long double _Complex *v, const long double *pa,
diff --git a/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_mul.c b/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_mul.c
index f2be5888df..b52ead1ba2 100644
--- a/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_mul.c
+++ b/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_mul.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* On SPARC V8, _Q_cplx_lr_mul(v, z, w) sets *v = *z * *w computed by
* the textbook formula without regard to exceptions or special cases.
@@ -44,7 +42,7 @@
long double _Complex
_Q_cplx_lr_mul(const long double _Complex *z, const long double _Complex *w)
{
- long double _Complex v;
+ long double _Complex v = 0;
#else
void
_Q_cplx_lr_mul(long double _Complex *v, const long double _Complex *z,
diff --git a/usr/src/lib/libc/sparc/fp/_Q_cplx_mul.c b/usr/src/lib/libc/sparc/fp/_Q_cplx_mul.c
index 9e4d41b2f7..6afbbe6a19 100644
--- a/usr/src/lib/libc/sparc/fp/_Q_cplx_mul.c
+++ b/usr/src/lib/libc/sparc/fp/_Q_cplx_mul.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* On SPARC V8, _Q_cplx_mul(v, z, w) sets *v = *z * *w with infinities
* handled according to C99.
@@ -86,7 +84,7 @@ testinfl(long double x)
long double _Complex
_Q_cplx_mul(const long double _Complex *z, const long double _Complex *w)
{
- long double _Complex v;
+ long double _Complex v = 0;
#else
void
_Q_cplx_mul(long double _Complex *v, const long double _Complex *z,
diff --git a/usr/src/lib/libc/sparc/gen/getctxt.c b/usr/src/lib/libc/sparc/gen/getctxt.c
index 3213955108..317a3f92ec 100644
--- a/usr/src/lib/libc/sparc/gen/getctxt.c
+++ b/usr/src/lib/libc/sparc/gen/getctxt.c
@@ -25,16 +25,15 @@
*/
/* Copyright (c) 1988 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#pragma weak _getcontext = getcontext
+/* All Rights Reserved */
#include "lint.h"
#include "thr_uberdata.h"
#include <ucontext.h>
#include <sys/types.h>
+#include "libc.h"
+
+#pragma weak _getcontext = getcontext
int
getcontext(ucontext_t *ucp)
diff --git a/usr/src/lib/libc/sparcv9/Makefile.com b/usr/src/lib/libc/sparcv9/Makefile.com
index 7689a5b66e..42a6048ff8 100644
--- a/usr/src/lib/libc/sparcv9/Makefile.com
+++ b/usr/src/lib/libc/sparcv9/Makefile.com
@@ -1299,7 +1299,9 @@ $(ASSYMDEP_OBJS:%=pics/%): assym.h
assym.h := CFLAGS64 += $(CCGDEBUG)
GENASSYM_C = $(LIBCDIR)/$(MACH)/genassym.c
-LDFLAGS.native = $(LDASSERTS) $(ZASSERTDEFLIB)=libc.so $(BDIRECT)
+LDFLAGS.native = $(LDASSERTS) $(BDIRECT)
+
+genassym := NATIVE_LIBS += libc.so
genassym: $(GENASSYM_C)
$(NATIVECC) $(NATIVE_CFLAGS) -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc \
diff --git a/usr/src/lib/libc/sparcv9/gen/getctxt.c b/usr/src/lib/libc/sparcv9/gen/getctxt.c
index 3213955108..317a3f92ec 100644
--- a/usr/src/lib/libc/sparcv9/gen/getctxt.c
+++ b/usr/src/lib/libc/sparcv9/gen/getctxt.c
@@ -25,16 +25,15 @@
*/
/* Copyright (c) 1988 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#pragma weak _getcontext = getcontext
+/* All Rights Reserved */
#include "lint.h"
#include "thr_uberdata.h"
#include <ucontext.h>
#include <sys/types.h>
+#include "libc.h"
+
+#pragma weak _getcontext = getcontext
int
getcontext(ucontext_t *ucp)
diff --git a/usr/src/lib/libdns_sd/Makefile.com b/usr/src/lib/libdns_sd/Makefile.com
index 44b7b6c104..6bd7b77b21 100644
--- a/usr/src/lib/libdns_sd/Makefile.com
+++ b/usr/src/lib/libdns_sd/Makefile.com
@@ -38,7 +38,7 @@ LDLIBS += -lsocket -lnsl -lc
CSTD = $(CSTD_GNU99)
CPPFLAGS += -I$(SRCDIR) -DNOT_HAVE_SA_LEN -D_XPG4_2 -D__EXTENSIONS__
-CPPFLAGS += -DMDNS_VERSIONSTR_NODTS -DmDNSResponderVersion=878.1.1
+CPPFLAGS += -DMDNS_VERSIONSTR_NODTS -DmDNSResponderVersion=1310.80.1
pics/dnssd_clientstub.o := CERRWARN += -_gcc=-Wno-unused-but-set-variable
diff --git a/usr/src/lib/libfru/libfruraw/fruraw.c b/usr/src/lib/libfru/libfruraw/fruraw.c
index 39d341486b..968a9bd053 100644
--- a/usr/src/lib/libfru/libfruraw/fruraw.c
+++ b/usr/src/lib/libfru/libfruraw/fruraw.c
@@ -549,10 +549,17 @@ frt_get_segment_name(fru_seghdl_t node, char **name)
for (each_seg = 0; each_seg < num_segment; each_seg++) {
if (segs[each_seg].handle == node) {
- segs[each_seg].name[FRU_SEGNAMELEN] = '\0';
- *name = strdup(segs[each_seg].name);
+ *name = malloc(SEG_NAME_LEN + 1);
+ if (*name != NULL) {
+ (void) memcpy(*name,
+ segs[each_seg].name,
+ SEG_NAME_LEN);
+ *name[SEG_NAME_LEN] = '\0';
+ }
free(sects);
free(segs);
+ if (*name == NULL)
+ return (FRU_FAILURE);
return (FRU_SUCCESS);
}
}
diff --git a/usr/src/lib/libfru/libfruraw/raw_access.c b/usr/src/lib/libfru/libfruraw/raw_access.c
index 7c1d2077e1..3ffca614da 100644
--- a/usr/src/lib/libfru/libfruraw/raw_access.c
+++ b/usr/src/lib/libfru/libfruraw/raw_access.c
@@ -205,7 +205,7 @@ create_packet_hash_object(void)
static hash_obj_t *
get_container_hash_object(int object_type, handle_t handle)
{
- hash_obj_t *hash_obj;
+ hash_obj_t *hash_obj = NULL;
switch (object_type) {
case CONTAINER_TYPE:
diff --git a/usr/src/lib/libsldap/common/ns_confmgr.c b/usr/src/lib/libsldap/common/ns_confmgr.c
index 862e20d035..7fa980d412 100644
--- a/usr/src/lib/libsldap/common/ns_confmgr.c
+++ b/usr/src/lib/libsldap/common/ns_confmgr.c
@@ -124,7 +124,7 @@ read_file(ns_config_t *ptr, int cred_file, ns_ldap_error_t **error)
gettext("Unable to open filename '%s' "
"for reading (errno=%d)."), file, errno);
MKERROR(LOG_ERR, *error, NS_CONFIG_FILE, strdup(errstr),
- NS_LDAP_MEMORY);
+ NS_PARSE_ERR);
return (NS_NOTFOUND);
}
@@ -150,7 +150,7 @@ read_file(ns_config_t *ptr, int cred_file, ns_ldap_error_t **error)
gettext("Missing Name or Value on line %d."),
lineno);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX,
- strdup(errstr), NS_LDAP_MEMORY);
+ strdup(errstr), NS_PARSE_ERR);
(void) fclose(fp);
return (NS_PARSE_ERR);
}
@@ -159,7 +159,7 @@ read_file(ns_config_t *ptr, int cred_file, ns_ldap_error_t **error)
gettext("Illegal profile type on line %d."),
lineno);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX,
- strdup(errstr), NS_LDAP_MEMORY);
+ strdup(errstr), NS_PARSE_ERR);
(void) fclose(fp);
return (NS_PARSE_ERR);
}
@@ -168,7 +168,7 @@ read_file(ns_config_t *ptr, int cred_file, ns_ldap_error_t **error)
gettext("Illegal NS_LDAP_FILE_VERSION "
"on line %d."), lineno);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX,
- strdup(errstr), NS_LDAP_MEMORY);
+ strdup(errstr), NS_PARSE_ERR);
(void) fclose(fp);
return (NS_PARSE_ERR);
}
@@ -188,7 +188,7 @@ read_file(ns_config_t *ptr, int cred_file, ns_ldap_error_t **error)
gettext("Illegal entry in '%s' on "
"line %d"), file, lineno);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX,
- strdup(errstr), NS_LDAP_MEMORY);
+ strdup(errstr), NS_PARSE_ERR);
(void) fclose(fp);
return (NS_PARSE_ERR);
}
@@ -208,7 +208,7 @@ read_file(ns_config_t *ptr, int cred_file, ns_ldap_error_t **error)
gettext("Illegal entry in '%s' on "
"line %d"), file, lineno);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX,
- strdup(errstr), NS_LDAP_MEMORY);
+ strdup(errstr), NS_PARSE_ERR);
(void) fclose(fp);
return (NS_PARSE_ERR);
}
@@ -220,7 +220,7 @@ read_file(ns_config_t *ptr, int cred_file, ns_ldap_error_t **error)
(void) snprintf(errstr, sizeof (errstr),
gettext("Empty config file: '%s'"), file);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX, strdup(errstr),
- NS_LDAP_MEMORY);
+ NS_PARSE_ERR);
return (NS_PARSE_ERR);
}
if (linelen == -2) {
@@ -228,7 +228,7 @@ read_file(ns_config_t *ptr, int cred_file, ns_ldap_error_t **error)
(void) snprintf(errstr, sizeof (errstr),
gettext("Line too long in '%s'"), file);
MKERROR(LOG_ERR, *error, NS_CONFIG_SYNTAX, strdup(errstr),
- NS_LDAP_MEMORY);
+ NS_PARSE_ERR);
return (NS_PARSE_ERR);
}
return (NS_SUCCESS);
@@ -237,10 +237,8 @@ read_file(ns_config_t *ptr, int cred_file, ns_ldap_error_t **error)
static
ns_ldap_return_code
-set_attr(ns_config_t *config_struct,
- char *attr_name,
- char *attr_val,
- ns_ldap_error_t **errorp)
+set_attr(ns_config_t *config_struct, char *attr_name, char *attr_val,
+ ns_ldap_error_t **errorp)
{
ParamIndexType idx;
char errmsg[MAXERROR];
@@ -471,7 +469,7 @@ __print2buf(LineBuf *line, const char *toprint, char *sep)
ns_ldap_error_t *
__ns_ldap_LoadDoorInfo(LineBuf *configinfo, char *domainname,
- ns_config_t *new, int cred_only)
+ ns_config_t *new, int cred_only)
{
ns_config_t *ptr;
char errstr[MAXERROR];
@@ -824,7 +822,7 @@ __ns_ldap_make_config(ns_ldap_result_t *result)
{
int l, m;
char val[BUFSIZE];
- char *attrname;
+ char *attrname;
ns_ldap_entry_t *entry;
ns_ldap_attr_t *attr;
char **attrval;
@@ -997,7 +995,7 @@ makeconfigerror:
*/
int
__ns_ldap_download(const char *profile, char *addr, char *baseDN,
- ns_ldap_error_t **errorp)
+ ns_ldap_error_t **errorp)
{
char filter[BUFSIZE];
int rc;
diff --git a/usr/src/lib/libsldap/common/ns_reads.c b/usr/src/lib/libsldap/common/ns_reads.c
index da987fd81a..414ddffaa1 100644
--- a/usr/src/lib/libsldap/common/ns_reads.c
+++ b/usr/src/lib/libsldap/common/ns_reads.c
@@ -2052,7 +2052,7 @@ multi_result(ns_ldap_cookie_t *cookie)
gettext(ldap_err2string(cookie->err_rc)));
err = strdup(errstr);
MKERROR(LOG_WARNING, *errorp, NS_LDAP_INTERNAL, err,
- NS_LDAP_MEMORY);
+ LDAP_ERROR);
cookie->err_rc = NS_LDAP_INTERNAL;
cookie->errorp = *errorp;
return (LDAP_ERROR);
@@ -2122,7 +2122,7 @@ multi_result(ns_ldap_cookie_t *cookie)
gettext(ldap_err2string(cookie->err_rc)));
err = strdup(errstr);
MKERROR(LOG_WARNING, *errorp, NS_LDAP_INTERNAL, err,
- NS_LDAP_MEMORY);
+ LDAP_ERROR);
cookie->err_rc = NS_LDAP_INTERNAL;
cookie->errorp = *errorp;
return (LDAP_ERROR);
@@ -2380,7 +2380,7 @@ search_state_machine(ns_ldap_cookie_t *cookie, ns_state_t state, int cycle)
state);
err = strdup(errstr);
MKERROR(LOG_WARNING, *errorp, NS_LDAP_INTERNAL, err,
- NS_LDAP_MEMORY);
+ LDAP_ERROR);
cookie->err_rc = NS_LDAP_INTERNAL;
cookie->errorp = *errorp;
cookie->new_state = EXIT;
@@ -2922,15 +2922,15 @@ search_state_machine(ns_ldap_cookie_t *cookie, ns_state_t state, int cycle)
if (cookie->err_rc == LDAP_SERVER_DOWN) {
MKERROR(LOG_INFO, *errorp,
cookie->err_rc, err,
- NS_LDAP_MEMORY);
+ LDAP_ERROR);
} else {
MKERROR(LOG_WARNING, *errorp,
cookie->err_rc, err,
- NS_LDAP_MEMORY);
+ LDAP_ERROR);
}
} else {
MKERROR(LOG_WARNING, *errorp, NS_LDAP_INTERNAL,
- err, NS_LDAP_MEMORY);
+ err, LDAP_ERROR);
}
cookie->err_rc = NS_LDAP_INTERNAL;
cookie->errorp = *errorp;
@@ -2954,7 +2954,7 @@ search_state_machine(ns_ldap_cookie_t *cookie, ns_state_t state, int cycle)
cookie->state);
err = strdup(errstr);
MKERROR(LOG_WARNING, *errorp, NS_LDAP_INTERNAL, err,
- NS_LDAP_MEMORY);
+ LDAP_ERROR);
cookie->err_rc = NS_LDAP_INTERNAL;
cookie->errorp = *errorp;
return (ERROR);
diff --git a/usr/src/lib/nsswitch/ldap/common/getexecattr.c b/usr/src/lib/nsswitch/ldap/common/getexecattr.c
index abd22908e0..fc44698267 100644
--- a/usr/src/lib/nsswitch/ldap/common/getexecattr.c
+++ b/usr/src/lib/nsswitch/ldap/common/getexecattr.c
@@ -21,6 +21,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2021 Joyent, Inc.
*/
#include <secdb.h>
@@ -355,7 +356,7 @@ result_exec2str:
static nss_status_t
_exec_process_val(ldap_backend_ptr be, nss_XbyY_args_t *argp)
{
- int status;
+ int status;
nss_status_t nss_stat = NSS_UNAVAIL;
ns_ldap_attr_t *attrptr;
ns_ldap_entry_t *entry;
@@ -420,7 +421,7 @@ get_wild(ldap_backend_ptr be, nss_XbyY_args_t *argp, int getby_flag)
const char *policy = _priv_exec->policy;
const char *type = _priv_exec->type;
- if (strpbrk(policy, "*()\\") != NULL ||
+ if ((policy != NULL && strpbrk(policy, "*()\\") != NULL) ||
type != NULL && strpbrk(type, "*()\\") != NULL)
return ((nss_status_t)NSS_NOTFOUND);
@@ -446,11 +447,12 @@ get_wild(ldap_backend_ptr be, nss_XbyY_args_t *argp, int getby_flag)
switch (getby_flag) {
case NSS_DBOP_EXECATTR_BYID:
ret = snprintf(searchfilter, sizeof (searchfilter),
- _EXEC_GETEXECID, id, policy, ISWILD(type));
+ _EXEC_GETEXECID, id, ISWILD(policy), ISWILD(type));
if (ret >= sizeof (searchfilter) || ret < 0)
goto go_out;
ret = snprintf(userdata, sizeof (userdata),
- _EXEC_GETEXECID_SSD, id, policy, ISWILD(type));
+ _EXEC_GETEXECID_SSD, id, ISWILD(policy),
+ ISWILD(type));
if (ret >= sizeof (userdata) || ret < 0)
goto go_out;
break;
@@ -458,12 +460,12 @@ get_wild(ldap_backend_ptr be, nss_XbyY_args_t *argp, int getby_flag)
case NSS_DBOP_EXECATTR_BYNAMEID:
ret = snprintf(searchfilter, sizeof (searchfilter),
_EXEC_GETEXECNAMEID, name, id,
- policy, ISWILD(type));
+ ISWILD(policy), ISWILD(type));
if (ret >= sizeof (searchfilter) || ret < 0)
goto go_out;
ret = snprintf(userdata, sizeof (userdata),
_EXEC_GETEXECNAMEID_SSD, name, id,
- policy, ISWILD(type));
+ ISWILD(policy), ISWILD(type));
if (ret >= sizeof (userdata) || ret < 0)
goto go_out;
break;
@@ -484,8 +486,8 @@ go_out:
}
static nss_status_t
-exec_attr_process_val(ldap_backend_ptr be, nss_XbyY_args_t *argp) {
-
+exec_attr_process_val(ldap_backend_ptr be, nss_XbyY_args_t *argp)
+{
_priv_execattr *_priv_exec = (_priv_execattr *)(argp->key.attrp);
int stat, nss_stat = NSS_SUCCESS;
@@ -497,10 +499,10 @@ exec_attr_process_val(ldap_backend_ptr be, nss_XbyY_args_t *argp) {
if (argp->buf.result != NULL) {
/* file format -> execstr_t */
stat = (*argp->str2ent)(be->buffer,
- be->buflen,
- argp->buf.result,
- argp->buf.buffer,
- argp->buf.buflen);
+ be->buflen,
+ argp->buf.result,
+ argp->buf.buffer,
+ argp->buf.buflen);
if (stat == NSS_STR_PARSE_SUCCESS) {
argp->returnval = argp->buf.result;
argp->returnlen = 1; /* irrelevant */
@@ -544,16 +546,16 @@ getbynam(ldap_backend_ptr be, void *a)
const char *policy = _priv_exec->policy;
const char *type = _priv_exec->type;
- if (strpbrk(policy, "*()\\") != NULL ||
+ if (policy != NULL && strpbrk(policy, "*()\\") != NULL ||
type != NULL && strpbrk(type, "*()\\") != NULL ||
_ldap_filter_name(name, _priv_exec->name, sizeof (name)) != 0)
return ((nss_status_t)NSS_NOTFOUND);
ret = snprintf(searchfilter, sizeof (searchfilter),
- _EXEC_GETEXECNAME, name, policy, ISWILD(type));
+ _EXEC_GETEXECNAME, name, ISWILD(policy), ISWILD(type));
if (ret >= sizeof (searchfilter) || ret < 0)
return ((nss_status_t)NSS_NOTFOUND);
ret = snprintf(userdata, sizeof (userdata),
- _EXEC_GETEXECNAME_SSD, name, policy, ISWILD(type));
+ _EXEC_GETEXECNAME_SSD, name, ISWILD(policy), ISWILD(type));
if (ret >= sizeof (userdata) || ret < 0)
return ((nss_status_t)NSS_NOTFOUND);
diff --git a/usr/src/lib/sun_sas/common/Sun_sasFreeLibrary.c b/usr/src/lib/sun_sas/common/Sun_sasFreeLibrary.c
index b30e975fe1..78b2100e89 100644
--- a/usr/src/lib/sun_sas/common/Sun_sasFreeLibrary.c
+++ b/usr/src/lib/sun_sas/common/Sun_sasFreeLibrary.c
@@ -48,6 +48,7 @@ Sun_sasFreeLibrary(void)
open_handle_index = 1;
unlock(&all_hbas_lock);
(void) mutex_destroy(&all_hbas_lock);
+ (void) mutex_destroy(&open_handles_lock);
/* free sysevent handle. */
if (gSysEventHandle != NULL)
diff --git a/usr/src/lib/sun_sas/common/Sun_sasLoadLibrary.c b/usr/src/lib/sun_sas/common/Sun_sasLoadLibrary.c
index b5df2a4cc8..45164c5058 100644
--- a/usr/src/lib/sun_sas/common/Sun_sasLoadLibrary.c
+++ b/usr/src/lib/sun_sas/common/Sun_sasLoadLibrary.c
@@ -27,6 +27,11 @@
#include <sun_sas.h>
+mutex_t all_hbas_lock = DEFAULTMUTEX;
+mutex_t open_handles_lock = DEFAULTMUTEX;
+HBA_UINT16 open_handle_index;
+HBA_UINT32 hba_count;
+
/*
* Loads the HBA Library. Must be called before calling any HBA library
* functions
@@ -53,23 +58,17 @@ HBA_STATUS Sun_sasLoadLibrary() {
}
hba_count = 0;
open_handle_index = 1;
- /* Initialize the read-write lock */
- if (mutex_init(&all_hbas_lock, USYNC_THREAD, NULL)) {
- log(LOG_DEBUG, ROUTINE,
- "Unable to initialize lock in LoadLibrary for reason \"%s\"",
- strerror(errno));
- return (HBA_STATUS_ERROR);
- }
+
/* grab write lock */
lock(&all_hbas_lock);
start = gethrtime();
if ((root = di_init("/", DINFOCACHE)) == DI_NODE_NIL) {
- log(LOG_DEBUG, ROUTINE,
- "Unable to load device tree for reason \"%s\"",
- strerror(errno));
- unlock(&all_hbas_lock);
- return (HBA_STATUS_ERROR);
+ log(LOG_DEBUG, ROUTINE,
+ "Unable to load device tree: \"%s\"",
+ strerror(errno));
+ unlock(&all_hbas_lock);
+ return (HBA_STATUS_ERROR);
}
end = gethrtime();
duration = end - start;
@@ -79,9 +78,9 @@ HBA_STATUS Sun_sasLoadLibrary() {
/* At load time, we only gather libdevinfo information */
if (devtree_get_all_hbas(root) == HBA_STATUS_OK) {
- atLeastOneHBA = B_TRUE;
+ atLeastOneHBA = B_TRUE;
} else {
- atLeastOneFailure = B_TRUE;
+ atLeastOneFailure = B_TRUE;
}
di_fini(root);
@@ -90,13 +89,14 @@ HBA_STATUS Sun_sasLoadLibrary() {
/* Now determine what status code to return */
if (atLeastOneHBA) {
- /* We've got at least one HBA and possibly some failures */
- return (HBA_STATUS_OK);
- } else if (atLeastOneFailure) {
- /* We have no HBAs but have failures */
- return (HBA_STATUS_ERROR);
- } else {
- /* We have no HBAs and no failures */
- return (HBA_STATUS_OK);
+ /* We've got at least one HBA and possibly some failures */
+ return (HBA_STATUS_OK);
+ }
+ if (atLeastOneFailure) {
+ /* We have no HBAs but have failures */
+ return (HBA_STATUS_ERROR);
}
+
+ /* We have no HBAs and no failures */
+ return (HBA_STATUS_OK);
}
diff --git a/usr/src/lib/sun_sas/common/devtree_hba_disco.c b/usr/src/lib/sun_sas/common/devtree_hba_disco.c
index bfd584008b..2017f97e26 100644
--- a/usr/src/lib/sun_sas/common/devtree_hba_disco.c
+++ b/usr/src/lib/sun_sas/common/devtree_hba_disco.c
@@ -33,6 +33,8 @@
#include <inttypes.h>
#include <ctype.h>
+struct sun_sas_hba *global_hba_head;
+
/* free hba port info for the given hba */
static void
free_hba_port(struct sun_sas_hba *hba_ptr)
diff --git a/usr/src/lib/sun_sas/common/sun_sas.h b/usr/src/lib/sun_sas/common/sun_sas.h
index d6872e5628..75344e6de3 100644
--- a/usr/src/lib/sun_sas/common/sun_sas.h
+++ b/usr/src/lib/sun_sas/common/sun_sas.h
@@ -107,11 +107,11 @@ extern "C" {
/* misc */
#define SUN_MICROSYSTEMS "Sun Microsystems, Inc."
-mutex_t all_hbas_lock;
-mutex_t open_handles_lock;
-mutex_t log_file_lock;
-HBA_UINT32 hba_count;
-HBA_UINT16 open_handle_index;
+extern mutex_t all_hbas_lock;
+extern mutex_t open_handles_lock;
+extern mutex_t log_file_lock;
+extern HBA_UINT32 hba_count;
+extern HBA_UINT16 open_handle_index;
/* Internal structures that aren't exposed to clients */
@@ -136,7 +136,7 @@ struct sun_sas_hba {
struct sun_sas_port *first_port;
};
-struct sun_sas_hba *global_hba_head;
+extern struct sun_sas_hba *global_hba_head;
struct ScsiEntryList {
SMHBA_SCSIENTRY entry;