harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Deakin <oliver.dea...@googlemail.com>
Subject Re: [vmi] Retrieving system properties
Date Wed, 13 Dec 2006 16:19:17 GMT
Tim Ellison wrote:
> GetSystemProperty will return VMI_ERROR_NONE and a string value for
> existing properties, or NULL value for a non-existent property.
>
> We then rename VMI_ERROR_NOT_FOUND to VMI_ERROR_ILLEGAL_ARG and
> SetSystemProperty will return VMI_ERROR_NONE for setting an existing
> property to a string value, or VMI_ILLEGAL_ARG if there is an attempt to
> set the property value to NULL.
>
> How does that sound?
>   

+1 to that - was writing the same thing but my machine blue screened :(
So I imagine the classlib patch would look something like:

Index: modules/luni/src/main/native/include/shared/vmi.h
===================================================================
--- modules/luni/src/main/native/include/shared/vmi.h    (revision 486074)
+++ modules/luni/src/main/native/include/shared/vmi.h    (working copy)
@@ -44,7 +44,7 @@
     VMI_ERROR_UNIMPLEMENTED = 2,        /**< Function has not been 
implemented */
     VMI_ERROR_UNSUPPORTED_VERSION = 3,  /**< The requested VM interface 
version is not supported */
     VMI_ERROR_OUT_OF_MEMORY = 4,        /**< Not enough memory was 
available to complete the request */
-    VMI_ERROR_NOT_FOUND = 5,            /**< The requested system 
property was not found */
+    VMI_ERROR_ILLEGAL_ARG = 5,          /**< The requested system 
property was not found */
     VMI_ERROR_READ_ONLY = 6,            /**< An attempt was made to 
modify a read-only item */
     vmiErrorEnsureWideEnum = 0x1000000  /* ensure 4-byte enum */
   } vmiError;
@@ -220,8 +220,13 @@
 
  /**
   * @fn VMInterfaceFunctions_::GetSystemProperty(VMInterface * vmi, 
char *key, char **valuePtr)
-  * Retrieve the value of a VM system property.
+  * Retrieve the value of a VM system property.
   *
+  * If the property exists, returns VMI_ERROR_NONE and *valuePtr
+  * will be the address of the string value.
+  * If the propery does not exist, returns VMI_ERROR_NONE and
+  * *valuePtr will be NULL.
+  *
   * @note The returned string is owned by the VM, and should not be freed.
   */
   vmiError JNICALL GetSystemProperty (VMInterface * vmi, char *key,
@@ -230,7 +235,10 @@
 /**
  * @fn VMInterfaceFunctions_::SetSystemProperty(VMInterface * vmi, char 
*key, char *value)
  * Override the value of a VM system property
- *
+ *
+ * Returns VMI_ERROR_NONE if the property is set successfully.
+ * Returns VMI_ERROR_ILLEGAL_ARG if value is NULL.
+ *
  * @code vmiError JNICALL SetSystemProperty(VMInterface* vmi, char* 
key, char* value); @endcode
  *
  * @param[in] vmi  The VM interface pointer
Index: modules/luni/src/main/native/luni/shared/luniglob.c
===================================================================
--- modules/luni/src/main/native/luni/shared/luniglob.c    (revision 486569)
+++ modules/luni/src/main/native/luni/shared/luniglob.c    (working copy)
@@ -269,14 +269,18 @@
         /* Make a string version of the CP separator */
         char cpSeparator[] = {(char)hysysinfo_get_classpathSeparator 
(), '\0'};
        
-        /* Read current value of bootclasspath property */
+        /* Read current value of bootclasspath property - sets
+           bootstrapClassPath = NULL if the property does not exist */
         rcGetProperty = (*vmInterface)->GetSystemProperty (vmInterface,
             BOOTCLASSPATH_PROPERTY,
             &bootstrapClassPath);
 
-        /* Gregory - no property is found, VM bootclasspath is not 
defined */
+        /* There has been an error getting the property - cleanup and 
exit */
         if (VMI_ERROR_NONE != rcGetProperty)
-            bootstrapClassPath = NULL;
+        {
+            returnCode = JNI_ERR;
+            goto cleanup;
+        }
 
         qsort(props, number, sizeof(key_value_pair), props_compare);


Regards,
Oliver

> Tim
>
>
>
>   

-- 
Oliver Deakin
IBM United Kingdom Limited


Mime
View raw message