Skip to content

Commit

Permalink
749 "/usr/bin/kstat" should be rewritten in C (fix SPARC build)
Browse files Browse the repository at this point in the history
  • Loading branch information
richlowe committed Jan 27, 2013
1 parent 6644891 commit e633f2d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 5 additions & 0 deletions usr/src/cmd/stat/kstat/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 4 additions & 5 deletions usr/src/cmd/stat/kstat/kstat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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));

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion usr/src/cmd/stat/kstat/kstat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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); \
}
Expand Down

0 comments on commit e633f2d

Please sign in to comment.