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

[Xen-devel] [PATCH 4/7] [xen-ocaml-tools.hg] remove dependencies on libp

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 4/7] [xen-ocaml-tools.hg] remove dependencies on libpthread
From: Alex Zeffertt <alex.zeffertt@xxxxxxxxxxxxx>
Date: Fri, 17 Apr 2009 16:44:24 +0100
Delivery-date: Fri, 17 Apr 2009 08:47:42 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.19 (X11/20090105)

Remove a module called Condition and a function called statfs that are unused.

These make xenstored dependent on libpthread and some libc functions that are 
not present in newlib, and therefore make it harder to port to mini-OS.

Signed-off-by: Alex Zeffertt <alex.zeffertt@xxxxxxxxxxxxx>

diff -r 82237d48cc2f libs/stdext/threadext.ml
--- a/libs/stdext/threadext.ml  Thu Mar 26 16:08:10 2009 +0000
+++ b/libs/stdext/threadext.ml  Thu Mar 26 16:12:51 2009 +0000
@@ -23,11 +23,6 @@
        let r = begin try f () with exn -> Mutex.unlock lock; raise exn end; in
        Mutex.unlock lock;
        r
-end
-
-module Condition = struct
-    include Condition
-    external timedwait : Condition.t -> Mutex.t -> float -> bool = 
"caml_condition_timedwait"
 end
 
 (** create thread loops which periodically applies a function *)
diff -r 82237d48cc2f libs/stdext/threadext.mli
--- a/libs/stdext/threadext.mli Thu Mar 26 16:08:10 2009 +0000
+++ b/libs/stdext/threadext.mli Thu Mar 26 16:12:51 2009 +0000
@@ -24,16 +24,6 @@
     val execute : Mutex.t -> (unit -> 'a) -> 'a
   end
 
-module Condition :
-  sig
-    type t = Condition.t
-    val create : unit -> t
-    val signal : t -> unit
-    val broadcast: t -> unit
-    val wait : t -> Mutex.t -> unit
-    val timedwait : t -> Mutex.t -> float -> bool
-  end
-
 module Thread_loop :
   functor (Tr : sig type t val delay : unit -> float end) ->
     sig
diff -r 82237d48cc2f libs/stdext/unixext.ml
--- a/libs/stdext/unixext.ml    Thu Mar 26 16:08:10 2009 +0000
+++ b/libs/stdext/unixext.ml    Thu Mar 26 16:12:51 2009 +0000
@@ -406,19 +406,6 @@
     | x :: rest, n -> remove_dots (n - 1) rest (* munch *) in
   to_string (remove_dots 0 (of_string path))
 
-type statfs_t = {
-       statfs_type: int64;
-       statfs_bsize: int;
-       statfs_blocks: int64;
-       statfs_bfree: int64;
-       statfs_bavail: int64;
-       statfs_files: int64;
-       statfs_ffree: int64;
-       statfs_namelen: int;
-}
-
-external statfs: string -> statfs_t = "stub_unixext_statfs"
-
 external get_major_minor : string -> int * int = "stub_unixext_get_major_minor"
 
 module Fdset = struct
diff -r 82237d48cc2f libs/stdext/unixext.mli
--- a/libs/stdext/unixext.mli   Thu Mar 26 16:08:10 2009 +0000
+++ b/libs/stdext/unixext.mli   Thu Mar 26 16:12:51 2009 +0000
@@ -57,18 +57,6 @@
 val get_process_output : ?handler:(string -> int -> string) -> string -> string
 val resolve_dot_and_dotdot : string -> string
 
-type statfs_t = {
-       statfs_type: int64;
-       statfs_bsize: int;
-       statfs_blocks: int64;
-       statfs_bfree: int64;
-       statfs_bavail: int64;
-       statfs_files: int64;
-       statfs_ffree: int64;
-       statfs_namelen: int;
-}
-
-val statfs: string -> statfs_t
 val get_major_minor : string -> int * int 
 
 module Fdset : sig
diff -r 82237d48cc2f libs/stdext/unixext_stubs.c
--- a/libs/stdext/unixext_stubs.c       Thu Mar 26 16:08:10 2009 +0000
+++ b/libs/stdext/unixext_stubs.c       Thu Mar 26 16:12:51 2009 +0000
@@ -7,7 +7,6 @@
 #include <string.h>
 #include <unistd.h> /* needed for _SC_OPEN_MAX */
 #include <stdio.h> /* snprintf */
-#include <pthread.h> /* needed for caml_condition_timedwait */
 
 #include <caml/mlvalues.h>
 #include <caml/memory.h>
@@ -54,30 +53,6 @@
        long maxfd;
        maxfd = sysconf(_SC_OPEN_MAX);
        CAMLreturn(Val_int(maxfd));
-}
-
-#include <sys/vfs.h>
-
-CAMLprim value stub_unixext_statfs(value path)
-{
-       CAMLparam1(path);
-       CAMLlocal1(statinfo);
-       struct statfs info;
-
-       if (statfs(String_val(path), &info))
-               failwith_errno();
-
-       statinfo = caml_alloc_tuple(8);
-       Store_field(statinfo, 0, caml_copy_int64(info.f_type));
-       Store_field(statinfo, 1, Val_int(info.f_bsize));
-       Store_field(statinfo, 2, caml_copy_int64(info.f_blocks));
-       Store_field(statinfo, 3, caml_copy_int64(info.f_bfree));
-       Store_field(statinfo, 4, caml_copy_int64(info.f_bavail));
-       Store_field(statinfo, 5, caml_copy_int64(info.f_files));
-       Store_field(statinfo, 6, caml_copy_int64(info.f_ffree));
-       Store_field(statinfo, 7, Val_int(info.f_namelen));
-
-       CAMLreturn(statinfo);
 }
 
 #define FDSET_OF_VALUE(v) (&(((struct fdset_t *) v)->fds))
@@ -242,43 +217,3 @@
        CAMLreturn(majmin);
 }
 
-// from otherlibs/systhreads/posix.c
-#define Condition_val(v) (* ((pthread_cond_t **) Data_custom_val(v)))
-#define Mutex_val(v) (* ((pthread_mutex_t **) Data_custom_val(v)))
-
-static void caml_pthread_check(int retcode, char *msg)
-{
-  char * err;
-  int errlen, msglen;
-  value str;
-
-  if (retcode == 0) return;
-  err = strerror(retcode);
-  msglen = strlen(msg);
-  errlen = strlen(err);
-  str = alloc_string(msglen + 2 + errlen);
-  memmove (&Byte(str, 0), msg, msglen);
-  memmove (&Byte(str, msglen), ": ", 2);
-  memmove (&Byte(str, msglen + 2), err, errlen);
-  raise_sys_error(str);
-}
-
-// from http://caml.inria.fr/mantis/view.php?id=4104
-CAMLprim value caml_condition_timedwait(value v_cnd, value v_mtx, value 
v_timeo)
-{
-       CAMLparam2(v_cnd, v_mtx);
-       int ret;
-       pthread_cond_t *cnd = Condition_val(v_cnd);
-       pthread_mutex_t *mtx = Mutex_val(v_mtx);
-       double timeo = Double_val(v_timeo);
-       struct timespec ts;
-       ts.tv_sec = timeo;
-       ts.tv_nsec = (timeo - ts.tv_sec) * 1e9;
-       enter_blocking_section();
-       ret = pthread_cond_timedwait(cnd, mtx, &ts);
-       leave_blocking_section();
-       if (ret == ETIMEDOUT) CAMLreturn(Val_false);
-       caml_pthread_check(ret, "Condition.timedwait");
-       CAMLreturn(Val_true);
-}
-

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 4/7] [xen-ocaml-tools.hg] remove dependencies on libpthread, Alex Zeffertt <=