Review: set OS properties with JRS

Alexander Strange astrange at apple.com
Mon May 16 21:30:53 PDT 2011


On May 17, 2011, at 12:22 AM, Greg Lewis wrote:

> On Mon, May 16, 2011 at 10:42:02PM -0400, Alexander Strange wrote:
>> On May 16, 2011, at 10:38 PM, Alexander Strange wrote:
>>> Now we get:
>>> 
>>> os.name: Mac OS X
>>> os.version: 10.6.7
>>> 
>>> This doesn't introduce any Objective-C, but JRSProperties.h includes Cocoa.h so I still had to add the cflags for it.
> 
> Should there have been a link to a webrev or something included?

I attached a .diff. I assumed I'd forgotten to attach it, but it seems the list is stripping it out. Maybe it has the wrong MIME type?

I'm not familiar with the usual review mechanisms yet, this was more of a test run. For now, let's copy and paste.

diff --git a/make/java/java/Makefile b/make/java/java/Makefile
--- a/make/java/java/Makefile
+++ b/make/java/java/Makefile
@@ -96,6 +96,10 @@
 
 FILES_c    +=   java_props_md.c
 
+ifeq ($(PLATFORM), macosx)
+CFLAGS_$(VARIANT)/java_props_md.o = -Os -x objective-c
+endif
+
 #
 # Make sure first rule does 'all'
 #
diff --git a/src/solaris/native/java/lang/java_props_md.c b/src/solaris/native/java/lang/java_props_md.c
--- a/src/solaris/native/java/lang/java_props_md.c
+++ b/src/solaris/native/java/lang/java_props_md.c
@@ -42,6 +42,10 @@
 #include <time.h>
 #include <errno.h>
 
+#ifdef MACOSX
+#import <JavaRuntimeSupport/JRSProperties.h>
+#endif
+
 #if defined(_ALLBSD_SOURCE)
 #if !defined(P_tmpdir)
 #include <paths.h>
@@ -406,10 +410,15 @@
 
     /* os properties */
     {
+#ifdef MACOSX
+        sprops.os_name = JRSCopyOSName();
+        sprops.os_version = JRSCopyOSVersion();
+#else
         struct utsname name;
         uname(&name);
         sprops.os_name = strdup(name.sysname);
         sprops.os_version = strdup(name.release);
+#endif
 
         sprops.os_arch = ARCHPROPNAME;
 



More information about the macosx-port-dev mailing list