From owner-freebsd-ports-bugs@FreeBSD.ORG Thu Aug 29 18:40:01 2013 Return-Path: Delivered-To: freebsd-ports-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 0DD03FE8 for ; Thu, 29 Aug 2013 18:40:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C7E522F9D for ; Thu, 29 Aug 2013 18:40:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id r7TIe0Oc088518 for ; Thu, 29 Aug 2013 18:40:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id r7TIe0jX088517; Thu, 29 Aug 2013 18:40:00 GMT (envelope-from gnats) Resent-Date: Thu, 29 Aug 2013 18:40:00 GMT Resent-Message-Id: <201308291840.r7TIe0jX088517@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, Jan Beich Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id EB8159A8 for ; Thu, 29 Aug 2013 18:31:41 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D98722F2B for ; Thu, 29 Aug 2013 18:31:41 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r7TIVfZE032387 for ; Thu, 29 Aug 2013 18:31:41 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r7TIVfOH032386; Thu, 29 Aug 2013 18:31:41 GMT (envelope-from nobody) Message-Id: <201308291831.r7TIVfOH032386@oldred.freebsd.org> Date: Thu, 29 Aug 2013 18:31:41 GMT From: Jan Beich To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: ports/181659: [patch] devel/android-tools-adb: get rid of /proc dependency X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Aug 2013 18:40:01 -0000 >Number: 181659 >Category: ports >Synopsis: [patch] devel/android-tools-adb: get rid of /proc dependency >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Aug 29 18:40:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Jan Beich >Release: >Organization: >Environment: /proc is empty (default) >Description: >How-To-Repeat: $ adb start-server * daemon not running. starting it now on port 5037 * * daemon started successfully * ADB server didn't ACK * failed to start daemon * Exit 255 >Fix: --- no_procfs.diff begins here --- --- get_my_path_freebsd.c~ +++ get_my_path_freebsd.c @@ -18,19 +18,18 @@ */ #include +#include #include -#include -#include void get_my_path(char *exe, size_t maxLen) { - char proc[64]; + int mib[] = { + CTL_KERN, + KERN_PROC, + KERN_PROC_PATHNAME, + getpid() + }; - snprintf(proc, sizeof(proc), "/proc/%d/file", getpid()); - - int err = readlink(proc, exe, maxLen - 1); - - exe[err > 0 ? err : 0] = '\0'; + sysctl(mib, sizeof(mib)/sizeof(mib[0]), exe, &maxLen, NULL, 0); } - --- no_procfs.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: