[Pkg-ocaml-maint-commits] [SCM] syslog-ocaml packaging branch, master, updated. debian/1.4-5-9-g8f65aba

Eric Cooper ecc at cmu.edu
Fri Feb 25 13:44:19 UTC 2011


The following commit has been merged in the master branch:
commit b6af8b551b8d60afdacce239f44319e00ad23d02
Author: Eric Cooper <ecc at cmu.edu>
Date:   Thu Feb 24 22:29:33 2011 -0500

    undo all changes to upstream source

diff --git a/Makefile b/Makefile
index 8e041e4..61245a8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
-OCAMLMAKEFILE=/usr/share/ocamlmakefile/OCamlMakefile
+-include Makefile.conf
 
-SOURCES=aux.mli aux.ml aux_stubs.c syslog.mli syslog.ml
+SOURCES=syslog.mli syslog.ml
 RESULT=syslog
 PACKS=unix
 
@@ -13,4 +13,4 @@ install: libinstall
 uninstall: libuninstall
 doc: htdoc
 
-include $(OCAMLMAKEFILE)
+-include OCamlMakefile
diff --git a/aux.ml b/aux.ml
deleted file mode 100644
index 6aa8b95..0000000
--- a/aux.ml
+++ /dev/null
@@ -1,10 +0,0 @@
-type msg_flag = MSG_OOB | MSG_DONTROUTE | MSG_PEEK | MSG_NOSIGNAL
-
-external unsafe_send :
-  Unix.file_descr -> string -> int -> int -> msg_flag list -> int
-                                  = "aux_send"
-
-let send fd buf ofs len flags =
-  if ofs < 0 || len < 0 || ofs > String.length buf - len
-  then invalid_arg "Unix.send"
-  else unsafe_send fd buf ofs len flags
diff --git a/aux.mli b/aux.mli
deleted file mode 100644
index d36bcbf..0000000
--- a/aux.mli
+++ /dev/null
@@ -1,3 +0,0 @@
-type msg_flag = MSG_OOB | MSG_DONTROUTE | MSG_PEEK | MSG_NOSIGNAL
-
-val send : Unix.file_descr -> string -> int -> int -> msg_flag list -> int
diff --git a/aux_stubs.c b/aux_stubs.c
deleted file mode 100644
index 118ce22..0000000
--- a/aux_stubs.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <string.h>
-#include <sys/socket.h>
-#include <caml/mlvalues.h>
-#include <caml/alloc.h>
-#include <caml/signals.h>
-
-// These are from .../otherlibs/unix/unixsupport.h
-#define UNIX_BUFFER_SIZE 16384
-extern void uerror (char * cmdname, value arg) Noreturn;
-
-static int msg_flag_table[] = {
-  MSG_OOB, MSG_DONTROUTE, MSG_PEEK, MSG_NOSIGNAL
-};
-
-CAMLprim value aux_send(value sock, value buff, value ofs, value len,
-                        value flags)
-{
-  int ret, cv_flags;
-  long numbytes;
-  char iobuf[UNIX_BUFFER_SIZE];
-
-  cv_flags = convert_flag_list(flags, msg_flag_table);
-  numbytes = Long_val(len);
-  if (numbytes > UNIX_BUFFER_SIZE) numbytes = UNIX_BUFFER_SIZE;
-  memmove(iobuf, &Byte(buff, Long_val(ofs)), numbytes);
-  enter_blocking_section();
-  ret = send(Int_val(sock), iobuf, (int) numbytes, cv_flags);
-  leave_blocking_section();
-  if (ret == -1) uerror("send", (value) 0);
-  return Val_int(ret);
-}
diff --git a/syslog.ml b/syslog.ml
index 80e179c..c6c66f4 100644
--- a/syslog.ml
+++ b/syslog.ml
@@ -191,11 +191,14 @@ let protected_write loginfo str =
     (try open_connection loginfo with _ -> ());
     if List.mem `LOG_CONS loginfo.flags then log_console str
   in
+  let prev = Sys.signal Sys.sigpipe (Sys.Signal_handle fallback) in
   try
-    ignore (Aux.send loginfo.fd str 0 (String.length str) [Aux.MSG_NOSIGNAL])
+    ignore (write loginfo.fd str 0 (String.length str));
+    Sys.set_signal Sys.sigpipe prev
   with Unix_error (_, _, _) ->
     (* on error, attempt to reconnect *)
-    fallback ()
+    fallback ();
+    Sys.set_signal Sys.sigpipe prev
 
 let syslog ?fac loginfo lev str =
   let msg = Buffer.create 64 in

-- 
syslog-ocaml packaging



More information about the Pkg-ocaml-maint-commits mailing list