diff options
| author | Andy McFadden <fadden@android.com> | 2009-05-27 16:01:13 -0700 |
|---|---|---|
| committer | Andy McFadden <fadden@android.com> | 2009-05-27 16:01:13 -0700 |
| commit | 5cd6406e7a2c610af43a3803c7a10d6d5e6df8cb (patch) | |
| tree | 5e91353ed3ec9a7ee15a36e7fbeb0211dfe8cb44 /simulator/app/executablepath_linux.cpp | |
| parent | 90dabc91201c1fedf8b54d560fea442123140954 (diff) | |
| download | android_development-5cd6406e7a2c610af43a3803c7a10d6d5e6df8cb.tar.gz android_development-5cd6406e7a2c610af43a3803c7a10d6d5e6df8cb.tar.bz2 android_development-5cd6406e7a2c610af43a3803c7a10d6d5e6df8cb.zip | |
Sim-only files move, part 1/2.
Move Pipe and executablepath from libutils to the simulator, since nothing
else uses them.
Diffstat (limited to 'simulator/app/executablepath_linux.cpp')
| -rw-r--r-- | simulator/app/executablepath_linux.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/simulator/app/executablepath_linux.cpp b/simulator/app/executablepath_linux.cpp new file mode 100644 index 000000000..b8d2a3d6f --- /dev/null +++ b/simulator/app/executablepath_linux.cpp @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <utils/executablepath.h> +#include <sys/types.h> +#include <unistd.h> +#include <limits.h> +#include <stdio.h> + +void executablepath(char exe[PATH_MAX]) +{ + char proc[100]; + sprintf(proc, "/proc/%d/exe", getpid()); + + int err = readlink(proc, exe, PATH_MAX); +} + |
