WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] Re: [PATCH] CA-38567: Fail Unixext calls with a proper Unix_er

To: Dave Scott <Dave.Scott@xxxxxxxxxxxxx>
Subject: [Xen-API] Re: [PATCH] CA-38567: Fail Unixext calls with a proper Unix_error
From: Daniel Stodden <daniel.stodden@xxxxxxxxxx>
Date: Mon, 8 Mar 2010 11:20:56 -0800
Cc: Xen API <xen-api@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 08 Mar 2010 11:20:59 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <ac6d6a74fd33f1a3fb02.1267831367@xxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
References: <ac6d6a74fd33f1a3fb02.1267831367@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
Hi Dave.

Thanks for accepting these patches. Is the one below still in your
queue? Looks like it got dropped. Without it, the ones discussed won't
be able to translate to said Api_error.

Cheers,
Daniel

On Fri, 2010-03-05 at 18:22 -0500, Daniel Stodden wrote:
> # HG changeset patch
> # User Daniel Stodden <daniel.stodden@xxxxxxxxxx>
> # Date 1267831355 28800
> # Node ID ac6d6a74fd33f1a3fb02cc9f3bea4f58ac9713de
> # Parent  45b22c29867df47adc2dc21a008c6f6730e6e4fc
> CA-38567: Fail Unixext calls with a proper Unix_error.
> 
> diff -r 45b22c29867d -r ac6d6a74fd33 stdext/unixext_stubs.c
> --- a/stdext/unixext_stubs.c  Wed Feb 17 10:14:40 2010 +0000
> +++ b/stdext/unixext_stubs.c  Fri Mar 05 15:22:35 2010 -0800
> @@ -30,16 +30,7 @@
>  #include <caml/custom.h>
>  #include <caml/fail.h>
>  #include <caml/callback.h>
> -
> -static void failwith_errno(void)
> -{
> -        char buf[256];
> -     char buf2[280];
> -     memset(buf, '\0', sizeof(buf));
> -     strerror_r(errno, buf, sizeof(buf));
> -     snprintf(buf2, sizeof(buf2), "errno: %d msg: %s", errno, buf);
> -     caml_failwith(buf2);
> -}
> +#include <caml/unixsupport.h>
>  
>  /* Set the TCP_NODELAY flag on a Unix.file_descr */
>  CAMLprim value stub_unixext_set_tcp_nodelay (value fd, value bool)
> @@ -48,7 +39,7 @@
>       int c_fd = Int_val(fd);
>       int opt = (Bool_val(bool)) ? 1 : 0;
>       if (setsockopt(c_fd, IPPROTO_TCP, TCP_NODELAY, (void *)&opt, 
> sizeof(opt)) != 0){
> -             failwith_errno();
> +             uerror("setsockopt", Nothing);
>       }
>       CAMLreturn(Val_unit);
>  }
> @@ -57,7 +48,7 @@
>  {
>       CAMLparam1(fd);
>       int c_fd = Int_val(fd);
> -     if (fsync(c_fd) != 0) failwith_errno();
> +     if (fsync(c_fd) != 0) uerror("fsync", Nothing);
>       CAMLreturn(Val_unit);
>  }
>       
> @@ -67,7 +58,7 @@
>    uint64_t size;
>    int c_fd = Int_val(fd);
>    if(ioctl(c_fd,BLKGETSIZE64,&size)) {
> -    failwith_errno();
> +    uerror("ioctl(BLKGETSIZE64)", Nothing);
>    }
>    CAMLreturn(caml_copy_int64(size));
>  }



_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api