merged volatile memory barriers
[cacao.git] / src / toolbox / util.c
index 9540761e72180af5b9c50b262739241a131c1a7b..fc5a1c4b3696038f631ab257d1740abe72688c1b 100644 (file)
@@ -1,9 +1,7 @@
 /* src/toolbox/util.c - contains some utility functions
 
-   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
-   C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
-   E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
-   J. Wenninger, Institut f. Computersprachen - TU Wien
+   Copyright (C) 1996-2005, 2006, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
-
-   Authors: Christian Thalinger
-
-   Changes:
-
-   $Id: util.c 5104 2006-07-10 17:22:18Z twisti $
-
 */
 
 
 #include <errno.h>
 #include <stdarg.h>
 #include <unistd.h>
-#include <sys/time.h>
 
 #include "vm/types.h"
 
-#include "mm/memory.h"
-#include "vm/exceptions.h"
-#include "vm/stringlocal.h"
-#include "vm/vm.h"
-
-
-/* _Jv_getcwd ******************************************************************
-
-   Return the current working directory.
-
-   RETURN VALUE:
-       pointer to a char array allocated by MNEW, or
-          NULL if memory could not be allocated.
-
-*******************************************************************************/
-
-char *_Jv_getcwd(void)
-{
-       char *buf;
-       s4    size;
-
-       size = 1024;
-
-       buf = MNEW(char, size);
-
-       while (buf) {
-               if (getcwd(buf, size) != NULL)
-                       return buf;
-
-               MFREE(buf, char, size);
-
-               /* too small buffer or a more serious problem */
-
-               if (errno != ERANGE)
-                       throw_cacao_exception_exit(string_java_lang_InternalError,
-                                                                          strerror(errno));
-
-               /* double the buffer size */
-
-               size *= 2;
-
-               buf = MNEW(char, size);
-       }
-
-       return NULL;
-}
+#include "mm/memory.hpp"
+#include "vm/vm.hpp"
 
 
 /* get_variable_message_length *************************************************
@@ -140,28 +85,6 @@ int get_variable_message_length(const char *fmt, va_list ap)
 }
 
 
-/* util_current_time_millis ****************************************************
-
-   Return the current time in milliseconds.
-
-*******************************************************************************/
-
-s8 util_current_time_millis(void)
-{
-       struct timeval tv;
-       s8             result;
-
-       if (gettimeofday(&tv, NULL) == -1)
-               vm_abort("gettimeofday failed: %s", strerror(errno));
-
-       result = (s8) tv.tv_sec;
-       result *= 1000;
-       result += (tv.tv_usec / 1000);
-
-       return result;
-}
-
-
 /*
  * These are local overrides for various environment variables in Emacs.
  * Please do not remove this and leave it at the end of the file, where