You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Oliver Deakin <ol...@googlemail.com> on 2009/07/08 10:51:40 UTC

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/

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>.
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
>
>