1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-27 17:18:33 +00:00

cleaned openbsd code and changed warning/error printf's to ERR/CRIT_ERR

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@867 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Toni Spets 2007-05-06 13:00:35 +00:00
parent 904d5c9afa
commit 90b318f9cb

View File

@ -62,7 +62,7 @@ static int kvm_init()
kd = kvm_open(NULL, NULL, NULL, KVM_NO_FILES, NULL); kd = kvm_open(NULL, NULL, NULL, KVM_NO_FILES, NULL);
if(kd == NULL) if(kd == NULL)
fprintf(stderr, "error opening kvm\n"); ERR("error opening kvm");
else init_kvm = 1; else init_kvm = 1;
return 1; return 1;
@ -118,7 +118,7 @@ update_uptime()
time(&now); time(&now);
info.uptime = now - boottime.tv_sec; info.uptime = now - boottime.tv_sec;
} else { } else {
fprintf(stderr, "Could not get uptime\n"); ERR("Could not get uptime");
info.uptime = 0; info.uptime = 0;
} }
} }
@ -305,7 +305,7 @@ update_cpu_usage()
} }
if (sysctl(mib, 2, &cp_time, &len, NULL, 0) < 0) { if (sysctl(mib, 2, &cp_time, &len, NULL, 0) < 0) {
(void) fprintf(stderr, "Cannot get kern.cp_time"); ERR("Cannot get kern.cp_time");
} }
fresh.load[0] = cp_time[CP_USER]; fresh.load[0] = cp_time[CP_USER];
@ -379,11 +379,9 @@ void update_obsd_sensors()
switch (type) { switch (type) {
case SENSOR_TEMP: case SENSOR_TEMP:
//printf("num: %i value: %.2f\n", sensor.numt, (sensor.value - 273150000) / 1000000.0);
obsd_sensors.temp[dev][sensor.numt] = (sensor.value - 273150000) / 1000000.0; obsd_sensors.temp[dev][sensor.numt] = (sensor.value - 273150000) / 1000000.0;
break; break;
case SENSOR_FANRPM: case SENSOR_FANRPM:
//printf("num: %i value: %i\n", sensor.numt, sensor.value);
obsd_sensors.fan[dev][sensor.numt] = sensor.value; obsd_sensors.fan[dev][sensor.numt] = sensor.value;
break; break;
case SENSOR_VOLTS_DC: case SENSOR_VOLTS_DC:
@ -410,7 +408,7 @@ void get_obsd_vendor(char *buf, size_t client_buffer_size)
char vendor[64]; char vendor[64];
size_t size = sizeof(vendor); size_t size = sizeof(vendor);
if(sysctl(mib, 2, vendor, &size, NULL, 0) == -1) { if(sysctl(mib, 2, vendor, &size, NULL, 0) == -1) {
fprintf(stderr, "error reading vendor"); ERR("error reading vendor");
snprintf(buf, client_buffer_size, "unknown"); snprintf(buf, client_buffer_size, "unknown");
} else { } else {
snprintf(buf, client_buffer_size, "%s", vendor); snprintf(buf, client_buffer_size, "%s", vendor);
@ -426,7 +424,7 @@ void get_obsd_product(char *buf, size_t client_buffer_size)
char product[64]; char product[64];
size_t size = sizeof(product); size_t size = sizeof(product);
if(sysctl(mib, 2, product, &size, NULL, 0) == -1) { if(sysctl(mib, 2, product, &size, NULL, 0) == -1) {
fprintf(stderr, "error reading product"); ERR("error reading product");
snprintf(buf, client_buffer_size, "unknown"); snprintf(buf, client_buffer_size, "unknown");
} else { } else {
snprintf(buf, client_buffer_size, "%s", product); snprintf(buf, client_buffer_size, "%s", product);
@ -548,13 +546,9 @@ update_wifi_stats()
bcopy(bssid.i_bssid, &nr.nr_macaddr, sizeof(nr.nr_macaddr)); bcopy(bssid.i_bssid, &nr.nr_macaddr, sizeof(nr.nr_macaddr));
strlcpy(nr.nr_ifname, ifa->ifa_name, sizeof(nr.nr_ifname)); strlcpy(nr.nr_ifname, ifa->ifa_name, sizeof(nr.nr_ifname));
if (ioctl(s, SIOCG80211NODE, &nr) == 0 && nr.nr_rssi) { if (ioctl(s, SIOCG80211NODE, &nr) == 0 && nr.nr_rssi)
//if (nr.nr_max_rssi)
// printf(" %u%%", IEEE80211_NODEREQ_RSSI(&nr));
//else
ns->linkstatus = nr.nr_rssi; ns->linkstatus = nr.nr_rssi;
} }
}
cleanup: cleanup:
close(s); close(s);
} }
@ -610,7 +604,7 @@ proc_find_top(struct process **cpu, struct process **mem)
mib[1] = HW_USERMEM; mib[1] = HW_USERMEM;
size_t size = sizeof(total_pages); size_t size = sizeof(total_pages);
if(sysctl(mib, 2, &total_pages, &size, NULL, 0) == -1) if(sysctl(mib, 2, &total_pages, &size, NULL, 0) == -1)
fprintf(stderr, "error reading nmempages\n"); ERR("error reading nmempages");
int max_size = sizeof(struct kinfo_proc2); int max_size = sizeof(struct kinfo_proc2);
p = kvm_getproc2(kd, KERN_PROC_ALL, 0, max_size, &n_processes); p = kvm_getproc2(kd, KERN_PROC_ALL, 0, max_size, &n_processes);