diff options
author | Andrew Haley <aph@gcc.gnu.org> | 2003-03-10 19:45:30 +0000 |
---|---|---|
committer | Andrew Haley <aph@gcc.gnu.org> | 2003-03-10 19:45:30 +0000 |
commit | c068c63834776a4ee7cc563b4713fc867d11b5a5 (patch) | |
tree | a4c3279fd9e6344dedbfac2337937e049b960715 /libjava/posix.cc | |
parent | 630287af48fcf25759f9e96d0ef39db90b5fa3af (diff) | |
download | gcc-c068c63834776a4ee7cc563b4713fc867d11b5a5.zip gcc-c068c63834776a4ee7cc563b4713fc867d11b5a5.tar.gz gcc-c068c63834776a4ee7cc563b4713fc867d11b5a5.tar.bz2 |
[multiple changes]
2003-03-10 2003-02-27 Mohan Embar <gnustuff@thisiscool.com>
* include/jvm.h: removed declaration of _Jv_ThisExecutable()
setter; made return value of getter const char* instead of char*
* prims.cc: removed all references to _Jv_ThisExecutable().
These are in the platform-specific sections now.
* posix.cc: define platform-specific _Jv_ThisExecutable().
Handle DISABLE_MAIN_ARGS and HAVE_PROC_SELF_EXE cases
* win32.cc: define platform-specific _Jv_ThisExecutable()
using GetModuleFilename()
* java/lang/natRuntime.cc: set gnu.gcj.progname property
to argv[0] instead of _Jv_ThisExecutable()
2003-03-10 Ranjit Mathew <rmathew@hotmail.com>
* gnu/gcj/runtime/NameFinder.java (usingAddr2name): New flag
that is set if we are using addr2name.awk instead of addr2line.
(NameFinder): Set usingAddr2name if using addr2name.awk.
(getExternalLabel): New native method to convert a method
name to an external label.
(lookup): Convert name given by addr2line to an external label
before demangling.
* gnu/gcj/runtime/natNameFinder.cc (LABEL_PREFIX): New string
constant representing the prefix attached to method names to
convert them to an external label.
(gnu::gcj::runtime::NameFinder::getExternalLabel): Define
using LABEL_PREFIX.
From-SVN: r64111
Diffstat (limited to 'libjava/posix.cc')
-rw-r--r-- | libjava/posix.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libjava/posix.cc b/libjava/posix.cc index ebff1c9..2f80833 100644 --- a/libjava/posix.cc +++ b/libjava/posix.cc @@ -25,6 +25,26 @@ details. */ extern "C" unsigned long long _clock (void); #endif +// platform-specific executable name +extern const char **_Jv_argv; + +#if defined(HAVE_PROC_SELF_EXE) +static char exec_name[20]; + // initialized in _Jv_platform_initialize() +#endif + +const char *_Jv_ThisExecutable (void) +{ +#if defined(DISABLE_MAIN_ARGS) + return "[Embedded App]"; +#elif defined(HAVE_PROC_SELF_EXE) + return exec_name; + // initialized in _Jv_platform_initialize() +#else + return _Jv_argv[0]; +#endif +} + // gettimeofday implementation. jlong _Jv_platform_gettimeofday () @@ -62,6 +82,11 @@ _Jv_platform_initialize (void) #else signal (SIGPIPE, SIG_IGN); #endif + +#if defined (HAVE_PROC_SELF_EXE) + // Compute our executable name + sprintf (exec_name, "/proc/%d/exe", getpid ()); +#endif } // Set platform-specific System properties. |