FreeBSD: drop unused jail_errmsg variable

This commit is contained in:
Christian Göttsche 2021-01-27 15:11:56 +01:00 committed by BenBE
parent 399add39ca
commit 79620d01c0
2 changed files with 16 additions and 35 deletions

View File

@ -40,8 +40,6 @@ in the source distribution for its full text.
#include "zfs/openzfs_sysctl.h" #include "zfs/openzfs_sysctl.h"
char jail_errmsg[JAIL_ERRMSGLEN];
static int MIB_hw_physmem[2]; static int MIB_hw_physmem[2];
static int MIB_vm_stats_vm_v_page_count[4]; static int MIB_vm_stats_vm_v_page_count[4];
static int pageSize; static int pageSize;
@ -413,13 +411,12 @@ static char* FreeBSDProcessList_readProcessName(kvm_t* kd, const struct kinfo_pr
} }
static char* FreeBSDProcessList_readJailName(const struct kinfo_proc* kproc) { static char* FreeBSDProcessList_readJailName(const struct kinfo_proc* kproc) {
char* jname = NULL; if (kproc->ki_jid == 0)
char jnamebuf[MAXHOSTNAMELEN]; return xStrdup("-");
if (kproc->ki_jid != 0) { char jnamebuf[MAXHOSTNAMELEN] = {0};
struct iovec jiov[6]; struct iovec jiov[4];
memset(jnamebuf, 0, sizeof(jnamebuf));
IGNORE_WCASTQUAL_BEGIN IGNORE_WCASTQUAL_BEGIN
*(const void**)&jiov[0].iov_base = "jid"; *(const void**)&jiov[0].iov_base = "jid";
jiov[0].iov_len = sizeof("jid"); jiov[0].iov_len = sizeof("jid");
@ -429,26 +426,13 @@ IGNORE_WCASTQUAL_BEGIN
jiov[2].iov_len = sizeof("name"); jiov[2].iov_len = sizeof("name");
jiov[3].iov_base = jnamebuf; jiov[3].iov_base = jnamebuf;
jiov[3].iov_len = sizeof(jnamebuf); jiov[3].iov_len = sizeof(jnamebuf);
*(const void**)&jiov[4].iov_base = "errmsg";
jiov[4].iov_len = sizeof("errmsg");
jiov[5].iov_base = jail_errmsg;
jiov[5].iov_len = JAIL_ERRMSGLEN;
IGNORE_WCASTQUAL_END IGNORE_WCASTQUAL_END
jail_errmsg[0] = 0;
int jid = jail_get(jiov, 6, 0); int jid = jail_get(jiov, 4, 0);
if (jid < 0) { if (jid == kproc->ki_jid)
if (!jail_errmsg[0]) { return xStrdup(jnamebuf);
xSnprintf(jail_errmsg, JAIL_ERRMSGLEN, "jail_get: %s", strerror(errno));
}
} else if (jid == kproc->ki_jid) {
jname = xStrdup(jnamebuf);
}
} else {
jname = xStrdup("-");
}
return jname; return NULL;
} }
void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) { void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {

View File

@ -17,9 +17,6 @@ in the source distribution for its full text.
#include "zfs/ZfsArcStats.h" #include "zfs/ZfsArcStats.h"
#define JAIL_ERRMSGLEN 1024
extern char jail_errmsg[JAIL_ERRMSGLEN];
typedef struct CPUData_ { typedef struct CPUData_ {
double userPercent; double userPercent;
double nicePercent; double nicePercent;