ports/181659: [patch] devel/android-tools-adb: get rid of /proc dependency
Jan Beich
jbeich at tormail.org
Thu Aug 29 18:40:01 UTC 2013
>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:
More information about the freebsd-ports-bugs
mailing list