summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2020-09-08 11:35:00 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2020-09-08 11:35:00 +0000
commit59a0703a940438d24a8cd9911a57711b8028c496 (patch)
tree816119c979bf679b1cef812f7c2f36f2d743800a
parent538446bd297154cf5d4db74adf78dfa23d05df0c (diff)
parent93d26c05275be2c44aedd16705237484fc0a0990 (diff)
downloadillumos-joyent-59a0703a940438d24a8cd9911a57711b8028c496.tar.gz
[illumos-gate merge]
commit 93d26c05275be2c44aedd16705237484fc0a0990 13015 fruaccess: comparison between pointer and zero character constant commit ba12489a763ade223e478c59fdc4cb752fcba568 13011 tsalarm: '*' in boolean context, suggest '&&' instead commit 09e6639baaf32231365cb9895bf1e0ea006a2a60 12885 efcode: smatch and build errors commit e4af2f17fac5babc25d094f1bf22dd06515f66c7 13104 zfs: offset_t is signed and can not be > MAXOFFSET_T commit 7aaede4825001926ae223b8c47ef9e4d0d6021ba 12974 libc: left shift of negative value commit 712669c9fa9278704a4ccefe1d96acaf29397d36 13103 zfs: zvol_strategy() warn: unsigned 'off' is never less than zero commit e075c017fe4c71cde62297bcc90d3411c0f4ad1d 12512 dispadmin.1m manpage is missing \fB \fR around FX commit 9b0881404678e5235132f9320785c3f5ce6e71f6 13087 zfs: zfs_ereport_post() and zfs_ereport_start() return values are ignored commit 5365b8a5984eca60a3cedc7f9f738e51fb056bec 12936 bhyve vlapic needs ability to bypass isrvec_stk
-rw-r--r--usr/src/cmd/picl/plugins/sun4u/lib/fruaccess/fru_access.c18
-rw-r--r--usr/src/lib/efcode/efdaemon/efdaemon.c24
-rw-r--r--usr/src/lib/efcode/engine/alarm.c14
-rw-r--r--usr/src/lib/efcode/engine/debug.c30
-rw-r--r--usr/src/lib/efcode/engine/env.c44
-rw-r--r--usr/src/lib/efcode/engine/extend.c4
-rw-r--r--usr/src/lib/efcode/engine/fcode.c9
-rw-r--r--usr/src/lib/efcode/engine/forth.c8
-rw-r--r--usr/src/lib/efcode/engine/interactive.c22
-rw-r--r--usr/src/lib/efcode/engine/log.c18
-rw-r--r--usr/src/lib/efcode/engine/package.c8
-rw-r--r--usr/src/lib/efcode/engine/properties.c4
-rw-r--r--usr/src/lib/efcode/engine/signal.c24
-rw-r--r--usr/src/lib/efcode/fcdriver/get_req.c8
-rw-r--r--usr/src/lib/efcode/fcdriver/ioctl.c4
-rw-r--r--usr/src/lib/efcode/fcdriver/load_node.c26
-rw-r--r--usr/src/lib/efcode/fcdriver/misc.c8
-rw-r--r--usr/src/lib/efcode/fcdriver/phandle.c19
-rw-r--r--usr/src/lib/efcode/fcdriver/upload.c5
-rw-r--r--usr/src/lib/efcode/gp2/gp2.c4
-rw-r--r--usr/src/lib/efcode/jupiter/jupiter.c2
-rw-r--r--usr/src/lib/efcode/packages/parse.c8
-rw-r--r--usr/src/lib/efcode/pci/pci.c9
-rw-r--r--usr/src/lib/efcode/upa/upa.c4
-rw-r--r--usr/src/lib/libc/port/gen/_ftoll.c6
-rw-r--r--usr/src/man/man1m/dispadmin.1m20
-rw-r--r--usr/src/uts/common/fs/zfs/arc.c7
-rw-r--r--usr/src/uts/common/fs/zfs/spa.c3
-rw-r--r--usr/src/uts/common/fs/zfs/spa_config.c3
-rw-r--r--usr/src/uts/common/fs/zfs/vdev.c7
-rw-r--r--usr/src/uts/common/fs/zfs/vdev_indirect.c6
-rw-r--r--usr/src/uts/common/fs/zfs/vdev_raidz.c2
-rw-r--r--usr/src/uts/common/fs/zfs/zfs_fm.c2
-rw-r--r--usr/src/uts/common/fs/zfs/zfs_vnops.c2
-rw-r--r--usr/src/uts/common/fs/zfs/zio.c10
-rw-r--r--usr/src/uts/common/fs/zfs/zvol.c2
-rw-r--r--usr/src/uts/i86pc/io/vmm/io/vlapic.c210
-rw-r--r--usr/src/uts/i86pc/io/vmm/io/vlapic_priv.h38
-rw-r--r--usr/src/uts/sun4v/ontario/io/tsalarm.c2
39 files changed, 339 insertions, 305 deletions
diff --git a/usr/src/cmd/picl/plugins/sun4u/lib/fruaccess/fru_access.c b/usr/src/cmd/picl/plugins/sun4u/lib/fruaccess/fru_access.c
index 1bb24230cd..82f7262de7 100644
--- a/usr/src/cmd/picl/plugins/sun4u/lib/fruaccess/fru_access.c
+++ b/usr/src/cmd/picl/plugins/sun4u/lib/fruaccess/fru_access.c
@@ -639,9 +639,9 @@ get_container_info(const char *def_file, const char *cont_desc_str,
token = tokenizer(buf, "#", &field, &matched);
/* find the names */
token = tokenizer(buf, ":", &field, &matched);
- if (token != 0x00) {
+ if (token != NULL) {
token = tokenizer(token, "|", &item, &matched);
- while (token != 0x00) {
+ while (token != NULL) {
if (strcmp(token, cont_desc_str) == 0) {
foundIt = 1;
goto found;
@@ -649,7 +649,7 @@ get_container_info(const char *def_file, const char *cont_desc_str,
token = tokenizer(item, "|", &item, &matched);
}
/* check the last remaining item */
- if ((item != 0x00) &&
+ if ((item != NULL) &&
(strcmp(item, cont_desc_str) == 0)) {
foundIt = 1;
goto found;
@@ -660,16 +660,16 @@ get_container_info(const char *def_file, const char *cont_desc_str,
found :
if (foundIt == 1) {
token = tokenizer(field, ":", &field, &matched);
- if (token == 0x00) {
+ if (token == NULL) {
(void) fclose(file);
return (-1);
}
cont_info->header_ver = (headerrev_t)atoi(token);
token = tokenizer(field, ":\n", &field, &matched);
- while (token != 0x00) {
+ while (token != NULL) {
token = tokenizer(token, ",", &item, &matched);
- if (token == 0x00) {
+ if (token == NULL) {
(void) fclose(file);
return (-1);
}
@@ -696,7 +696,7 @@ found :
}
token = tokenizer(item, ",", &item, &matched);
- if (token == 0x00) {
+ if (token == NULL) {
(void) fclose(file);
return (-1);
}
@@ -708,12 +708,12 @@ found :
* data interpreter
*/
token = tokenizer(item, ",", &item, &matched);
- if (token == 0x00) {
+ if (token == NULL) {
(void) fclose(file);
return (-1);
}
}
- if (item == '\0') {
+ if (*item == '\0') {
(void) fclose(file);
return (-1);
}
diff --git a/usr/src/lib/efcode/efdaemon/efdaemon.c b/usr/src/lib/efcode/efdaemon/efdaemon.c
index 2450d2d1fa..20321bf135 100644
--- a/usr/src/lib/efcode/efdaemon/efdaemon.c
+++ b/usr/src/lib/efcode/efdaemon/efdaemon.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* efdaemon - Emebbed Fcode Interpreter daemon.
*
@@ -89,7 +87,7 @@ main(int argc, char **argv)
strerror(errno));
exit(1);
}
- close(fd);
+ (void) close(fd);
/*
* Ensure that /usr/lib/efcode/efcode.sh exists and is executable.
@@ -113,10 +111,10 @@ main(int argc, char **argv)
/*
* detach from tty here.
*/
- setpgrp();
- close(0);
- close(1);
- close(2);
+ (void) setpgrp();
+ (void) close(0);
+ (void) close(1);
+ (void) close(2);
(void) open("/dev/null", O_RDWR);
(void) dup(0);
(void) dup(0);
@@ -127,7 +125,7 @@ main(int argc, char **argv)
if (nerr == 1)
syslog(LOG_ERR, "Can't open %s: %s\n",
dev_fcode_file, strerror(errno));
- sleep(1);
+ (void) sleep(1);
}
if (nerr > 1) {
syslog(LOG_ERR, "Open on %s failed %d times\n",
@@ -138,7 +136,7 @@ main(int argc, char **argv)
if (nbytes < 0) {
syslog(LOG_ERR, "Read of %s: %s\n", dev_fcode_file,
strerror(errno));
- close(fd);
+ (void) close(fd);
continue;
}
if (debug)
@@ -148,7 +146,7 @@ main(int argc, char **argv)
if (nerr == 1)
syslog(LOG_ERR, "Fork failed: %s\n",
strerror(errno));
- sleep(1);
+ (void) sleep(1);
}
if ((nerr > 1) && pid) {
syslog(LOG_ERR, "Fork failed %d times\n", nerr);
@@ -178,19 +176,19 @@ main(int argc, char **argv)
}
} else if (debug)
syslog(LOG_DEBUG, "Wait: pid: %d\n", pid);
- close(fd);
+ (void) close(fd);
continue;
}
if (debug)
syslog(LOG_DEBUG, "Child: %d processing request\n",
getpid());
- fcntl(fd, F_DUP2FD, 0);
+ (void) fcntl(fd, F_DUP2FD, 0);
while (execl("/bin/sh", "sh", efcode_sh_file, NULL)) {
nerr++;
if (nerr == 1)
syslog(LOG_ERR, "execl(/bin/sh) failed: %s\n",
strerror(errno));
- sleep(1);
+ (void) sleep(1);
}
}
diff --git a/usr/src/lib/efcode/engine/alarm.c b/usr/src/lib/efcode/engine/alarm.c
index c9d4550a9d..a50f965d8e 100644
--- a/usr/src/lib/efcode/engine/alarm.c
+++ b/usr/src/lib/efcode/engine/alarm.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -54,8 +52,8 @@ catch_alarm(int signo)
if (env && alarm_xt && alarm_ms) {
PUSH(DS, alarm_xt);
execute(env);
- signal(SIGALRM, catch_alarm);
- alarm((alarm_ms + 999)/1000);
+ (void) signal(SIGALRM, catch_alarm);
+ (void) alarm((alarm_ms + 999)/1000);
}
}
@@ -71,17 +69,17 @@ do_alarm(fcode_env_t *env)
ms = POP(DS);
xt = POP(DS);
if (ms == 0) {
- alarm(0);
- signal(SIGALRM, SIG_DFL);
+ (void) alarm(0);
+ (void) signal(SIGALRM, SIG_DFL);
alarm_xt = 0;
alarm_ms = 0;
alarm_env = 0;
} else {
- signal(SIGALRM, catch_alarm);
+ (void) signal(SIGALRM, catch_alarm);
alarm_xt = xt;
alarm_ms = ms;
alarm_env = env;
- alarm((ms + 999)/1000);
+ (void) alarm((ms + 999)/1000);
}
}
diff --git a/usr/src/lib/efcode/engine/debug.c b/usr/src/lib/efcode/engine/debug.c
index bbc32ebdf5..e00496944e 100644
--- a/usr/src/lib/efcode/engine/debug.c
+++ b/usr/src/lib/efcode/engine/debug.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -97,7 +95,7 @@ output_return_stack(fcode_env_t *env, int show_wa, int msglevel)
for (i = (RS - env->rs0) - 1; i > 0; i--) {
anyout++;
log_message(msglevel, "%s ",
- acf_backup_search(env, (acf_t)env->rs0[i+1]));
+ acf_backup_search(env, (acf_t)env->rs0[i+1]));
}
if (!anyout)
log_message(msglevel, "<empty> ");
@@ -239,7 +237,7 @@ acf_to_str(acf_t acf)
{
static char msg[(sizeof (acf) * 2) + 3];
- sprintf(msg, "(%08p)", acf);
+ (void) sprintf(msg, "(%08p)", acf);
return (msg);
}
@@ -622,9 +620,9 @@ verify_usage(fcode_env_t *env)
verify = env->table[i].flags & (ANSI_WORD|P1275_WORD);
if ((verify) &&
#ifdef DEBUG
- (env->table[i].usage == 0) &&
+ (env->table[i].usage == 0) &&
#endif
- (env->table[i].apf)) {
+ (env->table[i].apf)) {
log_message(MSG_DEBUG,
"Untested: %4x %32s acf = %8p, %8p\n", i,
env->table[i].name, env->table[i].apf,
@@ -726,11 +724,11 @@ debug_flags_to_mask(char *str)
if (*str == '0') {
str++;
if (*str == 'x' || *str == 'X') {
- sscanf(str + 1, "%x", &flags);
+ (void) sscanf(str + 1, "%x", &flags);
} else
- sscanf(str, "%o", &flags);
+ (void) sscanf(str, "%o", &flags);
} else
- sscanf(str, "%d", &flags);
+ (void) sscanf(str, "%d", &flags);
return (flags);
}
if (strcmp(str, "clear") == 0)
@@ -929,13 +927,13 @@ ctrace(fcode_env_t *env)
FILE *fd;
log_message(MSG_DEBUG, "Interpreter C Stack:\n");
- sprintf(buf, "/usr/proc/bin/pstack %d", getpid());
+ (void) sprintf(buf, "/usr/proc/bin/pstack %d", getpid());
if ((fd = popen(buf, "r")) == NULL)
log_perror(MSG_ERROR, "Can't run: %s", buf);
else {
while (fgets(buf, sizeof (buf), fd))
log_message(MSG_DEBUG, buf);
- fclose(fd);
+ (void) fclose(fd);
}
}
@@ -969,7 +967,7 @@ forth_abort(fcode_env_t *env, char *fmt, ...)
in_forth_abort++;
va_start(ap, fmt);
- vsprintf(msg, fmt, ap);
+ (void) vsprintf(msg, fmt, ap);
log_message(MSG_ERROR, "ABORT: %s\n", msg);
if (env) {
@@ -995,7 +993,7 @@ forth_perror(fcode_env_t *env, char *fmt, ...)
int save_errno = errno; /* just in case... */
va_start(ap, fmt);
- vsprintf(msg, fmt, ap);
+ (void) vsprintf(msg, fmt, ap);
forth_abort(env, "%s: %s", msg, strerror(save_errno));
}
@@ -1048,7 +1046,7 @@ dump(fcode_env_t *env)
offset = ((long)data) & 0xf;
len += offset;
data = (uchar_t *)((long)data & ~0xf);
- sprintf(buf, "%p", data);
+ (void) sprintf(buf, "%p", data);
print_bytes_header(strlen(buf), offset);
for (len += offset; len > 0; len -= 16, data += 16)
dump_line(data);
@@ -1412,7 +1410,7 @@ dot_calls(fcode_env_t *env)
{
acf_t acf = (acf_t)POP(DS);
- search_all_dictionaries(env, do_dot_calls, acf);
+ (void) search_all_dictionaries(env, do_dot_calls, acf);
output_acf_name(NULL);
}
@@ -1484,7 +1482,7 @@ do_memory_watch(fcode_env_t *env)
"memory-watch: %p/%d: %llx -> %llx\n",
mw_addr, mw_size, (uint64_t)mw_lastvalue,
(uint64_t)value);
- do_fclib_step(env);
+ (void) do_fclib_step(env);
}
mw_lastvalue = value;
}
diff --git a/usr/src/lib/efcode/engine/env.c b/usr/src/lib/efcode/engine/env.c
index 16431b21dd..5d6580dcb8 100644
--- a/usr/src/lib/efcode/engine/env.c
+++ b/usr/src/lib/efcode/engine/env.c
@@ -64,7 +64,7 @@ do_emit(fcode_env_t *env, uchar_t c)
if (isatty(fileno(stdout))) {
if ((c >= 0x20 && c <= 0x7f) || c == '\n' || c == '\r' ||
c == '\b')
- putchar(c);
+ (void) putchar(c);
else if (c < 0x20)
printf("@%c", c + '@');
else
@@ -100,14 +100,14 @@ keyquestion(fcode_env_t *env)
{
struct timeval timeval;
fd_set readfds;
- int ret;
if (isatty(fileno(stdin))) {
FD_ZERO(&readfds);
FD_SET(fileno(stdin), &readfds);
timeval.tv_sec = 0;
timeval.tv_usec = 1000;
- ret = select(fileno(stdin) + 1, &readfds, NULL, NULL, &timeval);
+ (void) select(fileno(stdin) + 1, &readfds, NULL, NULL,
+ &timeval);
if (FD_ISSET(fileno(stdin), &readfds))
PUSH(DS, TRUE);
else
@@ -125,7 +125,7 @@ key(fcode_env_t *env)
uchar_t c;
if (isatty(fileno(stdin))) {
- read(fileno(stdin), &c, 1);
+ (void) read(fileno(stdin), &c, 1);
PUSH(DS, c);
} else
forth_abort(env, "'key' called in non-interactive mode");
@@ -178,7 +178,7 @@ expect(fcode_env_t *env)
read_line(env);
rbuf = pop_a_string(env, NULL);
if (rbuf) {
- strcpy(buf, rbuf);
+ (void) strcpy(buf, rbuf);
env->span = strlen(buf);
} else
env->span = 0;
@@ -201,7 +201,7 @@ do_ms(fcode_env_t *env)
if (d) {
rqtp.tv_sec = 0;
rqtp.tv_nsec = d*1000*1000;
- nanosleep(&rqtp, 0);
+ (void) nanosleep(&rqtp, 0);
}
}
@@ -212,12 +212,12 @@ do_get_msecs(fcode_env_t *env)
long ms;
timespec_t rqtp;
- gettimeofday(&tp, NULL);
+ (void) gettimeofday(&tp, NULL);
ms = (tp.tv_usec/1000) + (tp.tv_sec * 1000);
PUSH(DS, (fstack_t)ms);
rqtp.tv_sec = 0;
rqtp.tv_nsec = 1000*1000;
- nanosleep(&rqtp, 0);
+ (void) nanosleep(&rqtp, 0);
}
#define CMN_MSG_SIZE 256
@@ -334,7 +334,7 @@ validfmt(char *fmt, cmn_fmt_t *cfstr)
/* if too many digits in the width return error */
if (nbytes > CMN_MAX_DIGITS)
return (1);
- strncpy(cdigs, dig1, nbytes);
+ (void) strncpy(cdigs, dig1, nbytes);
cdigs[nbytes] = 0;
*cwidth = atoi(cdigs);
}
@@ -353,6 +353,7 @@ validfmt(char *fmt, cmn_fmt_t *cfstr)
case '%':
if (isll)
return (1);
+ /* FALLTHROUGH */
case 'd':
case 'x':
*format = *fmt;
@@ -408,6 +409,7 @@ fmt_args(fcode_env_t *env, int cw, int fw, char format, long *arg,
switch (format) {
case 'x':
cnv = 16;
+ /* FALLTHROUGH */
case 'd':
case 'c':
case 'p':
@@ -551,9 +553,9 @@ fmt_str(fcode_env_t *env, char *fmt, char *fmtbuf, int bsize)
}
bytes = pct - fmt;
- strncpy(tbuf, fmt, bytes);
- strncpy(tbuf+bytes, "%", 1);
- strncpy(tbuf+bytes+1, fmt+bytes, 1);
+ (void) strncpy(tbuf, fmt, bytes);
+ (void) strncpy(tbuf+bytes, "%", 1);
+ (void) strncpy(tbuf+bytes+1, fmt+bytes, 1);
bytes += 2;
tbuf[bytes] = 0;
@@ -561,25 +563,25 @@ fmt_str(fcode_env_t *env, char *fmt, char *fmtbuf, int bsize)
"fmt_str: invalid format type! (%s)\n",
tbuf+bytes-3);
- strncpy(fmtbuf, tbuf, bsize);
+ (void) strncpy(fmtbuf, tbuf, bsize);
return;
}
if (fw > 0) { /* process normal (not long) formats */
bytes = pct - fmt + fw;
- strncpy(tbuf, fmt, bytes);
+ (void) strncpy(tbuf, fmt, bytes);
tbuf[bytes] = 0;
} else {
/* if here, fw must be a long format */
if (*fmptr == 'p') {
bytes = pct - fmt - fw;
- strncpy(tbuf, fmt, bytes);
+ (void) strncpy(tbuf, fmt, bytes);
tbuf[bytes] = 0;
} else {
bytes = pct - fmt - fw - 2;
- strncpy(tbuf, fmt, bytes);
+ (void) strncpy(tbuf, fmt, bytes);
tbuf[bytes] = 'l';
- strncpy(tbuf+bytes+1, fmt+bytes, 2);
+ (void) strncpy(tbuf+bytes+1, fmt+bytes, 2);
tbuf[bytes+1+2] = 0;
}
}
@@ -616,7 +618,7 @@ fmt_str(fcode_env_t *env, char *fmt, char *fmtbuf, int bsize)
(void) snprintf(fmtbuf, bsize, tbuf, llarg);
} else
- strncpy(fmtbuf, fmt, bsize);
+ (void) strncpy(fmtbuf, fmt, bsize);
}
/*
@@ -718,13 +720,13 @@ fc_cmn_start(fcode_env_t *env, char *head, int path)
new->prev = root;
if (root != 0)
root->next = new;
- strcpy(new->buf, head);
+ (void) strcpy(new->buf, head);
new->len = strlen(head);
if (path && env->current_device) {
dpath = get_path(env, env->current_device);
- strcpy(new->buf+new->len, dpath);
+ (void) strcpy(new->buf+new->len, dpath);
new->len += strlen(dpath);
- strncpy(new->buf+new->len++, ": ", 2);
+ (void) strncpy(new->buf+new->len++, ": ", 2);
++new->len;
free(dpath);
}
diff --git a/usr/src/lib/efcode/engine/extend.c b/usr/src/lib/efcode/engine/extend.c
index 9e631012b2..edca69097d 100644
--- a/usr/src/lib/efcode/engine/extend.c
+++ b/usr/src/lib/efcode/engine/extend.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <sys/shm.h>
#include <dlfcn.h>
@@ -57,7 +55,7 @@ static void
do_dlclose(fcode_env_t *env)
{
void *pl = (void *)POP(DS);
- dlclose(pl);
+ (void) dlclose(pl);
}
static void
diff --git a/usr/src/lib/efcode/engine/fcode.c b/usr/src/lib/efcode/engine/fcode.c
index e8cedb3816..2ddbda64fc 100644
--- a/usr/src/lib/efcode/engine/fcode.c
+++ b/usr/src/lib/efcode/engine/fcode.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -339,7 +337,7 @@ token_common(fcode_env_t *env, int headered, int visible)
env->table[token].flags = 0;
if (len) {
env->table[token].name = MALLOC(len+1);
- strncpy(env->table[token].name, namebuff, len);
+ (void) strncpy(env->table[token].name, namebuff, len);
} else {
env->table[token].name = NULL;
}
@@ -542,7 +540,7 @@ byte_load(fcode_env_t *env)
DEBUGF(TOKEN_USAGE, entry->usage++);
PUSH(DS, (fstack_t)apf);
if ((env->state) &&
- ((entry->flags & IMMEDIATE) == 0)) {
+ ((entry->flags & IMMEDIATE) == 0)) {
/* Compile in references */
compile_comma(env);
} else {
@@ -709,7 +707,8 @@ get_token(fcode_env_t *env)
tok = POP(DS);
tok &= MAX_FCODE;
PUSH(DS, (fstack_t)env->table[tok].apf);
- if (env->table[tok].flags & IMMEDIATE) immediate = 1;
+ if (env->table[tok].flags & IMMEDIATE)
+ immediate = 1;
PUSH(DS, immediate);
}
diff --git a/usr/src/lib/efcode/engine/forth.c b/usr/src/lib/efcode/engine/forth.c
index 33bd2c37d1..ddf7007b5f 100644
--- a/usr/src/lib/efcode/engine/forth.c
+++ b/usr/src/lib/efcode/engine/forth.c
@@ -23,8 +23,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -288,7 +286,7 @@ f_exit(fcode_env_t *env)
#define COMPARE(cmp, rhs) ((((s_lforth_t)TOS) cmp((s_lforth_t)(rhs))) ? \
TRUE : FALSE)
-#define UCOMPARE(cmp, rhs) ((((u_lforth_t)TOS) cmp((u_lforth_t)(rhs))) ? \
+#define UCOMPARE(cmp, rhs) ((((u_lforth_t)TOS) cmp((u_lforth_t)(rhs))) ? \
TRUE : FALSE)
#define EQUALS ==
#define NOTEQUALS !=
@@ -689,7 +687,7 @@ pack_str(fcode_env_t *env)
str = (char *)TOS;
TOS = (fstack_t)buf;
*buf++ = (uchar_t)len;
- strncpy(buf, str, (len&0xff));
+ (void) strncpy(buf, str, (len&0xff));
}
void
@@ -2416,7 +2414,7 @@ throw_from_fclib(fcode_env_t *env, fstack_t errcode, char *fmt, ...)
char msg[256];
va_start(ap, fmt);
- vsprintf(msg, fmt, ap);
+ (void) vsprintf(msg, fmt, ap);
if (errcode) {
diff --git a/usr/src/lib/efcode/engine/interactive.c b/usr/src/lib/efcode/engine/interactive.c
index 398f52a686..942f8dcd13 100644
--- a/usr/src/lib/efcode/engine/interactive.c
+++ b/usr/src/lib/efcode/engine/interactive.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -104,7 +102,7 @@ defer(fcode_env_t *env)
PUSH(DS, (fstack_t)&crash_ptr);
name = parse_a_string(env, &len);
make_common_access(env, name, len, 1,
- env->instance_mode, &noop, &noop, &set_defer_actions);
+ env->instance_mode, &noop, &noop, &set_defer_actions);
}
void
@@ -343,7 +341,7 @@ load_file(fcode_env_t *env)
if (fd < 0) {
forth_perror(env, "Can't open '%s'", name);
}
- fstat(fd, &buf);
+ (void) fstat(fd, &buf);
len = buf.st_size;
buffer = MALLOC(len);
if (buffer == 0)
@@ -352,7 +350,7 @@ load_file(fcode_env_t *env)
if ((n = read(fd, buffer, len)) < 0)
forth_perror(env, "read error '%s'", name);
- close(fd);
+ (void) close(fd);
PUSH(DS, (fstack_t)buffer);
PUSH(DS, (fstack_t)n);
}
@@ -504,18 +502,18 @@ read_line(fcode_env_t *env)
struct termio termio, savetermio;
if (!isatty(fileno(stdin))) {
- fgets(buf, sizeof (buf), stdin);
+ (void) fgets(buf, sizeof (buf), stdin);
push_string(env, buf, strlen(buf));
return;
}
printf(prompt_string);
fflush(stdout);
- ioctl(fileno(stdin), TCGETA, &termio);
+ (void) ioctl(fileno(stdin), TCGETA, &termio);
savetermio = termio;
termio.c_lflag &= ~(ICANON|ECHO|ECHOE|IEXTEN);
termio.c_cc[VTIME] = 0;
termio.c_cc[VMIN] = 1;
- ioctl(fileno(stdin), TCSETA, &termio);
+ (void) ioctl(fileno(stdin), TCSETA, &termio);
my_line = cur_line = num_lines;
save_buf[0] = '\0';
for (cursor = eol = buf; ; ) {
@@ -627,7 +625,7 @@ read_line(fcode_env_t *env)
redraw_line(env, buf, cursor, eol,
save_line, save_line + save_cursor,
save_line + len);
- strcpy(buf, save_line);
+ (void) strcpy(buf, save_line);
eol = buf + len;
cursor = buf + save_cursor;
continue;
@@ -636,7 +634,7 @@ read_line(fcode_env_t *env)
p = history_lines[cur_line];
len = strlen(p);
redraw_line(env, buf, cursor, eol, p, p, p + len);
- strcpy(buf, history_lines[cur_line]);
+ (void) strcpy(buf, history_lines[cur_line]);
cursor = buf;
eol = buf + len;
continue;
@@ -753,7 +751,7 @@ read_line(fcode_env_t *env)
break;
}
add_line_to_history(env, buf);
- ioctl(fileno(stdin), TCSETA, &savetermio);
+ (void) ioctl(fileno(stdin), TCSETA, &savetermio);
push_string(env, buf, strlen(buf));
}
@@ -763,7 +761,7 @@ set_prompt(fcode_env_t *env)
char *prompt;
if ((prompt = parse_a_string(env, NULL)) != NULL)
- strncpy(prompt_string, prompt, sizeof (prompt_string));
+ (void) strncpy(prompt_string, prompt, sizeof (prompt_string));
}
#pragma init(_init)
diff --git a/usr/src/lib/efcode/engine/log.c b/usr/src/lib/efcode/engine/log.c
index b17f38b8c4..12b7687736 100644
--- a/usr/src/lib/efcode/engine/log.c
+++ b/usr/src/lib/efcode/engine/log.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Daemon log message. This can direct log messages to either stdout,
* an error log file or syslog (or any combination).
@@ -183,22 +181,22 @@ log_message(int msg_level, char *fmt, ...)
va_start(ap, fmt);
- vsprintf(msg, fmt, ap);
+ (void) vsprintf(msg, fmt, ap);
if (log_to_stdout(msg_level)) {
printf(msg);
fflush(stdout);
}
if (log_to_error_log(msg_level)) {
- fprintf(error_log_fp, msg);
- fflush(error_log_fp);
+ (void) fprintf(error_log_fp, msg);
+ (void) fflush(error_log_fp);
}
if (log_to_syslog(msg_level)) {
if (strlen(log_msg) + strlen(msg) > LOG_LINESIZE - 1) {
syslog(msg_level_to_syslog(msg_level), log_msg);
log_msg[0] = '\0';
}
- strcat(log_msg, msg);
+ (void) strcat(log_msg, msg);
if ((p = strchr(log_msg, '\n')) != NULL) {
*p = '\0';
syslog(msg_level_to_syslog(msg_level), log_msg);
@@ -221,7 +219,7 @@ debug_msg(int debug_level, char *fmt, ...)
va_start(ap, fmt);
- vsprintf(msg, fmt, ap);
+ (void) vsprintf(msg, fmt, ap);
log_message(MSG_DEBUG, msg);
}
@@ -237,8 +235,8 @@ log_perror(int msg_level, char *fmt, ...)
va_start(ap, fmt);
- vsprintf(msg, fmt, ap);
- sprintf(tmp, "%s: %s\n", msg, strerror(errno));
+ (void) vsprintf(msg, fmt, ap);
+ (void) sprintf(tmp, "%s: %s\n", msg, strerror(errno));
log_message(msg_level, tmp);
}
@@ -333,7 +331,7 @@ set_error_log(fcode_env_t *env)
return;
}
if (error_log_fp)
- fclose(error_log_fp);
+ (void) fclose(error_log_fp);
if (error_log_name)
FREE(error_log_name);
error_log_fp = fp;
diff --git a/usr/src/lib/efcode/engine/package.c b/usr/src/lib/efcode/engine/package.c
index 54a75dfe88..2ba034c1a4 100644
--- a/usr/src/lib/efcode/engine/package.c
+++ b/usr/src/lib/efcode/engine/package.c
@@ -588,7 +588,7 @@ locate_package(fcode_env_t *env, char *start)
if ((next_p = strchr(p, ':')) != NULL)
*next_p++ = '\0';
tpath = MALLOC(strlen(p) + strlen(start) + 2);
- sprintf(tpath, "%s/%s", p, start);
+ (void) sprintf(tpath, "%s/%s", p, start);
if ((d = match_package_path(env, tpath)) != NULL) {
FREE(fpath);
FREE(tpath);
@@ -706,10 +706,10 @@ get_path(fcode_env_t *env, device_t *d)
name = get_package_name(env, d);
n = strlen(pre_path) + strlen(name) + 1;
path = MALLOC(n);
- strcpy(path, pre_path);
- strcat(path, name);
+ (void) strcpy(path, pre_path);
+ (void) strcat(path, name);
if (d->child && d->parent)
- strcat(path, "/");
+ (void) strcat(path, "/");
FREE(pre_path);
return (path);
}
diff --git a/usr/src/lib/efcode/engine/properties.c b/usr/src/lib/efcode/engine/properties.c
index ff14c1f03c..966d0f005b 100644
--- a/usr/src/lib/efcode/engine/properties.c
+++ b/usr/src/lib/efcode/engine/properties.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -738,7 +736,7 @@ print_property(fcode_env_t *env, prop_t *p, char *prepend)
char *name = (p->name ? p->name : "<noname>");
if (prepend) {
- sprintf(buf, "%s %s", prepend, name);
+ (void) snprintf(buf, sizeof (buf), "%s %s", prepend, name);
name = buf;
}
print_indented(name);
diff --git a/usr/src/lib/efcode/engine/signal.c b/usr/src/lib/efcode/engine/signal.c
index a023bfd857..eed5c962d9 100644
--- a/usr/src/lib/efcode/engine/signal.c
+++ b/usr/src/lib/efcode/engine/signal.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -55,14 +53,14 @@ process_signal(int sig, siginfo_t *sip, void *addr)
case SIGFPE:
forth_abort(saved_envp, "%s: Fault Addr: 0x%08x",
strsignal(sig), sip->si_addr);
-
+ /* FALLTHROUGH */
case SIGQUIT:
- ioctl(fileno(stdin), TCSETA, &saved_termio);
+ (void) ioctl(fileno(stdin), TCSETA, &saved_termio);
log_message(MSG_FATAL, "SIGQUIT\n");
abort();
case SIGINT:
- ioctl(fileno(stdin), TCSETA, &saved_termio);
+ (void) ioctl(fileno(stdin), TCSETA, &saved_termio);
break;
}
forth_abort(saved_envp, strsignal(sig));
@@ -75,17 +73,17 @@ install_handlers(fcode_env_t *env)
saved_envp = env;
- ioctl(fileno(stdin), TCGETA, &saved_termio);
+ (void) ioctl(fileno(stdin), TCGETA, &saved_termio);
- sigemptyset(&sa.sa_mask);
+ (void) sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_SIGINFO|SA_NODEFER;
sa.sa_handler = 0;
sa.sa_sigaction = process_signal;
- sigaction(SIGINT, &sa, NULL);
- sigaction(SIGQUIT, &sa, NULL);
- sigaction(SIGSEGV, &sa, NULL);
- sigaction(SIGBUS, &sa, NULL);
- sigaction(SIGUSR1, &sa, NULL);
- sigaction(SIGFPE, &sa, NULL);
+ (void) sigaction(SIGINT, &sa, NULL);
+ (void) sigaction(SIGQUIT, &sa, NULL);
+ (void) sigaction(SIGSEGV, &sa, NULL);
+ (void) sigaction(SIGBUS, &sa, NULL);
+ (void) sigaction(SIGUSR1, &sa, NULL);
+ (void) sigaction(SIGFPE, &sa, NULL);
}
diff --git a/usr/src/lib/efcode/fcdriver/get_req.c b/usr/src/lib/efcode/fcdriver/get_req.c
index 2fd07e4fec..dbe3dabb82 100644
--- a/usr/src/lib/efcode/fcdriver/get_req.c
+++ b/usr/src/lib/efcode/fcdriver/get_req.c
@@ -178,8 +178,8 @@ save_fcode_to_file(fcode_env_t *env)
return;
}
log_message(MSG_INFO, "Fcode %p,%x to file '%s'\n", buf, len, fname);
- fwrite(buf, len, sizeof (char), fd);
- fclose(fd);
+ (void) fwrite(buf, len, sizeof (char), fd);
+ (void) fclose(fd);
}
void
@@ -325,7 +325,7 @@ get_request(fcode_env_t *env)
common_data_t *cdp = env->private;
if (cdp->fcode_fd >= 0)
- close(cdp->fcode_fd);
+ (void) close(cdp->fcode_fd);
if (!open_fcode_dev(env))
exit(1);
if (!fc_get_request(cdp)) {
@@ -405,7 +405,7 @@ finish_request(fcode_env_t *env)
{
common_data_t *cdp = env->private;
- close(cdp->fcode_fd);
+ (void) close(cdp->fcode_fd);
}
/*
diff --git a/usr/src/lib/efcode/fcdriver/ioctl.c b/usr/src/lib/efcode/fcdriver/ioctl.c
index 218ceb88db..7a40d98979 100644
--- a/usr/src/lib/efcode/fcdriver/ioctl.c
+++ b/usr/src/lib/efcode/fcdriver/ioctl.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
@@ -85,7 +83,7 @@ fc_run_priv(common_data_t *cdp, char *service, int nin, int nout, ...)
error_msg = "Error";
error = 1;
}
- if ((error & !no_err) ||
+ if ((error && !no_err) ||
(get_interpreter_debug_level() & DEBUG_REG_ACCESS)) {
if (error)
log_message(MSG_ERROR, "%s: FC_RUN_PRIV: %s: ",
diff --git a/usr/src/lib/efcode/fcdriver/load_node.c b/usr/src/lib/efcode/fcdriver/load_node.c
index 613a1f94f6..efbd9caa5b 100644
--- a/usr/src/lib/efcode/fcdriver/load_node.c
+++ b/usr/src/lib/efcode/fcdriver/load_node.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
@@ -71,22 +69,22 @@ build_default_search_path(char *arch)
struct utsname utsname;
int len;
- sysinfo(SI_PLATFORM, platform, sizeof (platform));
- uname(&utsname);
+ (void) sysinfo(SI_PLATFORM, platform, sizeof (platform));
+ (void) uname(&utsname);
len = strlen(search_proto) + strlen(platform) + strlen(utsname.machine);
if (*arch != '\0') {
len += len + (3 * strlen(arch)) + 1;
}
default_search_path = MALLOC(len);
if (*arch != '\0') {
- sprintf(default_search_path, search_proto, platform, arch,
- utsname.machine, arch, arch);
+ (void) sprintf(default_search_path, search_proto, platform,
+ arch, utsname.machine, arch, arch);
p = default_search_path + strlen(default_search_path);
*p++ = ':';
} else
p = default_search_path;
- sprintf(p, search_proto, platform, "", utsname.machine, "", "");
+ (void) sprintf(p, search_proto, platform, "", utsname.machine, "", "");
}
static void
@@ -121,7 +119,7 @@ search_path(char *name, char *search, int (*fn)(char *))
if ((next_p = strchr(p, ':')) != NULL)
*next_p++ = '\0';
tpath = MALLOC(strlen(p) + strlen(name) + 2);
- sprintf(tpath, "%s/%s", p, name);
+ (void) sprintf(tpath, "%s/%s", p, name);
if ((*fn)(tpath)) {
FREE(fpath);
return (tpath);
@@ -169,13 +167,13 @@ is_fcode_file(char *path)
if (fstat(fd, &statb) != 0 || read(fd, header, sizeof (header)) < 0) {
debug_msg(DEBUG_FIND_FCODE, "%s: '%s' can't fstat/read\n",
func_name, path);
- close(fd);
+ (void) close(fd);
return (0);
}
status = check_fcode_header(path, header, statb.st_size);
debug_msg(DEBUG_FIND_FCODE, "%s: '%s' format %s\n", func_name, path,
status ? "OK" : "NOT OK");
- close(fd);
+ (void) close(fd);
return (status);
}
@@ -194,7 +192,7 @@ find_lib_file(fcode_env_t *env, char *prefix, char *name, char *suffix,
}
lib_name = MALLOC(strlen(name) + strlen(prefix) + strlen(suffix) + 1);
- sprintf(lib_name, "%s%s%s", prefix, name, suffix);
+ (void) sprintf(lib_name, "%s%s%s", prefix, name, suffix);
fname = search_path(lib_name, search, fn);
FREE(lib_name);
return (fname);
@@ -245,8 +243,8 @@ install_node_data(fcode_env_t *env, device_t *d)
* build the property node returned, so we have to grab a copy
* of the data.
*/
- strcpy(libname, (char *)p->data);
- strcat(libname, "_");
+ (void) strcpy(libname, (char *)p->data);
+ (void) strcat(libname, "_");
} else
libname[0] = '\0';
@@ -261,7 +259,7 @@ install_node_data(fcode_env_t *env, device_t *d)
* the property node returned, so we have to grab a copy of the
* data.
*/
- strcat(libname, (char *)p->data);
+ (void) strcat(libname, (char *)p->data);
debug_msg(DEBUG_FIND_FCODE, "%s: `%s` lname: '%s'\n", func_name,
get_path(env, d), libname);
diff --git a/usr/src/lib/efcode/fcdriver/misc.c b/usr/src/lib/efcode/fcdriver/misc.c
index b2ea8a9e00..d0891aa9a6 100644
--- a/usr/src/lib/efcode/fcdriver/misc.c
+++ b/usr/src/lib/efcode/fcdriver/misc.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
@@ -463,11 +461,11 @@ get_eeprom_value(fcode_env_t *env, char *name)
FILE *fd;
char buf[80], *p;
- sprintf(buf, "eeprom '%s'", name);
+ (void) sprintf(buf, "eeprom '%s'", name);
if ((fd = popen(buf, "r")) == NULL)
return (NULL);
- fgets(buf, sizeof (buf), fd);
- pclose(fd);
+ (void) fgets(buf, sizeof (buf), fd);
+ (void) pclose(fd);
if ((p = strchr(buf, '\n')) != NULL)
*p = '\0';
if ((p = strchr(buf, '=')) != NULL)
diff --git a/usr/src/lib/efcode/fcdriver/phandle.c b/usr/src/lib/efcode/fcdriver/phandle.c
index 79a202da4e..fddca08ef0 100644
--- a/usr/src/lib/efcode/fcdriver/phandle.c
+++ b/usr/src/lib/efcode/fcdriver/phandle.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
@@ -78,13 +76,13 @@ convert_phandle(fcode_env_t *env, fstack_t d)
if (use_os_handle) {
my_nodeid_t nh;
- nh.my_handle = (fc_phandle_t) d;
+ nh.my_handle = (fc_phandle_t)d;
t = find_resource(&cdp->nodeids, &nh, match_handle);
if (t == NULL) {
r = 0;
} else {
- my_nodeid_t *p = (my_nodeid_t *) t->data;
- r = (device_t *) p->node;
+ my_nodeid_t *p = (my_nodeid_t *)t->data;
+ r = (device_t *)p->node;
}
} else
r = (device_t *)d;
@@ -108,11 +106,11 @@ revert_phandle(fcode_env_t *env, device_t *d)
if (t == NULL) {
r = 0;
} else {
- my_nodeid_t *p = (my_nodeid_t *) t->data;
- r = (fstack_t) p->my_handle;
+ my_nodeid_t *p = (my_nodeid_t *)t->data;
+ r = (fstack_t)p->my_handle;
}
} else
- r = (fstack_t) d;
+ r = (fstack_t)d;
return (r);
}
@@ -135,7 +133,6 @@ allocate_phandle(fcode_env_t *env)
{
private_data_t *pd;
common_data_t *cdp;
- int error;
char *service;
device_t *current;
fc_cell_t hcell;
@@ -160,11 +157,11 @@ allocate_phandle(fcode_env_t *env)
pd = MALLOC(sizeof (private_data_t));
pd->common = cdp;
- pd->parent = (fc_phandle_t) revert_phandle(env, current->parent);
+ pd->parent = (fc_phandle_t)revert_phandle(env, current->parent);
pd->upload = (cdp->init_done == 1);
current->private = pd;
- error = fc_run_priv(cdp, service, 0, 1, &hcell);
+ (void) fc_run_priv(cdp, service, 0, 1, &hcell);
pd->node = fc_cell2phandle(hcell);
diff --git a/usr/src/lib/efcode/fcdriver/upload.c b/usr/src/lib/efcode/fcdriver/upload.c
index 14b8989295..18db29fe55 100644
--- a/usr/src/lib/efcode/fcdriver/upload.c
+++ b/usr/src/lib/efcode/fcdriver/upload.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
@@ -157,10 +155,9 @@ upload_nodes(fcode_env_t *env)
void
validate_nodes(fcode_env_t *env)
{
- int error;
common_data_t *cdp = env->private;
- error = ioctl(cdp->fcode_fd, FC_VALIDATE);
+ (void) ioctl(cdp->fcode_fd, FC_VALIDATE);
}
#pragma init(_init)
diff --git a/usr/src/lib/efcode/gp2/gp2.c b/usr/src/lib/efcode/gp2/gp2.c
index bdc8f2d72f..50f222a7bd 100644
--- a/usr/src/lib/efcode/gp2/gp2.c
+++ b/usr/src/lib/efcode/gp2/gp2.c
@@ -163,9 +163,9 @@ do_encode_unit(fcode_env_t *env)
off = lo & 0x7fffff; /* build config offset */
if (off) {
- sprintf(enc_buf, "%x,%x", id, off);
+ (void) sprintf(enc_buf, "%x,%x", id, off);
} else {
- sprintf(enc_buf, "%x", id);
+ (void) sprintf(enc_buf, "%x", id);
}
debug_msg(DEBUG_REG_ACCESS, "gp2:encode_unit ( %x %x ) -> '%s'\n",
(int)hi, (int)lo, enc_buf);
diff --git a/usr/src/lib/efcode/jupiter/jupiter.c b/usr/src/lib/efcode/jupiter/jupiter.c
index 823cbe1b5f..b11f162613 100644
--- a/usr/src/lib/efcode/jupiter/jupiter.c
+++ b/usr/src/lib/efcode/jupiter/jupiter.c
@@ -239,7 +239,7 @@ do_device_id(fcode_env_t *env)
lo = POP(DS);
portid = 0;
- if (cdp && cdp->fc.unit_address &&
+ if (cdp != NULL && *cdp->fc.unit_address != '\0' &&
((buf = strdup(cdp->fc.unit_address)) != NULL)) {
/*
* Get portid number from unit_address
diff --git a/usr/src/lib/efcode/packages/parse.c b/usr/src/lib/efcode/packages/parse.c
index b75dd73ee5..9377f96708 100644
--- a/usr/src/lib/efcode/packages/parse.c
+++ b/usr/src/lib/efcode/packages/parse.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
@@ -41,7 +39,7 @@ byte_loadfile(fcode_env_t *env)
int len;
load_file(env);
- len = (int) POP(DS);
+ len = (int)POP(DS);
if (len) {
void *ptr = (void *) TOS;
PUSH(DS, 1);
@@ -60,7 +58,7 @@ define_hook(fcode_env_t *env, char *name, int len, char *fcimage)
header(env, name, len, 0);
COMPILE_TOKEN(&do_colon);
env->state |= 1;
- PUSH(DS, (fstack_t) fcimage);
+ PUSH(DS, (fstack_t)fcimage);
PUSH(DS, strlen(fcimage));
compile_string(env);
COMPILE_TOKEN(&byteload_ptr);
@@ -131,5 +129,5 @@ make_builtin_hooks(fcode_env_t *env, char *where)
}
}
FREE(buffer);
- fclose(fd);
+ (void) fclose(fd);
}
diff --git a/usr/src/lib/efcode/pci/pci.c b/usr/src/lib/efcode/pci/pci.c
index 2ee4fc02c2..02fa8bd866 100644
--- a/usr/src/lib/efcode/pci/pci.c
+++ b/usr/src/lib/efcode/pci/pci.c
@@ -241,9 +241,9 @@ do_encode_unit(fcode_env_t *env)
dev = ((hi >> 11) & 0x1f);
if (fn) {
- sprintf(enc_buf, "%x,%x", dev, fn);
+ (void) sprintf(enc_buf, "%x,%x", dev, fn);
} else {
- sprintf(enc_buf, "%x", dev);
+ (void) sprintf(enc_buf, "%x", dev);
}
debug_msg(DEBUG_REG_ACCESS, "pci:encode-unit ( %x ) -> %s\n",
hi, enc_buf);
@@ -287,7 +287,7 @@ do_device_id(fcode_env_t *env)
PUSH(DS, cfgadd + PCI_CONF_DEVID);
config_wfetch(env);
dev_id = POP(DS);
- sprintf(buf, "pci%x,%x", ven_id, dev_id);
+ (void) sprintf(buf, "pci%x,%x", ven_id, dev_id);
push_a_string(env, STRDUP(buf));
}
@@ -311,7 +311,8 @@ do_class_id(fcode_env_t *env)
PUSH(DS, cfgadd + PCI_CONF_PROGCLASS);
config_bfetch(env);
progclass = POP(DS);
- sprintf(buf, "pciclass%02x%02x%02x", basclass, subclass, progclass);
+ (void) sprintf(buf, "pciclass%02x%02x%02x", basclass, subclass,
+ progclass);
push_a_string(env, STRDUP(buf));
}
diff --git a/usr/src/lib/efcode/upa/upa.c b/usr/src/lib/efcode/upa/upa.c
index 251dd5183d..60993a6aa6 100644
--- a/usr/src/lib/efcode/upa/upa.c
+++ b/usr/src/lib/efcode/upa/upa.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <string.h>
#include <fcode/private.h>
@@ -51,7 +49,7 @@ do_encode_unit(fcode_env_t *env)
hi = POP(DS);
lo = POP(DS);
hi = ((hi >> 1) & 0x1f);
- sprintf(buf, "%x,%x", hi, lo);
+ (void) sprintf(buf, "%x,%x", hi, lo);
push_a_string(env, buf);
}
diff --git a/usr/src/lib/libc/port/gen/_ftoll.c b/usr/src/lib/libc/port/gen/_ftoll.c
index 857a52b8a1..66d71f566c 100644
--- a/usr/src/lib/libc/port/gen/_ftoll.c
+++ b/usr/src/lib/libc/port/gen/_ftoll.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "lint.h"
#include <sys/isa_defs.h>
#include <floatingpoint.h>
@@ -104,7 +102,7 @@ __dtoll(double dval)
default:
if (exp > 30) {
m1 = (m0 << (exp - 30)) |
- (m1 >> (62 - exp)) & ~(-1 << (exp - 30));
+ (m1 >> (62 - exp)) & ~(UINT_MAX << (exp - 30));
m0 >>= 62 - exp;
} else {
m1 = m0 >> (30 - exp);
@@ -275,7 +273,7 @@ _Q_qtoll(long double longdbl)
default:
if (exp > 30) {
m1 = (m0 << (exp - 30)) |
- (m1 >> (62 - exp)) & ~(-1 << (exp - 30));
+ (m1 >> (62 - exp)) & ~(UINT_MAX << (exp - 30));
m0 >>= 62 - exp;
} else {
m1 = m0 >> (30 - exp);
diff --git a/usr/src/man/man1m/dispadmin.1m b/usr/src/man/man1m/dispadmin.1m
index 578bb8da87..91f260bc01 100644
--- a/usr/src/man/man1m/dispadmin.1m
+++ b/usr/src/man/man1m/dispadmin.1m
@@ -1,5 +1,6 @@
'\" te
.\" Copyright 1989 AT&T Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright 2020 (c) Sergio Aguayo, All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
@@ -7,7 +8,6 @@
.SH NAME
dispadmin \- process scheduler administration
.SH SYNOPSIS
-.LP
.nf
\fBdispadmin\fR \fB-l\fR
.fi
@@ -23,8 +23,6 @@ dispadmin \- process scheduler administration
.fi
.SH DESCRIPTION
-.sp
-.LP
The \fBdispadmin\fR command displays or changes process scheduler parameters
while the system is running.
.sp
@@ -35,8 +33,6 @@ not attempt to analyze the effect that the new values have on the performance
of the system. Inappropriate values can have a negative effect on system
performance. (See \fISystem Administration Guide: Advanced Administration\fR.)
.SH OPTIONS
-.sp
-.LP
The following options are supported:
.sp
.ne 2
@@ -48,9 +44,9 @@ The following options are supported:
Specifies the class whose parameters are to be displayed or changed. Valid
\fIclass\fR values are: \fBRT\fR for the real-time class, \fBTS\fR for the
time-sharing class, \fBIA\fR for the inter-active class, \fBFSS\fR for the
-fair-share class, and FX for the fixed-priority class. The time-sharing and
-inter-active classes share the same scheduler, so changes to the scheduling
-parameters of one will change those of the other.
+fair-share class, and \fBFX\fR for the fixed-priority class. The time-sharing
+and inter-active classes share the same scheduler, so changes to the
+scheduling parameters of one will change those of the other.
.RE
.sp
@@ -142,7 +138,6 @@ the table at the same time you are overwriting it.
.RE
.SH EXAMPLES
-.LP
\fBExample 1 \fRRetrieving the Current Scheduler Parameters for the real-time
class
.sp
@@ -209,7 +204,6 @@ dispadmin \fB-c\fR TS \fB-s\fR ts.config
.sp
.SH FILES
-.sp
.ne 2
.na
\fB\fB/etc/dispadmin.conf\fR\fR
@@ -220,8 +214,6 @@ Possible location for argument to \fB-s\fR option.
.RE
.SH SEE ALSO
-.sp
-.LP
\fBpriocntl\fR(1), \fBsvcs\fR(1), \fBsvcadm\fR(1M), \fBpriocntl\fR(2),
\fBfx_dptbl\fR(4), \fBrt_dptbl\fR(4), \fBts_dptbl\fR(4), \fBattributes\fR(5),
\fBsmf\fR(5), \fBFSS\fR(7)
@@ -229,14 +221,10 @@ Possible location for argument to \fB-s\fR option.
.LP
\fI\fR \fI\fR
.SH DIAGNOSTICS
-.sp
-.LP
\fBdispadmin\fR prints an appropriate diagnostic message if it fails to
overwrite the current scheduler parameters due to lack of required permissions
or a problem with the specified input file.
.SH NOTES
-.sp
-.LP
The default scheduling class setting facility is managed by the service
management facility, \fBsmf\fR(5), under the service identifier:
.sp
diff --git a/usr/src/uts/common/fs/zfs/arc.c b/usr/src/uts/common/fs/zfs/arc.c
index 9e04e5e00d..939282b378 100644
--- a/usr/src/uts/common/fs/zfs/arc.c
+++ b/usr/src/uts/common/fs/zfs/arc.c
@@ -2538,7 +2538,7 @@ arc_untransform(arc_buf_t *buf, spa_t *spa, const zbookmark_phys_t *zb,
*/
ret = SET_ERROR(EIO);
spa_log_error(spa, zb);
- zfs_ereport_post(FM_EREPORT_ZFS_AUTHENTICATION,
+ (void) zfs_ereport_post(FM_EREPORT_ZFS_AUTHENTICATION,
spa, NULL, zb, NULL, 0, 0);
}
@@ -5801,7 +5801,8 @@ arc_read_done(zio_t *zio)
error = SET_ERROR(EIO);
if ((zio->io_flags & ZIO_FLAG_SPECULATIVE) == 0) {
spa_log_error(zio->io_spa, &acb->acb_zb);
- zfs_ereport_post(FM_EREPORT_ZFS_AUTHENTICATION,
+ (void) zfs_ereport_post(
+ FM_EREPORT_ZFS_AUTHENTICATION,
zio->io_spa, NULL, &acb->acb_zb, zio, 0, 0);
}
}
@@ -6058,7 +6059,7 @@ top:
rc = SET_ERROR(EIO);
if ((zio_flags & ZIO_FLAG_SPECULATIVE) == 0) {
spa_log_error(spa, zb);
- zfs_ereport_post(
+ (void) zfs_ereport_post(
FM_EREPORT_ZFS_AUTHENTICATION,
spa, NULL, zb, NULL, 0, 0);
}
diff --git a/usr/src/uts/common/fs/zfs/spa.c b/usr/src/uts/common/fs/zfs/spa.c
index fc08eebbc0..a040fbfea5 100644
--- a/usr/src/uts/common/fs/zfs/spa.c
+++ b/usr/src/uts/common/fs/zfs/spa.c
@@ -2408,7 +2408,8 @@ spa_load(spa_t *spa, spa_load_state_t state, spa_import_type_t type)
spa->spa_loaded_ts.tv_nsec = 0;
}
if (error != EBADF) {
- zfs_ereport_post(ereport, spa, NULL, NULL, NULL, 0, 0);
+ (void) zfs_ereport_post(ereport, spa,
+ NULL, NULL, NULL, 0, 0);
}
}
spa->spa_load_state = error ? SPA_LOAD_ERROR : SPA_LOAD_NONE;
diff --git a/usr/src/uts/common/fs/zfs/spa_config.c b/usr/src/uts/common/fs/zfs/spa_config.c
index 4719696ca4..ae814208fd 100644
--- a/usr/src/uts/common/fs/zfs/spa_config.c
+++ b/usr/src/uts/common/fs/zfs/spa_config.c
@@ -280,7 +280,8 @@ spa_write_cachefile(spa_t *target, boolean_t removing, boolean_t postsysevent)
* resource issues are resolved.
*/
if (target->spa_ccw_fail_time == 0) {
- zfs_ereport_post(FM_EREPORT_ZFS_CONFIG_CACHE_WRITE,
+ (void) zfs_ereport_post(
+ FM_EREPORT_ZFS_CONFIG_CACHE_WRITE,
target, NULL, NULL, NULL, 0, 0);
}
target->spa_ccw_fail_time = gethrtime();
diff --git a/usr/src/uts/common/fs/zfs/vdev.c b/usr/src/uts/common/fs/zfs/vdev.c
index e82b309537..254af68099 100644
--- a/usr/src/uts/common/fs/zfs/vdev.c
+++ b/usr/src/uts/common/fs/zfs/vdev.c
@@ -1365,7 +1365,7 @@ vdev_probe_done(zio_t *zio)
} else {
ASSERT(zio->io_error != 0);
vdev_dbgmsg(vd, "failed probe");
- zfs_ereport_post(FM_EREPORT_ZFS_PROBE_FAILURE,
+ (void) zfs_ereport_post(FM_EREPORT_ZFS_PROBE_FAILURE,
spa, vd, NULL, NULL, 0, 0);
zio->io_error = SET_ERROR(ENXIO);
}
@@ -1717,7 +1717,8 @@ vdev_open(vdev_t *vd)
*/
if (ashift > vd->vdev_top->vdev_ashift &&
vd->vdev_ops->vdev_op_leaf) {
- zfs_ereport_post(FM_EREPORT_ZFS_DEVICE_BAD_ASHIFT,
+ (void) zfs_ereport_post(
+ FM_EREPORT_ZFS_DEVICE_BAD_ASHIFT,
spa, vd, NULL, NULL, 0, 0);
}
@@ -4408,7 +4409,7 @@ vdev_set_state(vdev_t *vd, boolean_t isopen, vdev_state_t state, vdev_aux_t aux)
class = FM_EREPORT_ZFS_DEVICE_UNKNOWN;
}
- zfs_ereport_post(class, spa, vd, NULL, NULL,
+ (void) zfs_ereport_post(class, spa, vd, NULL, NULL,
save_state, 0);
}
diff --git a/usr/src/uts/common/fs/zfs/vdev_indirect.c b/usr/src/uts/common/fs/zfs/vdev_indirect.c
index effea61bc6..6c636dd4d2 100644
--- a/usr/src/uts/common/fs/zfs/vdev_indirect.c
+++ b/usr/src/uts/common/fs/zfs/vdev_indirect.c
@@ -1382,8 +1382,8 @@ vdev_indirect_checksum_error(zio_t *zio,
void *bad_buf = abd_borrow_buf_copy(ic->ic_data, is->is_size);
abd_t *good_abd = is->is_good_child->ic_data;
void *good_buf = abd_borrow_buf_copy(good_abd, is->is_size);
- zfs_ereport_post_checksum(zio->io_spa, vd, &zio->io_bookmark, zio,
- is->is_target_offset, is->is_size, good_buf, bad_buf, &zbc);
+ (void) zfs_ereport_post_checksum(zio->io_spa, vd, &zio->io_bookmark,
+ zio, is->is_target_offset, is->is_size, good_buf, bad_buf, &zbc);
abd_return_buf(ic->ic_data, bad_buf, is->is_size);
abd_return_buf(good_abd, good_buf, is->is_size);
}
@@ -1459,7 +1459,7 @@ vdev_indirect_all_checksum_errors(zio_t *zio)
vd->vdev_stat.vs_checksum_errors++;
mutex_exit(&vd->vdev_stat_lock);
- zfs_ereport_post_checksum(zio->io_spa, vd,
+ (void) zfs_ereport_post_checksum(zio->io_spa, vd,
&zio->io_bookmark, zio, is->is_target_offset,
is->is_size, NULL, NULL, NULL);
}
diff --git a/usr/src/uts/common/fs/zfs/vdev_raidz.c b/usr/src/uts/common/fs/zfs/vdev_raidz.c
index e4db03ce89..381c2ff84f 100644
--- a/usr/src/uts/common/fs/zfs/vdev_raidz.c
+++ b/usr/src/uts/common/fs/zfs/vdev_raidz.c
@@ -1968,7 +1968,7 @@ raidz_checksum_error(zio_t *zio, raidz_col_t *rc, abd_t *bad_data)
zbc.zbc_has_cksum = 0;
zbc.zbc_injected = rm->rm_ecksuminjected;
- zfs_ereport_post_checksum(zio->io_spa, vd,
+ (void) zfs_ereport_post_checksum(zio->io_spa, vd,
&zio->io_bookmark, zio, rc->rc_offset, rc->rc_size,
rc->rc_abd, bad_data, &zbc);
}
diff --git a/usr/src/uts/common/fs/zfs/zfs_fm.c b/usr/src/uts/common/fs/zfs/zfs_fm.c
index dd854c12e1..2118fd549e 100644
--- a/usr/src/uts/common/fs/zfs/zfs_fm.c
+++ b/usr/src/uts/common/fs/zfs/zfs_fm.c
@@ -735,7 +735,7 @@ zfs_ereport_start_checksum(spa_t *spa, vdev_t *vd, const zbookmark_phys_t *zb,
report->zcr_length = length;
#ifdef _KERNEL
- zfs_ereport_start(&report->zcr_ereport, &report->zcr_detector,
+ (void) zfs_ereport_start(&report->zcr_ereport, &report->zcr_detector,
FM_EREPORT_ZFS_CHECKSUM, spa, vd, zb, zio, offset, length);
if (report->zcr_ereport == NULL) {
diff --git a/usr/src/uts/common/fs/zfs/zfs_vnops.c b/usr/src/uts/common/fs/zfs/zfs_vnops.c
index 99011b83b4..c016b5c1ea 100644
--- a/usr/src/uts/common/fs/zfs/zfs_vnops.c
+++ b/usr/src/uts/common/fs/zfs/zfs_vnops.c
@@ -4839,7 +4839,7 @@ zfs_seek(vnode_t *vp, offset_t ooff, offset_t *noffp,
{
if (vp->v_type == VDIR)
return (0);
- return ((*noffp < 0 || *noffp > MAXOFFSET_T) ? EINVAL : 0);
+ return ((*noffp < 0) ? EINVAL : 0);
}
/*
diff --git a/usr/src/uts/common/fs/zfs/zio.c b/usr/src/uts/common/fs/zfs/zio.c
index 5215a58bf2..9981263343 100644
--- a/usr/src/uts/common/fs/zfs/zio.c
+++ b/usr/src/uts/common/fs/zfs/zio.c
@@ -483,7 +483,7 @@ error:
zio->io_error = SET_ERROR(EIO);
if ((zio->io_flags & ZIO_FLAG_SPECULATIVE) == 0) {
spa_log_error(spa, &zio->io_bookmark);
- zfs_ereport_post(FM_EREPORT_ZFS_AUTHENTICATION,
+ (void) zfs_ereport_post(FM_EREPORT_ZFS_AUTHENTICATION,
spa, NULL, &zio->io_bookmark, zio, 0, 0);
}
} else {
@@ -1995,7 +1995,7 @@ zio_suspend(spa_t *spa, zio_t *zio, zio_suspend_reason_t reason)
"failure and has been suspended; `zpool clear` will be required "
"before the pool can be written to.", spa_name(spa));
- zfs_ereport_post(FM_EREPORT_ZFS_IO_FAILURE, spa, NULL,
+ (void) zfs_ereport_post(FM_EREPORT_ZFS_IO_FAILURE, spa, NULL,
NULL, NULL, 0, 0);
mutex_enter(&spa->spa_suspend_lock);
@@ -4265,7 +4265,7 @@ zio_done(zio_t *zio)
zio->io_vd->vdev_stat.vs_slow_ios++;
mutex_exit(&zio->io_vd->vdev_stat_lock);
- zfs_ereport_post(FM_EREPORT_ZFS_DELAY,
+ (void) zfs_ereport_post(FM_EREPORT_ZFS_DELAY,
zio->io_spa, zio->io_vd, &zio->io_bookmark,
zio, 0, 0);
}
@@ -4280,7 +4280,7 @@ zio_done(zio_t *zio)
* device is currently unavailable.
*/
if (zio->io_error != ECKSUM && vd != NULL && !vdev_is_dead(vd))
- zfs_ereport_post(FM_EREPORT_ZFS_IO, spa, vd,
+ (void) zfs_ereport_post(FM_EREPORT_ZFS_IO, spa, vd,
&zio->io_bookmark, zio, 0, 0);
if ((zio->io_error == EIO || !(zio->io_flags &
@@ -4291,7 +4291,7 @@ zio_done(zio_t *zio)
* error and generate a logical data ereport.
*/
spa_log_error(spa, &zio->io_bookmark);
- zfs_ereport_post(FM_EREPORT_ZFS_DATA, spa, NULL,
+ (void) zfs_ereport_post(FM_EREPORT_ZFS_DATA, spa, NULL,
&zio->io_bookmark, zio, 0, 0);
}
}
diff --git a/usr/src/uts/common/fs/zfs/zvol.c b/usr/src/uts/common/fs/zfs/zvol.c
index 2e684a5ff0..19130289e7 100644
--- a/usr/src/uts/common/fs/zfs/zvol.c
+++ b/usr/src/uts/common/fs/zfs/zvol.c
@@ -1232,7 +1232,7 @@ zvol_strategy(buf_t *bp)
addr = bp->b_un.b_addr;
resid = bp->b_bcount;
- if (resid > 0 && (off < 0 || off >= volsize)) {
+ if (resid > 0 && off >= volsize) {
bioerror(bp, EIO);
biodone(bp);
return (0);
diff --git a/usr/src/uts/i86pc/io/vmm/io/vlapic.c b/usr/src/uts/i86pc/io/vmm/io/vlapic.c
index c1825f4264..1288f69321 100644
--- a/usr/src/uts/i86pc/io/vmm/io/vlapic.c
+++ b/usr/src/uts/i86pc/io/vmm/io/vlapic.c
@@ -96,6 +96,12 @@ __FBSDID("$FreeBSD$");
static void vlapic_set_error(struct vlapic *, uint32_t, bool);
static void vlapic_tmr_reset(struct vlapic *);
+#ifdef __ISRVEC_DEBUG
+static void vlapic_isrstk_accept(struct vlapic *, int);
+static void vlapic_isrstk_eoi(struct vlapic *, int);
+static void vlapic_isrstk_verify(const struct vlapic *);
+#endif /* __ISRVEC_DEBUG */
+
static __inline uint32_t
vlapic_get_id(struct vlapic *vlapic)
{
@@ -495,21 +501,33 @@ vlapic_fire_lvt(struct vlapic *vlapic, u_int lvt)
return (1);
}
-#if 1
-static void
-dump_isrvec_stk(struct vlapic *vlapic)
+static uint_t
+vlapic_active_isr(struct vlapic *vlapic)
{
int i;
- uint32_t *isrptr;
+ uint32_t *isrp;
- isrptr = &vlapic->apic_page->isr0;
- for (i = 0; i < 8; i++)
- printf("ISR%d 0x%08x\n", i, isrptr[i * 4]);
+ isrp = &vlapic->apic_page->isr7;
- for (i = 0; i <= vlapic->isrvec_stk_top; i++)
- printf("isrvec_stk[%d] = %d\n", i, vlapic->isrvec_stk[i]);
+ for (i = 7; i >= 0; i--, isrp -= 4) {
+ uint32_t reg = *isrp;
+
+ if (reg != 0) {
+ uint_t vec = (i * 32) + bsrl(reg);
+
+ if (vec < 16) {
+ /*
+ * Truncate the illegal low vectors to value of
+ * 0, indicating that no active ISR was found.
+ */
+ return (0);
+ }
+ return (vec);
+ }
+ }
+
+ return (0);
}
-#endif
/*
* Algorithm adopted from section "Interrupt, Task and Processor Priority"
@@ -520,55 +538,11 @@ vlapic_update_ppr(struct vlapic *vlapic)
{
int isrvec, tpr, ppr;
- /*
- * Note that the value on the stack at index 0 is always 0.
- *
- * This is a placeholder for the value of ISRV when none of the
- * bits is set in the ISRx registers.
- */
- isrvec = vlapic->isrvec_stk[vlapic->isrvec_stk_top];
+ isrvec = vlapic_active_isr(vlapic);
tpr = vlapic->apic_page->tpr;
-#if 1
- {
- int i, lastprio, curprio, vector, idx;
- uint32_t *isrptr;
-
- if (vlapic->isrvec_stk_top == 0 && isrvec != 0)
- panic("isrvec_stk is corrupted: %d", isrvec);
-
- /*
- * Make sure that the priority of the nested interrupts is
- * always increasing.
- */
- lastprio = -1;
- for (i = 1; i <= vlapic->isrvec_stk_top; i++) {
- curprio = PRIO(vlapic->isrvec_stk[i]);
- if (curprio <= lastprio) {
- dump_isrvec_stk(vlapic);
- panic("isrvec_stk does not satisfy invariant");
- }
- lastprio = curprio;
- }
-
- /*
- * Make sure that each bit set in the ISRx registers has a
- * corresponding entry on the isrvec stack.
- */
- i = 1;
- isrptr = &vlapic->apic_page->isr0;
- for (vector = 0; vector < 256; vector++) {
- idx = (vector / 32) * 4;
- if (isrptr[idx] & (1 << (vector % 32))) {
- if (i > vlapic->isrvec_stk_top ||
- vlapic->isrvec_stk[i] != vector) {
- dump_isrvec_stk(vlapic);
- panic("ISR and isrvec_stk out of sync");
- }
- i++;
- }
- }
- }
+#ifdef __ISRVEC_DEBUG
+ vlapic_isrstk_verify(vlapic);
#endif
if (PRIO(tpr) >= PRIO(isrvec))
@@ -593,25 +567,25 @@ vlapic_process_eoi(struct vlapic *vlapic)
{
struct LAPIC *lapic = vlapic->apic_page;
uint32_t *isrptr, *tmrptr;
- int i, idx, bitpos, vector;
+ int i;
+ uint_t idx, bitpos, vector;
isrptr = &lapic->isr0;
tmrptr = &lapic->tmr0;
for (i = 7; i >= 0; i--) {
idx = i * 4;
- bitpos = fls(isrptr[idx]);
- if (bitpos-- != 0) {
- if (vlapic->isrvec_stk_top <= 0) {
- panic("invalid vlapic isrvec_stk_top %d",
- vlapic->isrvec_stk_top);
- }
- isrptr[idx] &= ~(1 << bitpos);
+ if (isrptr[idx] != 0) {
+ bitpos = bsrl(isrptr[idx]);
vector = i * 32 + bitpos;
+
+ isrptr[idx] &= ~(1 << bitpos);
VCPU_CTR1(vlapic->vm, vlapic->vcpuid, "EOI vector %d",
vector);
VLAPIC_CTR_ISR(vlapic, "vlapic_process_eoi");
- vlapic->isrvec_stk_top--;
+#ifdef __ISRVEC_DEBUG
+ vlapic_isrstk_eoi(vlapic, vector);
+#endif
vlapic_update_ppr(vlapic);
if ((tmrptr[idx] & (1 << bitpos)) != 0) {
vioapic_process_eoi(vlapic->vm, vlapic->vcpuid,
@@ -1143,7 +1117,7 @@ vlapic_intr_accepted(struct vlapic *vlapic, int vector)
{
struct LAPIC *lapic = vlapic->apic_page;
uint32_t *irrptr, *isrptr;
- int idx, stk_top;
+ int idx;
if (vlapic->ops.intr_accepted)
return ((*vlapic->ops.intr_accepted)(vlapic, vector));
@@ -1162,16 +1136,9 @@ vlapic_intr_accepted(struct vlapic *vlapic, int vector)
isrptr[idx] |= 1 << (vector % 32);
VLAPIC_CTR_ISR(vlapic, "vlapic_intr_accepted");
- /*
- * Update the PPR
- */
- vlapic->isrvec_stk_top++;
-
- stk_top = vlapic->isrvec_stk_top;
- if (stk_top >= ISRVEC_STK_SIZE)
- panic("isrvec_stk_top overflow %d", stk_top);
-
- vlapic->isrvec_stk[stk_top] = vector;
+#ifdef __ISRVEC_DEBUG
+ vlapic_isrstk_accept(vlapic, vector);
+#endif
}
void
@@ -1708,3 +1675,92 @@ vlapic_localize_resources(struct vlapic *vlapic)
vmm_glue_callout_localize(&vlapic->callout);
}
#endif /* __FreeBSD */
+
+#ifdef __ISRVEC_DEBUG
+static void
+vlapic_isrstk_eoi(struct vlapic *vlapic, int vector)
+{
+ if (vlapic->isrvec_stk_top <= 0) {
+ panic("invalid vlapic isrvec_stk_top %d",
+ vlapic->isrvec_stk_top);
+ }
+ vlapic->isrvec_stk_top--;
+}
+
+static void
+vlapic_isrstk_accept(struct vlapic *vlapic, int vector)
+{
+ int stk_top;
+
+ vlapic->isrvec_stk_top++;
+
+ stk_top = vlapic->isrvec_stk_top;
+ if (stk_top >= ISRVEC_STK_SIZE)
+ panic("isrvec_stk_top overflow %d", stk_top);
+
+ vlapic->isrvec_stk[stk_top] = vector;
+}
+
+static void
+vlapic_isrstk_dump(const struct vlapic *vlapic)
+{
+ int i;
+ uint32_t *isrptr;
+
+ isrptr = &vlapic->apic_page->isr0;
+ for (i = 0; i < 8; i++)
+ printf("ISR%d 0x%08x\n", i, isrptr[i * 4]);
+
+ for (i = 0; i <= vlapic->isrvec_stk_top; i++)
+ printf("isrvec_stk[%d] = %d\n", i, vlapic->isrvec_stk[i]);
+}
+
+static void
+vlapic_isrstk_verify(const struct vlapic *vlapic)
+{
+ int i, lastprio, curprio, vector, idx;
+ uint32_t *isrptr;
+
+ /*
+ * Note: The value at index 0 in isrvec_stk is always 0.
+ *
+ * It is a placeholder for the value of ISR vector when no bits are set
+ * in the ISRx registers.
+ */
+ if (vlapic->isrvec_stk_top == 0 && vlapic->isrvec_stk[0] != 0) {
+ panic("isrvec_stk is corrupted: %d", vlapic->isrvec_stk[0]);
+ }
+
+ /*
+ * Make sure that the priority of the nested interrupts is
+ * always increasing.
+ */
+ lastprio = -1;
+ for (i = 1; i <= vlapic->isrvec_stk_top; i++) {
+ curprio = PRIO(vlapic->isrvec_stk[i]);
+ if (curprio <= lastprio) {
+ vlapic_isrstk_dump(vlapic);
+ panic("isrvec_stk does not satisfy invariant");
+ }
+ lastprio = curprio;
+ }
+
+ /*
+ * Make sure that each bit set in the ISRx registers has a
+ * corresponding entry on the isrvec stack.
+ */
+ i = 1;
+ isrptr = &vlapic->apic_page->isr0;
+ for (vector = 0; vector < 256; vector++) {
+ idx = (vector / 32) * 4;
+ if (isrptr[idx] & (1 << (vector % 32))) {
+ if (i > vlapic->isrvec_stk_top ||
+ vlapic->isrvec_stk[i] != vector) {
+ vlapic_isrstk_dump(vlapic);
+ panic("ISR and isrvec_stk out of sync");
+ }
+ i++;
+ }
+ }
+}
+#endif
diff --git a/usr/src/uts/i86pc/io/vmm/io/vlapic_priv.h b/usr/src/uts/i86pc/io/vmm/io/vlapic_priv.h
index 5795d48d52..8a0d594de3 100644
--- a/usr/src/uts/i86pc/io/vmm/io/vlapic_priv.h
+++ b/usr/src/uts/i86pc/io/vmm/io/vlapic_priv.h
@@ -27,6 +27,18 @@
*
* $FreeBSD$
*/
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ *
+ * Copyright 2020 Oxide Computer Company
+ */
#ifndef _VLAPIC_PRIV_H_
#define _VLAPIC_PRIV_H_
@@ -140,6 +152,10 @@ enum boot_state {
#define VLAPIC_TMR_CNT 8
+#ifdef DEBUG
+#define __ISRVEC_DEBUG
+#endif
+
struct vlapic;
struct vlapic_ops {
@@ -166,15 +182,6 @@ struct vlapic {
struct bintime timer_period_bt; /* timer period */
struct mtx timer_mtx;
- /*
- * The 'isrvec_stk' is a stack of vectors injected by the local apic.
- * A vector is popped from the stack when the processor does an EOI.
- * The vector on the top of the stack is used to compute the
- * Processor Priority in conjunction with the TPR.
- */
- uint8_t isrvec_stk[ISRVEC_STK_SIZE];
- int isrvec_stk_top;
-
uint64_t msr_apicbase;
enum boot_state boot_state;
@@ -199,6 +206,19 @@ struct vlapic {
*/
uint32_t tmr_vec_deassert[VLAPIC_TMR_CNT];
uint32_t tmr_vec_assert[VLAPIC_TMR_CNT];
+
+#ifdef __ISRVEC_DEBUG
+ /*
+ * The 'isrvec_stk' is a stack of vectors injected by the local APIC.
+ * It is used as a debugging method to double-check the behavior of the
+ * emulation. Vectors are pushed to the stack when they are accepted
+ * for injection and popped from the stack when the processor performs
+ * an EOI. The vector on the top of the stack is used to verify the
+ * computed Processor Priority.
+ */
+ uint8_t isrvec_stk[ISRVEC_STK_SIZE];
+ int isrvec_stk_top;
+#endif
};
void vlapic_init(struct vlapic *vlapic);
diff --git a/usr/src/uts/sun4v/ontario/io/tsalarm.c b/usr/src/uts/sun4v/ontario/io/tsalarm.c
index 7fb9577028..6f80db8e88 100644
--- a/usr/src/uts/sun4v/ontario/io/tsalarm.c
+++ b/usr/src/uts/sun4v/ontario/io/tsalarm.c
@@ -544,7 +544,7 @@ FAIL:
if (rv != 0) {
if (softc->flags & TSAL_OPENED)
(void) ldi_close(softc->lh, FREAD|FWRITE, credp);
- if (softc->flags * TSAL_IDENTED)
+ if (softc->flags & TSAL_IDENTED)
(void) ldi_ident_release(softc->li);
softc->flags &= ~(TSAL_OPENED | TSAL_IDENTED);
if (softc->req_ptr != NULL)