Permalink
Browse files

749 "/usr/bin/kstat" should be rewritten in C (fix SPARC build)

  • Loading branch information...
1 parent 6644891 commit e633f2d79475b51f0a4d46972282225abf851733 @richlowe richlowe committed Jan 27, 2013
Showing with 10 additions and 6 deletions.
  1. +5 −0 usr/src/cmd/stat/kstat/Makefile
  2. +4 −5 usr/src/cmd/stat/kstat/kstat.c
  3. +1 −1 usr/src/cmd/stat/kstat/kstat.h
@@ -35,6 +35,11 @@ CFLAGS += $(CCVERBOSE) -I${STATCOMMONDIR}
CERRWARN += -_gcc=-Wno-uninitialized
CERRWARN += -_gcc=-Wno-switch
CERRWARN += -_gcc=-Wno-parentheses
+
+CPPFLAGS_sparc += -I$(SRC)/uts/sfmmu
+CPPFLAGS_sparc += -I$(SRC)/uts/sun4u/sunfire
+CPPFLAGS += $(CPPFLAGS_$(MACH))
+
FILEMODE= 0555
lint := LINTFLAGS = -muxs -I$(STATCOMMONDIR)
@@ -1261,15 +1261,15 @@ short_array_to_string(short *shortp, int len)
for (; len > 1; len--, shortp++) {
if (list == NULL) {
- (void) asprintf(&list_buf, "%d,", *shortp);
+ (void) asprintf(&list_buf, "%hd,", *shortp);
} else {
- (void) asprintf(&list_buf, "%s%d,", list, *shortp);
+ (void) asprintf(&list_buf, "%s%hd,", list, *shortp);
free(list);
}
list = list_buf;
}
- (void) asprintf(&list_buf, "%s%s", list, *shortp);
+ (void) asprintf(&list_buf, "%s%hd", list, *shortp);
free(list);
return (list_buf);
}
@@ -1279,7 +1279,6 @@ save_temperature(kstat_t *kp, ks_instance_t *ksi)
{
struct temp_stats *temps = (struct temp_stats *)(kp->ks_data);
char *buf;
- int n = 1;
assert(kp->ks_data_size == sizeof (struct temp_stats));
@@ -1381,7 +1380,7 @@ save_fault_list(kstat_t *kp, ks_instance_t *ksi)
(void) snprintf(name, sizeof (name), "create_time_%d", i);
SAVE_HRTIME_X(ksi, name, fault->create_time);
(void) snprintf(name, sizeof (name), "msg_%d", i);
- SAVE_STRING_X(ksi, name, faultp->msg);
+ SAVE_STRING_X(ksi, name, fault->msg);
}
}
#endif
@@ -150,7 +150,7 @@ typedef union ks_value {
#define SAVE_CHAR_X(I, N, V) \
{ \
ks_value_t v; \
- asprintf(&v.str.addr.ptr, "%c", V); \
+ (void) asprintf(&v.str.addr.ptr, "%c", V); \
v.str.len = 1; \
nvpair_insert(I, N, &v, KSTAT_DATA_STRING); \
}

0 comments on commit e633f2d

Please sign in to comment.