| 1 | // posix.cc -- Helper functions for POSIX-flavored OSs.
|
|---|
| 2 |
|
|---|
| 3 | /* Copyright (C) 2000, 2001, 2002 Free Software Foundation
|
|---|
| 4 |
|
|---|
| 5 | This file is part of libgcj.
|
|---|
| 6 |
|
|---|
| 7 | This software is copyrighted work licensed under the terms of the
|
|---|
| 8 | Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
|---|
| 9 | details. */
|
|---|
| 10 |
|
|---|
| 11 | #include <config.h>
|
|---|
| 12 |
|
|---|
| 13 | #include "posix.h"
|
|---|
| 14 |
|
|---|
| 15 | #include <stdlib.h>
|
|---|
| 16 | #include <errno.h>
|
|---|
| 17 | #include <signal.h>
|
|---|
| 18 | #include <stdio.h>
|
|---|
| 19 |
|
|---|
| 20 | #include <jvm.h>
|
|---|
| 21 | #include <java/lang/Thread.h>
|
|---|
| 22 | #include <java/io/InterruptedIOException.h>
|
|---|
| 23 | #include <java/util/Properties.h>
|
|---|
| 24 |
|
|---|
| 25 | #if defined (ECOS)
|
|---|
| 26 | extern "C" unsigned long long _clock (void);
|
|---|
| 27 | #endif
|
|---|
| 28 |
|
|---|
| 29 | #if defined(HAVE_PROC_SELF_EXE)
|
|---|
| 30 | static char exec_name[20];
|
|---|
| 31 | // initialized in _Jv_platform_initialize()
|
|---|
| 32 | #endif
|
|---|
| 33 |
|
|---|
| 34 | const char *_Jv_ThisExecutable (void)
|
|---|
| 35 | {
|
|---|
| 36 | #if defined(DISABLE_MAIN_ARGS)
|
|---|
| 37 | return "[Embedded App]";
|
|---|
| 38 | #elif defined(HAVE_PROC_SELF_EXE)
|
|---|
| 39 | return exec_name;
|
|---|
| 40 | // initialized in _Jv_platform_initialize()
|
|---|
| 41 | #else
|
|---|
| 42 | return _Jv_GetSafeArg (0);
|
|---|
| 43 | #endif
|
|---|
| 44 | }
|
|---|
| 45 |
|
|---|
| 46 | // gettimeofday implementation.
|
|---|
| 47 | jlong
|
|---|
| 48 | _Jv_platform_gettimeofday ()
|
|---|
| 49 | {
|
|---|
| 50 | #if defined (HAVE_GETTIMEOFDAY)
|
|---|
| 51 | timeval tv;
|
|---|
| 52 | gettimeofday (&tv, NULL);
|
|---|
| 53 | return (tv.tv_sec * 1000LL) + (tv.tv_usec / 1000LL);
|
|---|
|
|---|