hostres_scalars.c (154245) | hostres_scalars.c (154249) |
---|---|
1/*- 2 * Copyright (c) 2005-2006 The FreeBSD Project 3 * All rights reserved. 4 * 5 * Author: Victor Cruceru <soc-victor@freebsd.org> 6 * 7 * Redistribution of this software and documentation and use in source and 8 * binary forms, with or without modification, are permitted provided that --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * | 1/*- 2 * Copyright (c) 2005-2006 The FreeBSD Project 3 * All rights reserved. 4 * 5 * Author: Victor Cruceru <soc-victor@freebsd.org> 6 * 7 * Redistribution of this software and documentation and use in source and 8 * binary forms, with or without modification, are permitted provided that --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * |
29 * $FreeBSD: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c 154245 2006-01-12 02:53:42Z obrien $ | 29 * $FreeBSD: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c 154249 2006-01-12 07:44:40Z harti $ |
30 */ 31 32/* 33 * Host Resources MIB scalars implementation for SNMPd. 34 */ 35 36#include <sys/types.h> 37#include <sys/sysctl.h> --- 54 unchanged lines hidden (view full) --- 92 size_t len = sizeof(kernel_boot_timestamp); 93 94 if (sysctl(mib, 2, &kernel_boot_timestamp, 95 &len, NULL, 0) == -1) { 96 syslog(LOG_ERR, "sysctl KERN_BOOTTIME failed: %m"); 97 return (SNMP_ERR_GENERR); 98 } 99 | 30 */ 31 32/* 33 * Host Resources MIB scalars implementation for SNMPd. 34 */ 35 36#include <sys/types.h> 37#include <sys/sysctl.h> --- 54 unchanged lines hidden (view full) --- 92 size_t len = sizeof(kernel_boot_timestamp); 93 94 if (sysctl(mib, 2, &kernel_boot_timestamp, 95 &len, NULL, 0) == -1) { 96 syslog(LOG_ERR, "sysctl KERN_BOOTTIME failed: %m"); 97 return (SNMP_ERR_GENERR); 98 } 99 |
100 HRDBG("boot timestamp from kernel: {%ld, %ld}", 101 kernel_boot_timestamp.tv_sec, 102 kernel_boot_timestamp.tv_usec); | 100 HRDBG("boot timestamp from kernel: {%lld, %ld}", 101 (long long)kernel_boot_timestamp.tv_sec, 102 (long)kernel_boot_timestamp.tv_usec); |
103 104 kernel_boot = ((uint64_t)kernel_boot_timestamp.tv_sec * 100) + 105 (kernel_boot_timestamp.tv_usec / 10000); 106 } 107 108 if (gettimeofday(&right_now, NULL) < 0) { 109 syslog(LOG_ERR, "gettimeofday failed: %m"); 110 return (SNMP_ERR_GENERR); --- 403 unchanged lines hidden --- | 103 104 kernel_boot = ((uint64_t)kernel_boot_timestamp.tv_sec * 100) + 105 (kernel_boot_timestamp.tv_usec / 10000); 106 } 107 108 if (gettimeofday(&right_now, NULL) < 0) { 109 syslog(LOG_ERR, "gettimeofday failed: %m"); 110 return (SNMP_ERR_GENERR); --- 403 unchanged lines hidden --- |