classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] native/jni/java-nio/gnu_java_nio_VMSelector.c strerror


From: Robert Schuster
Subject: Re: [cp-patches] native/jni/java-nio/gnu_java_nio_VMSelector.c strerror ifdef's
Date: Fri, 13 May 2005 21:03:29 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.7.7) Gecko/20050427

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

Christian Thalinger wrote:
> Check which strerror we have or even if we have any.
> 
> Index: native/jni/java-nio/gnu_java_nio_VMSelector.c
> ===================================================================
> RCS
> file: 
> /ahome/cacao/cacaocvs/cacao/src/classpath/native/jni/java-nio/gnu_java_nio_VMSelector.c,v
> retrieving revision 1.3
> diff -u -3 -p -r1.3 gnu_java_nio_VMSelector.c
> --- native/jni/java-nio/gnu_java_nio_VMSelector.c       4 May 2005
> 10:09:47 -0000       1.3
> +++ native/jni/java-nio/gnu_java_nio_VMSelector.c       13 May 2005
> 12:11:38 -0000
> @@ -219,7 +219,6 @@ Java_gnu_java_nio_VMSelector_select (JNI
>    fd_set except_fds;
>    struct timeval real_time_data;
>    struct timeval *time_data = NULL;
> -  char message_buf[BUF_SIZE + 1];
>  
>    /* If a legal timeout value isn't given, use NULL.
>     * This means an infinite timeout. The specification
> @@ -270,9 +269,12 @@ Java_gnu_java_nio_VMSelector_select (JNI
>  
>    if (result < 0)
>      {
> -
> +#if defined(HAVE_STRERROR_R) || defined(HAVE_STRERROR)
>        int errorcode = -result;
>  
> +#if defined(HAVE_STRERROR_R)
> +      char message_buf[BUF_SIZE + 1];
> +
>        if (strerror_r (errorcode, message_buf, BUF_SIZE))
>         {
>           /* This would mean that message_buf was to small
> @@ -284,6 +286,12 @@ Java_gnu_java_nio_VMSelector_select (JNI
>         }
>  
>        JCL_ThrowException (env, "java/io/IOException", message_buf);
> +#else
> +      JCL_ThrowException (env, "java/io/IOException", strerror
> (errorcode));
> +#endif
> +#else /* defined(HAVE_STRERROR_R) || defined(HAVE_STRERROR) */
> +      JCL_ThrowException (env, "java/io/IOException", "no strerror
> available");
> +#endif
If no strerror is available I would propose throwing the io exception
with a generic error message  that has something to do with the initial
problem ("IO error at OS level" or something like that).

For the case that only strerror() is available (which is not
thread-safe) a warning would be nice. What do the others think?

cu
robert
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFChPoBG9cfwmwwEtoRAo75AJ9vZFDnZzMzpK4HTo+DCQ1/hLtxDgCfdP2I
l2MMjRDuFZ+ljFeUwzQ1c5M=
=J96w
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]