Date: Thu, 29 Aug 2013 18:31:41 GMT From: Jan Beich <jbeich@tormail.org> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/181659: [patch] devel/android-tools-adb: get rid of /proc dependency Message-ID: <201308291831.r7TIVfOH032386@oldred.freebsd.org> Resent-Message-ID: <201308291840.r7TIe0jX088517@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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 <sys/types.h> +#include <sys/sysctl.h> #include <unistd.h> -#include <limits.h> -#include <stdio.h> 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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308291831.r7TIVfOH032386>