diff options
author | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-31 22:25:00 +0000 |
---|---|---|
committer | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-31 22:25:00 +0000 |
commit | 4a34ce0854e16bd546f7048dc9364441b62d7ea1 (patch) | |
tree | 9ce5e2fb380834cad7ec8f64d7d15f965bd8c752 /base/base_paths_linux.cc | |
parent | 1de04bb69e44c7f2d62fb553c0b7e1c9ec6501b3 (diff) | |
download | chromium_src-4a34ce0854e16bd546f7048dc9364441b62d7ea1.zip chromium_src-4a34ce0854e16bd546f7048dc9364441b62d7ea1.tar.gz chromium_src-4a34ce0854e16bd546f7048dc9364441b62d7ea1.tar.bz2 |
Port some of the base module to FreeBSD. Extracted from
http://codereview.chromium.org/172032.
The patch is contributed by Ben Laurie of Google.
Original review URL: http://codereview.chromium.org/180037
R=wtc
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/183016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24950 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/base_paths_linux.cc')
-rw-r--r-- | base/base_paths_linux.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/base/base_paths_linux.cc b/base/base_paths_linux.cc index b235f6b..151c411 100644 --- a/base/base_paths_linux.cc +++ b/base/base_paths_linux.cc @@ -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? + 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; |