Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(573)

Unified Diff: base/base_paths_linux.cc

Issue 180037: Port some of the base system to FreeBSD. Extracted from... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/base_paths.h ('k') | base/native_library.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/base_paths_linux.cc
===================================================================
--- base/base_paths_linux.cc (revision 24732)
+++ base/base_paths_linux.cc (working copy)
@@ -15,15 +15,21 @@
namespace base {
+#if defined(OS_LINUX)
+const char kSelfExe[] = "/proc/self/exe";
+#elif defined(OS_FREEBSD)
+const char kSelfExe[] = "/proc/curproc/file";
+#endif
+
bool PathProviderLinux(int key, FilePath* result) {
FilePath path;
switch (key) {
case base::FILE_EXE:
case base::FILE_MODULE: { // TODO(evanm): is this correct?
char bin_dir[PATH_MAX + 1];
- int bin_dir_size = readlink("/proc/self/exe", bin_dir, PATH_MAX);
+ int bin_dir_size = readlink(kSelfExe, bin_dir, PATH_MAX);
if (bin_dir_size < 0 || bin_dir_size > PATH_MAX) {
- NOTREACHED() << "Unable to resolve /proc/self/exe.";
+ NOTREACHED() << "Unable to resolve " << kSelfExe << '.';
return false;
}
bin_dir[bin_dir_size] = 0;
« no previous file with comments | « base/base_paths.h ('k') | base/native_library.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698