#include "uv.h"
#include "internal.h"
#include <assert.h>
#include <string.h>
#include <errno.h>
#include <kvm.h>
#include <paths.h>
#include <unistd.h>
#include <time.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/resource.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <uvm/uvm_extern.h>
Go to the source code of this file.
◆ uv__platform_loop_delete()
void uv__platform_loop_delete |
( |
uv_loop_t * |
loop | ) |
|
◆ uv__platform_loop_init()
◆ uv__random_sysctl()
int uv__random_sysctl |
( |
void * |
buf, |
|
|
size_t |
len |
|
) |
| |
Definition at line 238 of file netbsd.c.
239 static int name[] = {CTL_KERN, KERN_ARND};
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec req
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
◆ uv_cpu_info()
Definition at line 180 of file netbsd.c.
181 unsigned int ticks = (
unsigned int)sysconf(_SC_CLK_TCK);
182 unsigned int multiplier = ((
uint64_t)1000L / ticks);
183 unsigned int cur = 0;
192 size =
sizeof(model);
193 if (sysctlbyname(
"machdep.cpu_brand", &model, &
size,
NULL, 0) &&
194 sysctlbyname(
"hw.model", &model, &
size,
NULL, 0)) {
198 size =
sizeof(numcpus);
199 if (sysctlbyname(
"hw.ncpu", &numcpus, &
size,
NULL, 0))
204 size =
sizeof(cpuspeed);
205 if (sysctlbyname(
"machdep.tsc_freq", &cpuspeed, &
size,
NULL, 0))
210 if (cp_times ==
NULL)
213 if (sysctlbyname(
"kern.cp_time", cp_times, &
size,
NULL, 0))
216 *cpu_infos =
uv__malloc(numcpus *
sizeof(**cpu_infos));
223 for (
i = 0;
i < numcpus;
i++) {
224 cpu_info = &(*cpu_infos)[
i];
struct uv_cpu_times_s cpu_times
char * uv__strdup(const char *s)
void * uv__malloc(size_t size)
References count, CP_IDLE, CP_INTR, CP_NICE, CP_SYS, CP_USER, uv_cpu_info_s::cpu_times, CPUSTATES, i, uv_cpu_times_s::idle, int, uv_cpu_times_s::irq, uv_cpu_info_s::model, uv_cpu_times_s::nice, NULL, uv_cpu_info_s::speed, uv_cpu_times_s::sys, u_int64_t, uv_cpu_times_s::user, UV__ERR, uv__free(), uv__malloc(), and uv__strdup().
◆ uv_exepath()
int uv_exepath |
( |
char * |
buffer, |
|
|
size_t * |
size |
|
) |
| |
Definition at line 66 of file netbsd.c.
71 char int_buf[PATH_MAX];
79 mib[1] = KERN_PROC_ARGS;
81 mib[3] = KERN_PROC_PATHNAME;
84 if (sysctl(mib, 4, int_buf, &int_size,
NULL, 0))
ssize_t uv__strscpy(char *d, const char *s, size_t n)
References ARRAY_SIZE, NULL, UV__ERR, and uv__strscpy().
◆ uv_get_constrained_memory()
uint64_t uv_get_constrained_memory |
( |
void |
| ) |
|
◆ uv_get_free_memory()
Definition at line 100 of file netbsd.c.
103 int which[] = {CTL_VM, VM_UVMEXP};
RzBinInfo * info(RzBinFile *bf)
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol which
References ARRAY_SIZE, info(), NULL, UV__ERR, and which.
◆ uv_get_total_memory()
◆ uv_loadavg()
void uv_loadavg |
( |
double |
avg[3] | ) |
|
◆ uv_resident_set_memory()
Definition at line 134 of file netbsd.c.
136 struct kinfo_proc2 *kinfo =
NULL;
139 int max_size =
sizeof(
struct kinfo_proc2);
142 page_size = getpagesize();
145 kd = kvm_open(
NULL,
NULL,
NULL, KVM_NO_FILES,
"kvm_open");
149 kinfo = kvm_getproc2(kd, KERN_PROC_PID,
pid, max_size, &nprocs);
152 *rss = kinfo->p_vm_rssize * page_size;
159 if (kd) kvm_close(kd);
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc pid
void error(const char *msg)
References error(), NULL, and pid.
◆ uv_uptime()
int uv_uptime |
( |
double * |
uptime | ) |
|
Definition at line 164 of file netbsd.c.
168 static int which[] = {CTL_KERN, KERN_BOOTTIME};
175 *uptime = (double)(now -
info.tv_sec);
static static fork const void static count static fd const char const char static newpath char char char static envp time
References ARRAY_SIZE, info(), NULL, time, UV__ERR, and which.