NetBSD proc_args
This commit is contained in:
parent
02280ec3c1
commit
e406af0b70
|
@ -1396,11 +1396,16 @@ int sigar_os_proc_args_get(sigar_t *sigar, sigar_pid_t pid,
|
||||||
}
|
}
|
||||||
|
|
||||||
return SIGAR_OK;
|
return SIGAR_OK;
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__) || defined(__NetBSD__)
|
||||||
char buffer[SIGAR_ARG_MAX+1], *ptr=buffer;
|
char buffer[SIGAR_ARG_MAX+1], *ptr=buffer;
|
||||||
size_t len = sizeof(buffer);
|
size_t len = sizeof(buffer);
|
||||||
|
# ifdef __NetBSD__
|
||||||
|
int mib[] = { CTL_KERN, KERN_PROC_ARGS, 0, KERN_PROC_ARGV };
|
||||||
|
mib[2] = pid;
|
||||||
|
# else
|
||||||
int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_ARGS, 0 };
|
int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_ARGS, 0 };
|
||||||
mib[3] = pid;
|
mib[3] = pid;
|
||||||
|
# endif
|
||||||
|
|
||||||
if (sysctl(mib, NMIB(mib), buffer, &len, NULL, 0) < 0) {
|
if (sysctl(mib, NMIB(mib), buffer, &len, NULL, 0) < 0) {
|
||||||
return errno;
|
return errno;
|
||||||
|
|
Loading…
Reference in New Issue