[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:24 UTC 2011


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

    use debian/patches for all changes to upstream source

diff --git a/debian/patches/0001-use-ocamlmakefile-package.patch b/debian/patches/0001-use-ocamlmakefile-package.patch
new file mode 100644
index 0000000..643d36b
--- /dev/null
+++ b/debian/patches/0001-use-ocamlmakefile-package.patch
@@ -0,0 +1,27 @@
+From: Eric Cooper <ecc at cmu.edu>
+Date: Tue, 3 Mar 2009 16:28:31 -0500
+Subject: use ocamlmakefile package
+
+
+Signed-off-by: Eric Cooper <ecc at cmu.edu>
+---
+ Makefile |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 61245a8..948bed5 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,4 +1,4 @@
+--include Makefile.conf
++OCAMLMAKEFILE = /usr/share/ocamlmakefile/OCamlMakefile
+ 
+ SOURCES=syslog.mli syslog.ml
+ RESULT=syslog
+@@ -13,4 +13,4 @@ install: libinstall
+ uninstall: libuninstall
+ doc: htdoc
+ 
+--include OCamlMakefile
++include $(OCAMLMAKEFILE)
+-- 
diff --git a/debian/patches/0002-add-wrapper-for-send-with-flags.patch b/debian/patches/0002-add-wrapper-for-send-with-flags.patch
new file mode 100644
index 0000000..ff81cc3
--- /dev/null
+++ b/debian/patches/0002-add-wrapper-for-send-with-flags.patch
@@ -0,0 +1,92 @@
+From: Eric Cooper <ecc at cmu.edu>
+Date: Thu, 24 Feb 2011 22:41:33 -0500
+Subject: add wrapper for send with flags
+
+allow send(2) to be called with flags such as MSG_NOSIGNAL
+
+Signed-off-by: Eric Cooper <ecc at cmu.edu>
+---
+ Makefile    |    2 +-
+ aux.ml      |   10 ++++++++++
+ aux.mli     |    3 +++
+ aux_stubs.c |   31 +++++++++++++++++++++++++++++++
+ 4 files changed, 45 insertions(+), 1 deletions(-)
+ create mode 100644 aux.ml
+ create mode 100644 aux.mli
+ create mode 100644 aux_stubs.c
+
+diff --git a/Makefile b/Makefile
+index 948bed5..1facb86 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,6 @@
+ OCAMLMAKEFILE = /usr/share/ocamlmakefile/OCamlMakefile
+ 
+-SOURCES=syslog.mli syslog.ml
++SOURCES=aux.mli aux.ml aux_stubs.c syslog.mli syslog.ml
+ RESULT=syslog
+ PACKS=unix
+ 
+diff --git a/aux.ml b/aux.ml
+new file mode 100644
+index 0000000..6aa8b95
+--- /dev/null
++++ b/aux.ml
+@@ -0,0 +1,10 @@
++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
+new file mode 100644
+index 0000000..d36bcbf
+--- /dev/null
++++ b/aux.mli
+@@ -0,0 +1,3 @@
++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
+new file mode 100644
+index 0000000..118ce22
+--- /dev/null
++++ b/aux_stubs.c
+@@ -0,0 +1,31 @@
++#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/debian/patches/0003-call-send-with-MSG_NOSIGNAL-to-avoid-SIGPIPE.patch b/debian/patches/0003-call-send-with-MSG_NOSIGNAL-to-avoid-SIGPIPE.patch
new file mode 100644
index 0000000..180f9b8
--- /dev/null
+++ b/debian/patches/0003-call-send-with-MSG_NOSIGNAL-to-avoid-SIGPIPE.patch
@@ -0,0 +1,32 @@
+From: Eric Cooper <ecc at cmu.edu>
+Date: Thu, 24 Feb 2011 22:43:13 -0500
+Subject: call send with MSG_NOSIGNAL to avoid SIGPIPE
+
+
+Signed-off-by: Eric Cooper <ecc at cmu.edu>
+---
+ syslog.ml |    7 ++-----
+ 1 files changed, 2 insertions(+), 5 deletions(-)
+
+diff --git a/syslog.ml b/syslog.ml
+index c6c66f4..80e179c 100644
+--- a/syslog.ml
++++ b/syslog.ml
+@@ -191,14 +191,11 @@ 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 (write loginfo.fd str 0 (String.length str));
+-    Sys.set_signal Sys.sigpipe prev
++    ignore (Aux.send loginfo.fd str 0 (String.length str) [Aux.MSG_NOSIGNAL])
+   with Unix_error (_, _, _) ->
+     (* on error, attempt to reconnect *)
+-    fallback ();
+-    Sys.set_signal Sys.sigpipe prev
++    fallback ()
+ 
+ let syslog ?fac loginfo lev str =
+   let msg = Buffer.create 64 in
+-- 
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..d9196d3
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,3 @@
+0001-use-ocamlmakefile-package.patch
+0002-add-wrapper-for-send-with-flags.patch
+0003-call-send-with-MSG_NOSIGNAL-to-avoid-SIGPIPE.patch

-- 
syslog-ocaml packaging



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