Patch: embedded libjava -vs- natSystem changes

Tom Tromey tromey@cygnus.com
Wed Dec 15 14:32:00 GMT 1999


I'm committing this patch.  It changes embedded ports of libgcj so
that they don't use getuid() or getcwd().

We need to do something better here, but that will have to wait until
I have (or somebody has) time to really think about it.

1999-12-15  Tom Tromey  <tromey@cygnus.com>

	* java/lang/natSystem.cc (init_properties): Don't set user.name or
	user.home if NO_GETUID defined.  Only set user.dir if getcwd
	exists.

	* include/config.h.in: Rebuilt.
	* acconfig.h (NO_GETUID): New define.
	* configure.in: Rebuilt.
	* configure.in: Define NO_GETUID in cross case.  Check for getcwd
	in native case.

Tom

Index: acconfig.h
===================================================================
RCS file: /cvs/cvsfiles/devo/libjava/acconfig.h,v
retrieving revision 1.19.2.2
diff -u -r1.19.2.2 acconfig.h
--- acconfig.h	1999/10/04 21:36:01	1.19.2.2
+++ acconfig.h	1999/12/15 22:29:12
@@ -115,3 +115,6 @@
 
 /* Define if java.net native functions should be stubbed out.  */
 #undef DISABLE_JAVA_NET
+
+/* Define if getuid() and friends are missing.  */
+#undef NO_GETUID
Index: configure.in
===================================================================
RCS file: /cvs/cvsfiles/devo/libjava/configure.in,v
retrieving revision 1.66.2.6
diff -u -r1.66.2.6 configure.in
--- configure.in	1999/10/07 19:49:03	1.66.2.6
+++ configure.in	1999/12/15 22:29:18
@@ -304,6 +304,9 @@
    dnl We also assume we are using gcc, which provides alloca.
    AC_DEFINE(HAVE_ALLOCA)
 
+   dnl Assume we do not have getuid and friends.
+   AC_DEFINE(NO_GETUID)
+
    ZLIBSPEC=-lzgcj
 
    # If Canadian cross, then don't pick up tools from the build
@@ -319,7 +322,7 @@
 else
    AC_CHECK_FUNCS(strerror ioctl select fstat open fsync sleep)
    AC_CHECK_FUNCS(ctime_r ctime, break)
-   AC_CHECK_FUNCS(gmtime_r localtime_r readdir_r getpwuid_r)
+   AC_CHECK_FUNCS(gmtime_r localtime_r readdir_r getpwuid_r getcwd)
    AC_CHECK_FUNCS(access stat mkdir rename rmdir unlink realpath)
    AC_CHECK_FUNCS(inet_aton inet_addr, break)
    AC_CHECK_FUNCS(inet_pton uname inet_ntoa)
Index: java/lang/natSystem.cc
===================================================================
RCS file: /cvs/cvsfiles/devo/libjava/java/lang/natSystem.cc,v
retrieving revision 1.32.2.1
diff -u -r1.32.2.1 natSystem.cc
--- natSystem.cc	1999/10/01 17:38:09	1.32.2.1
+++ natSystem.cc	1999/12/15 22:29:19
@@ -313,6 +313,7 @@
     }
 #endif /* HAVE_UNAME */
 
+#ifndef NO_GETUID
 #ifdef HAVE_PWD_H
   uid_t user_id = getuid ();
   struct passwd *pwd_entry;
@@ -346,7 +347,9 @@
       SET ("user.home", pwd_entry->pw_dir);
     }
 #endif /* HAVE_PWD_H */
+#endif /* NO_GETUID */
 
+#ifdef HAVE_GETCWD
 #ifdef HAVE_UNISTD_H
   /* Use getcwd to set "user.dir". */
   int buflen = 250;
@@ -365,5 +368,6 @@
     }
   if (buffer != NULL)
     free (buffer);
-#endif
+#endif /* HAVE_UNISTD_H */
+#endif /* HAVE_GETCWD */
 }


More information about the Java-patches mailing list