You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by nd...@apache.org on 2009/05/15 04:07:28 UTC
svn commit: r774983 - in
/harmony/enhanced/classlib/trunk/modules/luni/src/main/native: fdlibm/unix/
launcher/unix/ luni/shared/ luni/unix/ luni/unix/macosx/
Author: ndbeyer
Date: Fri May 15 02:07:27 2009
New Revision: 774983
URL: http://svn.apache.org/viewvc?rev=774983&view=rev
Log:
tweaks for Mac OS X x86 compilation
Added:
harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/macosx/
harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/macosx/OSResourcesMonitor.c
Modified:
harmony/enhanced/classlib/trunk/modules/luni/src/main/native/fdlibm/unix/makefile
harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/unix/main_hlp.c
harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/cbigint.c
harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/dblparse.c
harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c
harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c
harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c
harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/helpers.c
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/fdlibm/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/fdlibm/unix/makefile?rev=774983&r1=774982&r2=774983&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/fdlibm/unix/makefile (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/fdlibm/unix/makefile Fri May 15 02:07:27 2009
@@ -47,7 +47,7 @@
# OPT is overriden except on zOS (fpic, for example, is not an option on zOS)
ifneq ($(HY_OS),zos)
ifneq ($(HY_OS),aix)
-OPT = -O0 -ffloat-store -fpic
+OPT = -O0 -ffloat-store -fPIC
endif
endif
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/unix/main_hlp.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/unix/main_hlp.c?rev=774983&r1=774982&r2=774983&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/unix/main_hlp.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/unix/main_hlp.c Fri May 15 02:07:27 2009
@@ -40,7 +40,7 @@
#if defined(LINUX)
#include <sys/sysinfo.h>
#endif
-#if defined(FREEBSD)
+#if defined(FREEBSD) || defined(MACOSX)
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
@@ -62,7 +62,7 @@
static IDATA searchSystemPath (char *filename, char **result);
-int
+int
main_get_executable_name (char *argv0, char **result)
{
@@ -203,7 +203,7 @@
return pointer;
}
-void
+void
main_mem_free_memory (void *memoryPointer)
{
free (memoryPointer);
@@ -229,13 +229,13 @@
}
/**
- * @internal Returns the current working directory.
+ * @internal Returns the current working directory.
*
* @return 0 on success, -1 on failure.
*
- * @note The buffer to hold this string (including its terminating NUL) is allocated with
- * main_mem_allocate_memory. The caller should free this memory with
- * main_mem_free_memory when it is no longer needed.
+ * @note The buffer to hold this string (including its terminating NUL) is allocated with
+ * main_mem_allocate_memory. The caller should free this memory with
+ * main_mem_free_memory when it is no longer needed.
*/
static IDATA
cwdname (char **result)
@@ -382,7 +382,7 @@
return (UDATA) dlclose ((void *)descriptor);
}
-/**
+/**
* Opens a shared library .
*
* @param[out] descriptor Pointer to memory which is filled in with shared-library handle on success.
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/cbigint.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/cbigint.c?rev=774983&r1=774982&r2=774983&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/cbigint.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/cbigint.c Fri May 15 02:07:27 2009
@@ -18,7 +18,7 @@
#include <string.h>
#include "cbigint.h"
-#if defined(LINUX) || defined(FREEBSD) || defined(ZOS)
+#if defined(LINUX) || defined(FREEBSD) || defined(ZOS) || defined(MACOSX)
#define USE_LL
#endif
@@ -665,7 +665,7 @@
do {
overflow = simpleAppendDecimalDigitHighPrecision(result, length, 0);
if (overflow)
- result[length++] = overflow;
+ result[length++] = overflow;
} while (--e);
*/
return length;
@@ -686,7 +686,7 @@
do {
overflow = simpleAppendDecimalDigitHighPrecision(result, length, 0);
if (overflow)
- result[length++] = overflow;
+ result[length++] = overflow;
} while (--e);
*/
/* Replace the current implementaion which performs a
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/dblparse.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/dblparse.c?rev=774983&r1=774982&r2=774983&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/dblparse.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/dblparse.c Fri May 15 02:07:27 2009
@@ -22,7 +22,7 @@
#include "harmonyglob.h"
#include "exceptions.h"
-#if defined(LINUX) || defined(FREEBSD) || defined(ZOS)
+#if defined(LINUX) || defined(FREEBSD) || defined(ZOS) || defined(MACOSX)
#define USE_LL
#endif
@@ -673,7 +673,7 @@
* 1.234123412431233E107
* 1.2341234124312331E107
* 1.2341234124312331E107
- *
+ *
*/
JNIEXPORT void JNICALL
Java_org_apache_harmony_luni_util_NumberConverter_bigIntDigitGeneratorInstImpl (JNIEnv *
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c?rev=774983&r1=774982&r2=774983&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c Fri May 15 02:07:27 2009
@@ -22,7 +22,7 @@
#include "harmonyglob.h"
#include "exceptions.h"
-#if defined(LINUX) || defined(FREEBSD) || defined(ZOS)
+#if defined(LINUX) || defined(FREEBSD) || defined(MACOSX) || defined(ZOS)
#define USE_LL
#endif
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c?rev=774983&r1=774982&r2=774983&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c Fri May 15 02:07:27 2009
@@ -23,7 +23,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
-#if defined(FREEBSD) || defined(AIX) || defined(ZOS)
+#if defined(FREEBSD) || defined(AIX) || defined(ZOS) || defined(MACOSX)
#include <sys/types.h>
#include <sys/socket.h>
#else
@@ -42,7 +42,7 @@
#define FD_BIAS 0
#endif /* ZOS */
-typedef int OSSOCKET;
+typedef int OSSOCKET;
typedef struct hysocket_struct
{
OSSOCKET sock;
@@ -164,11 +164,11 @@
jboolean bufsCopied = JNI_FALSE;
jboolean offsetsCopied = JNI_FALSE;
jboolean lengthsCopied = JNI_FALSE;
- jlong *bufs;
+ jlong *bufs;
jint *offsets;
jint *lengths;
int i = 0;
- long totalRead = 0;
+ long totalRead = 0;
struct iovec *vectors = (struct iovec *)hymem_allocate_memory(size * sizeof(struct iovec));
if(vectors == NULL){
return -1;
@@ -181,7 +181,7 @@
vectors[i].iov_len = lengths[i];
i++;
}
- totalRead = readv(fd-FD_BIAS, vectors, size);
+ totalRead = readv(fd, vectors, size);
if(bufsCopied){
(*env)->ReleaseLongArrayElements(env, jbuffers, bufs, JNI_ABORT);
}
@@ -206,11 +206,11 @@
jboolean bufsCopied = JNI_FALSE;
jboolean offsetsCopied = JNI_FALSE;
jboolean lengthsCopied = JNI_FALSE;
- jlong *bufs;
+ jlong *bufs;
jint *offsets;
jint *lengths;
int i = 0;
- long totalWritten = 0;
+ long totalWritten = 0;
struct iovec *vectors = (struct iovec *)hymem_allocate_memory(size * sizeof(struct iovec));
if(vectors == NULL){
return -1;
@@ -223,7 +223,7 @@
vectors[i].iov_len = lengths[i];
i++;
}
- totalWritten = writev(fd-FD_BIAS, vectors, size);
+ totalWritten = writev(fd, vectors, size);
if(bufsCopied){
(*env)->ReleaseLongArrayElements(env, jbuffers, bufs, JNI_ABORT);
}
@@ -255,7 +255,7 @@
#if defined(AIX) || defined(ZOS)
{
struct sf_parms parms;
- parms.file_descriptor = (int)fd-FD_BIAS;
+ parms.file_descriptor = (int)fd;
parms.file_offset = (off64_t)offset;
parms.file_bytes = count;
parms.header_data = 0;
@@ -269,10 +269,12 @@
The conversion here is to guarantee no value lost when converting offset to off_t
*/
off_t off = offset;
-#if !defined(FREEBSD)
- return sendfile(socket,(int)fd-FD_BIAS,(off_t *)&off,(size_t)count);
-#else
+#if defined(FREEBSD)
return sendfile(fd-FD_BIAS, socket, off, (size_t)count, NULL, NULL, 0);
+#elif defined(MACOSX)
+ return sendfile((int)fd-FD_BIAS, (int)socket, off, (off_t *)&count, NULL, 0);
+#else
+ return sendfile(socket,(int)fd-FD_BIAS,(off_t *)&off,(size_t)count);
#endif
#endif
}
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c?rev=774983&r1=774982&r2=774983&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c Fri May 15 02:07:27 2009
@@ -101,7 +101,7 @@
jboolean result = 0;
IDATA m_addr = (IDATA)addr;
int page_size = getPageSize();
-#if defined(FREEBSD)
+#if defined(FREEBSD) || defined(MACOSX)
#define HY_VEC_T char
#else
#define HY_VEC_T unsigned char
@@ -143,7 +143,7 @@
JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSMemory_unmapImpl
(JNIEnv * env, jobject thiz, jlong addr, jlong size)
{
- munmap((void *)((IDATA)addr), (size_t)size);
+ munmap((void *)((IDATA)addr), (size_t)size);
}
/*
@@ -157,7 +157,7 @@
//PORT_ACCESS_FROM_ENV (env);
void *mapAddress = NULL;
int prot, flags;
-
+
// Convert from Java mapping mode to port library mapping mode.
switch (mmode)
{
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/helpers.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/helpers.c?rev=774983&r1=774982&r2=774983&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/helpers.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/helpers.c Fri May 15 02:07:27 2009
@@ -183,7 +183,7 @@
// tmStruct->tm_isdst is set to 1 if DST is in effect
strcpy(tzInfo, "GMT");
tzInfo[3] = timezone > 0 ? '-' : '+';
-#if defined (FREEBSD)
+#if defined (FREEBSD) || defined(MACOSX)
h = labs(tmStruct->tm_gmtoff) / 3600;
#else /* !FREEBSD */
h = labs(timezone) / 3600;
@@ -195,7 +195,7 @@
h++;
}
}
-#if defined (FREEBSD)
+#if defined (FREEBSD) || defined(MACOSX)
m = (labs(tmStruct->tm_isdst) % 3600) / 60;
#else /* !FREEBSD */
m = (labs(timezone) % 3600) / 60;
Added: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/macosx/OSResourcesMonitor.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/macosx/OSResourcesMonitor.c?rev=774983&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/macosx/OSResourcesMonitor.c (added)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/macosx/OSResourcesMonitor.c Fri May 15 02:07:27 2009
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Utilities to monitor system resources.
+ */
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <sys/vmmeter.h>
+
+#include <hyport.h>
+#include "OSResourcesMonitor.h"
+
+static unsigned int MEMORYLOADTHRESHOLD = 98; // 98% load
+
+/*
+ * Class: org_apache_harmony_luni_platform_OSResourcesMonitor
+ * Method: isSystemPhysicalMemoryLow
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_apache_harmony_luni_platform_OSResourcesMonitor_isSystemPhysicalMemoryLow
+ (JNIEnv *env, jclass thizClass)
+{
+ unsigned long free;
+ unsigned long total;
+ size_t len = sizeof(free);
+
+ if (sysctlbyname("vm.stats.vm.v_free_count", &free, &len, NULL, 0) == -1) {
+ return FALSE;
+ }
+ if (sysctlbyname("vm.stats.vm.v_page_count", &total, &len, NULL, 0) == -1) {
+ return FALSE;
+ }
+ int memoryLoad = 100 - ((float)(free/total)) * 100;
+ if(memoryLoad >= MEMORYLOADTHRESHOLD) {
+ return TRUE;
+ }
+ return FALSE;
+}
Re: svn commit: r774983 - in /harmony/enhanced/classlib/trunk/modules/luni/src/main/native:
fdlibm/unix/ launcher/unix/ luni/shared/ luni/unix/ luni/unix/macosx/
Posted by Oliver Deakin <ol...@googlemail.com>.
Ok, no problem - I've committed them back at r792449.
Regards,
Oliver
Nathan Beyer wrote:
> It's been a while, but probably oversight is the issue ... likely not
> paying close enough attention to the macros.
>
> On Wed, Jul 8, 2009 at 3:51 AM, Oliver
> Deakin<ol...@googlemail.com> wrote:
>
>> Hi Nathan,
>>
>> I notice in the commit you made below that you remove a couple of the
>> "-FD_BIAS" which are required for zOS, e.g.
>>
>> - totalWritten = writev(fd-FD_BIAS, vectors, size);
>> + totalWritten = writev(fd, vectors, size);
>>
>> Was there a particular reason to remove them or was it just an oversight?
>> Are you happy for me to reinstate them (the commit breaks these functions on
>> zOS)?
>>
>> Regards,
>> Oliver
>>
>> ndbeyer@apache.org wrote:
>>
>>> Author: ndbeyer
>>> Date: Fri May 15 02:07:27 2009
>>> New Revision: 774983
>>>
>>>
>>>
>> <snip>
>>
>>> Modified:
>>> harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c
>>> URL:
>>> http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c?rev=774983&r1=774982&r2=774983&view=diff
>>>
>>> ==============================================================================
>>> ---
>>> harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c
>>> (original)
>>> +++
>>> harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c
>>> Fri May 15 02:07:27 2009
>>> @@ -23,7 +23,7 @@
>>> #include <fcntl.h>
>>> #include <unistd.h>
>>> #include <errno.h>
>>> -#if defined(FREEBSD) || defined(AIX) || defined(ZOS)
>>> +#if defined(FREEBSD) || defined(AIX) || defined(ZOS) || defined(MACOSX)
>>> #include <sys/types.h>
>>> #include <sys/socket.h>
>>> #else
>>> @@ -42,7 +42,7 @@
>>> #define FD_BIAS 0
>>> #endif /* ZOS */
>>> -typedef int OSSOCKET; +typedef int OSSOCKET;
>>> typedef struct hysocket_struct
>>> {
>>> OSSOCKET sock;
>>> @@ -164,11 +164,11 @@
>>> jboolean bufsCopied = JNI_FALSE;
>>> jboolean offsetsCopied = JNI_FALSE;
>>> jboolean lengthsCopied = JNI_FALSE;
>>> - jlong *bufs; + jlong *bufs;
>>> jint *offsets;
>>> jint *lengths;
>>> int i = 0;
>>> - long totalRead = 0; + long totalRead = 0;
>>> struct iovec *vectors = (struct iovec *)hymem_allocate_memory(size *
>>> sizeof(struct iovec));
>>> if(vectors == NULL){
>>> return -1;
>>> @@ -181,7 +181,7 @@
>>> vectors[i].iov_len = lengths[i];
>>> i++;
>>> }
>>> - totalRead = readv(fd-FD_BIAS, vectors, size);
>>> + totalRead = readv(fd, vectors, size);
>>> if(bufsCopied){
>>> (*env)->ReleaseLongArrayElements(env, jbuffers, bufs, JNI_ABORT);
>>> }
>>> @@ -206,11 +206,11 @@
>>> jboolean bufsCopied = JNI_FALSE;
>>> jboolean offsetsCopied = JNI_FALSE;
>>> jboolean lengthsCopied = JNI_FALSE;
>>> - jlong *bufs; + jlong *bufs;
>>> jint *offsets;
>>> jint *lengths;
>>> int i = 0;
>>> - long totalWritten = 0; + long totalWritten = 0;
>>> struct iovec *vectors = (struct iovec *)hymem_allocate_memory(size *
>>> sizeof(struct iovec));
>>> if(vectors == NULL){
>>> return -1;
>>> @@ -223,7 +223,7 @@
>>> vectors[i].iov_len = lengths[i];
>>> i++;
>>> }
>>> - totalWritten = writev(fd-FD_BIAS, vectors, size);
>>> + totalWritten = writev(fd, vectors, size);
>>> if(bufsCopied){
>>> (*env)->ReleaseLongArrayElements(env, jbuffers, bufs, JNI_ABORT);
>>> }
>>> @@ -255,7 +255,7 @@
>>> #if defined(AIX) || defined(ZOS)
>>> {
>>> struct sf_parms parms;
>>> - parms.file_descriptor = (int)fd-FD_BIAS;
>>> + parms.file_descriptor = (int)fd;
>>> parms.file_offset = (off64_t)offset;
>>> parms.file_bytes = count;
>>> parms.header_data = 0;
>>> @@ -269,10 +269,12 @@
>>> The conversion here is to guarantee no value lost when converting
>>> offset to off_t
>>> */
>>> off_t off = offset;
>>> -#if !defined(FREEBSD)
>>> - return sendfile(socket,(int)fd-FD_BIAS,(off_t *)&off,(size_t)count);
>>> -#else
>>> +#if defined(FREEBSD)
>>> return sendfile(fd-FD_BIAS, socket, off, (size_t)count, NULL, NULL, 0);
>>> +#elif defined(MACOSX)
>>> + return sendfile((int)fd-FD_BIAS, (int)socket, off, (off_t *)&count,
>>> NULL, 0);
>>> +#else
>>> + return sendfile(socket,(int)fd-FD_BIAS,(off_t *)&off,(size_t)count);
>>> #endif
>>> #endif
>>> }
>>>
>>>
>> --
>> Oliver Deakin
>> Unless stated otherwise above:
>> IBM United Kingdom Limited - Registered in England and Wales with number
>> 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire
>> PO6 3AU
>>
>>
>>
>
>
--
Oliver Deakin
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
Re: svn commit: r774983 - in /harmony/enhanced/classlib/trunk/modules/luni/src/main/native:
fdlibm/unix/ launcher/unix/ luni/shared/ luni/unix/ luni/unix/macosx/
Posted by Nathan Beyer <nd...@apache.org>.
It's been a while, but probably oversight is the issue ... likely not
paying close enough attention to the macros.
On Wed, Jul 8, 2009 at 3:51 AM, Oliver
Deakin<ol...@googlemail.com> wrote:
> Hi Nathan,
>
> I notice in the commit you made below that you remove a couple of the
> "-FD_BIAS" which are required for zOS, e.g.
>
> - totalWritten = writev(fd-FD_BIAS, vectors, size);
> + totalWritten = writev(fd, vectors, size);
>
> Was there a particular reason to remove them or was it just an oversight?
> Are you happy for me to reinstate them (the commit breaks these functions on
> zOS)?
>
> Regards,
> Oliver
>
> ndbeyer@apache.org wrote:
>>
>> Author: ndbeyer
>> Date: Fri May 15 02:07:27 2009
>> New Revision: 774983
>>
>>
>
> <snip>
>>
>> Modified:
>> harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c
>> URL:
>> http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c?rev=774983&r1=774982&r2=774983&view=diff
>>
>> ==============================================================================
>> ---
>> harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c
>> (original)
>> +++
>> harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c
>> Fri May 15 02:07:27 2009
>> @@ -23,7 +23,7 @@
>> #include <fcntl.h>
>> #include <unistd.h>
>> #include <errno.h>
>> -#if defined(FREEBSD) || defined(AIX) || defined(ZOS)
>> +#if defined(FREEBSD) || defined(AIX) || defined(ZOS) || defined(MACOSX)
>> #include <sys/types.h>
>> #include <sys/socket.h>
>> #else
>> @@ -42,7 +42,7 @@
>> #define FD_BIAS 0
>> #endif /* ZOS */
>> -typedef int OSSOCKET; +typedef int OSSOCKET;
>> typedef struct hysocket_struct
>> {
>> OSSOCKET sock;
>> @@ -164,11 +164,11 @@
>> jboolean bufsCopied = JNI_FALSE;
>> jboolean offsetsCopied = JNI_FALSE;
>> jboolean lengthsCopied = JNI_FALSE;
>> - jlong *bufs; + jlong *bufs;
>> jint *offsets;
>> jint *lengths;
>> int i = 0;
>> - long totalRead = 0; + long totalRead = 0;
>> struct iovec *vectors = (struct iovec *)hymem_allocate_memory(size *
>> sizeof(struct iovec));
>> if(vectors == NULL){
>> return -1;
>> @@ -181,7 +181,7 @@
>> vectors[i].iov_len = lengths[i];
>> i++;
>> }
>> - totalRead = readv(fd-FD_BIAS, vectors, size);
>> + totalRead = readv(fd, vectors, size);
>> if(bufsCopied){
>> (*env)->ReleaseLongArrayElements(env, jbuffers, bufs, JNI_ABORT);
>> }
>> @@ -206,11 +206,11 @@
>> jboolean bufsCopied = JNI_FALSE;
>> jboolean offsetsCopied = JNI_FALSE;
>> jboolean lengthsCopied = JNI_FALSE;
>> - jlong *bufs; + jlong *bufs;
>> jint *offsets;
>> jint *lengths;
>> int i = 0;
>> - long totalWritten = 0; + long totalWritten = 0;
>> struct iovec *vectors = (struct iovec *)hymem_allocate_memory(size *
>> sizeof(struct iovec));
>> if(vectors == NULL){
>> return -1;
>> @@ -223,7 +223,7 @@
>> vectors[i].iov_len = lengths[i];
>> i++;
>> }
>> - totalWritten = writev(fd-FD_BIAS, vectors, size);
>> + totalWritten = writev(fd, vectors, size);
>> if(bufsCopied){
>> (*env)->ReleaseLongArrayElements(env, jbuffers, bufs, JNI_ABORT);
>> }
>> @@ -255,7 +255,7 @@
>> #if defined(AIX) || defined(ZOS)
>> {
>> struct sf_parms parms;
>> - parms.file_descriptor = (int)fd-FD_BIAS;
>> + parms.file_descriptor = (int)fd;
>> parms.file_offset = (off64_t)offset;
>> parms.file_bytes = count;
>> parms.header_data = 0;
>> @@ -269,10 +269,12 @@
>> The conversion here is to guarantee no value lost when converting
>> offset to off_t
>> */
>> off_t off = offset;
>> -#if !defined(FREEBSD)
>> - return sendfile(socket,(int)fd-FD_BIAS,(off_t *)&off,(size_t)count);
>> -#else
>> +#if defined(FREEBSD)
>> return sendfile(fd-FD_BIAS, socket, off, (size_t)count, NULL, NULL, 0);
>> +#elif defined(MACOSX)
>> + return sendfile((int)fd-FD_BIAS, (int)socket, off, (off_t *)&count,
>> NULL, 0);
>> +#else
>> + return sendfile(socket,(int)fd-FD_BIAS,(off_t *)&off,(size_t)count);
>> #endif
>> #endif
>> }
>>
>
> --
> Oliver Deakin
> Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with number
> 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire
> PO6 3AU
>
>
Re: svn commit: r774983 - in /harmony/enhanced/classlib/trunk/modules/luni/src/main/native:
fdlibm/unix/ launcher/unix/ luni/shared/ luni/unix/ luni/unix/macosx/
Posted by Oliver Deakin <ol...@googlemail.com>.
Hi Nathan,
I notice in the commit you made below that you remove a couple of the
"-FD_BIAS" which are required for zOS, e.g.
- totalWritten = writev(fd-FD_BIAS, vectors, size);
+ totalWritten = writev(fd, vectors, size);
Was there a particular reason to remove them or was it just an
oversight? Are you happy for me to reinstate them (the commit breaks
these functions on zOS)?
Regards,
Oliver
ndbeyer@apache.org wrote:
> Author: ndbeyer
> Date: Fri May 15 02:07:27 2009
> New Revision: 774983
>
>
<snip>
> Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c
> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c?rev=774983&r1=774982&r2=774983&view=diff
> ==============================================================================
> --- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c (original)
> +++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c Fri May 15 02:07:27 2009
> @@ -23,7 +23,7 @@
> #include <fcntl.h>
> #include <unistd.h>
> #include <errno.h>
> -#if defined(FREEBSD) || defined(AIX) || defined(ZOS)
> +#if defined(FREEBSD) || defined(AIX) || defined(ZOS) || defined(MACOSX)
> #include <sys/types.h>
> #include <sys/socket.h>
> #else
> @@ -42,7 +42,7 @@
> #define FD_BIAS 0
> #endif /* ZOS */
>
> -typedef int OSSOCKET;
> +typedef int OSSOCKET;
> typedef struct hysocket_struct
> {
> OSSOCKET sock;
> @@ -164,11 +164,11 @@
> jboolean bufsCopied = JNI_FALSE;
> jboolean offsetsCopied = JNI_FALSE;
> jboolean lengthsCopied = JNI_FALSE;
> - jlong *bufs;
> + jlong *bufs;
> jint *offsets;
> jint *lengths;
> int i = 0;
> - long totalRead = 0;
> + long totalRead = 0;
> struct iovec *vectors = (struct iovec *)hymem_allocate_memory(size * sizeof(struct iovec));
> if(vectors == NULL){
> return -1;
> @@ -181,7 +181,7 @@
> vectors[i].iov_len = lengths[i];
> i++;
> }
> - totalRead = readv(fd-FD_BIAS, vectors, size);
> + totalRead = readv(fd, vectors, size);
> if(bufsCopied){
> (*env)->ReleaseLongArrayElements(env, jbuffers, bufs, JNI_ABORT);
> }
> @@ -206,11 +206,11 @@
> jboolean bufsCopied = JNI_FALSE;
> jboolean offsetsCopied = JNI_FALSE;
> jboolean lengthsCopied = JNI_FALSE;
> - jlong *bufs;
> + jlong *bufs;
> jint *offsets;
> jint *lengths;
> int i = 0;
> - long totalWritten = 0;
> + long totalWritten = 0;
> struct iovec *vectors = (struct iovec *)hymem_allocate_memory(size * sizeof(struct iovec));
> if(vectors == NULL){
> return -1;
> @@ -223,7 +223,7 @@
> vectors[i].iov_len = lengths[i];
> i++;
> }
> - totalWritten = writev(fd-FD_BIAS, vectors, size);
> + totalWritten = writev(fd, vectors, size);
> if(bufsCopied){
> (*env)->ReleaseLongArrayElements(env, jbuffers, bufs, JNI_ABORT);
> }
> @@ -255,7 +255,7 @@
> #if defined(AIX) || defined(ZOS)
> {
> struct sf_parms parms;
> - parms.file_descriptor = (int)fd-FD_BIAS;
> + parms.file_descriptor = (int)fd;
> parms.file_offset = (off64_t)offset;
> parms.file_bytes = count;
> parms.header_data = 0;
> @@ -269,10 +269,12 @@
> The conversion here is to guarantee no value lost when converting offset to off_t
> */
> off_t off = offset;
> -#if !defined(FREEBSD)
> - return sendfile(socket,(int)fd-FD_BIAS,(off_t *)&off,(size_t)count);
> -#else
> +#if defined(FREEBSD)
> return sendfile(fd-FD_BIAS, socket, off, (size_t)count, NULL, NULL, 0);
> +#elif defined(MACOSX)
> + return sendfile((int)fd-FD_BIAS, (int)socket, off, (off_t *)&count, NULL, 0);
> +#else
> + return sendfile(socket,(int)fd-FD_BIAS,(off_t *)&off,(size_t)count);
> #endif
> #endif
> }
>
--
Oliver Deakin
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU