From owner-freebsd-ports-bugs@FreeBSD.ORG Wed Jan 30 08:10:04 2008 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCC8916A41A for ; Wed, 30 Jan 2008 08:10:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B4F4A13C45B for ; Wed, 30 Jan 2008 08:10:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m0U8A3wq036408 for ; Wed, 30 Jan 2008 08:10:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m0U8A3SV036405; Wed, 30 Jan 2008 08:10:03 GMT (envelope-from gnats) Resent-Date: Wed, 30 Jan 2008 08:10:03 GMT Resent-Message-Id: <200801300810.m0U8A3SV036405@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, KOIE Hidetaka Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8232A16A41A for ; Wed, 30 Jan 2008 08:05:45 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 6A2C813C45B for ; Wed, 30 Jan 2008 08:05:45 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m0U83va6058262 for ; Wed, 30 Jan 2008 08:03:57 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.2/8.14.1/Submit) id m0U83vZR058261; Wed, 30 Jan 2008 08:03:57 GMT (envelope-from nobody) Message-Id: <200801300803.m0U83vZR058261@www.freebsd.org> Date: Wed, 30 Jan 2008 08:03:57 GMT From: KOIE Hidetaka To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/120142: wmcube-gdk does not work on CURRENT X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jan 2008 08:10:04 -0000 >Number: 120142 >Category: ports >Synopsis: wmcube-gdk does not work on CURRENT >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Jan 30 08:10:03 UTC 2008 >Closed-Date: >Last-Modified: >Originator: KOIE Hidetaka >Release: FreeBSD 8.0-CURRENT amd64 >Organization: surigiken >Environment: FreeBSD guriandgura 8.0-CURRENT FreeBSD 8.0-CURRENT #0: Sat Jan 26 13:56 :29 JST 2008 koie@guriandgura:/usr/obj/usr/src/sys/GURIANDGURA amd64 >Description: wmcube-gdk exits with error, because kvm_nlist("_cp_time") fails. >How-To-Repeat: % wmcube-gdk kvm_open: kvm_nlist: No such file or directory Error: unable to get nlist % >Fix: use sysctl(3). Patch attached with submission follows: --- wmcube.c.orig2 2008-01-30 16:30:42.370561646 +0900 +++ wmcube.c 2008-01-30 16:40:51.514960568 +0900 @@ -174,6 +174,7 @@ float lum_vector[3] = { 0, 0, 100 }; /* #ifdef FREEBSD static kvm_t *kd; static struct nlist nlst[] = { {"_cp_time"}, {0} }; +static int cp_time_mib[2]; #endif void prep_digits(void) @@ -1582,9 +1583,14 @@ int calc_cpu_total() #include #include #include +#include int init_calc_cpu() { + size_t len = 2; + if (sysctlnametomib("kern.cp_time", cp_time_mib, &len) == 0) + goto ok; + printf("\nWarning: unable to sysctl kern.cp_time\n\n"); if ((kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "kvm_open")) == NULL) { printf("\nError: unable to open kvm\n\n"); @@ -1596,6 +1602,7 @@ int init_calc_cpu() exit(1); } + ok: /* drop setgid & setuid (hi GOBBLES, who the fuck are you? */ seteuid(getuid()); setegid(getgid()); @@ -1615,6 +1622,13 @@ int calc_cpu_total() int cpu, nice, system, idle; unsigned long int cpu_time[CPUSTATES]; + if (cp_time_mib[0] != 0) { + size_t cpu_time_len = sizeof (cpu_time); + if (sysctl(cp_time_mib, 2, cpu_time, &cpu_time_len, NULL, 0) < 0) { + printf("\nError sysctl\n\n"); + exit(0); + } + } else if (kvm_read(kd, nlst[0].n_value, &cpu_time, sizeof(cpu_time)) != sizeof(cpu_time)) { printf("\nError reading kvm\n\n"); >Release-Note: >Audit-Trail: >Unformatted: