[Pkg-ocaml-maint-commits] r3815 - in /trunk/packages/syslog-ocaml/trunk/debian: changelog patches/00list patches/aux.dpatch

ecc-guest at users.alioth.debian.org ecc-guest at users.alioth.debian.org
Sat Jun 9 19:28:17 UTC 2007


Author: ecc-guest
Date: Sat Jun  9 19:28:17 2007
New Revision: 3815

URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/?sc=1&rev=3815
Log:
use send(2) with MSG_NOSIGNAL flag instead of write(2),
to avoid a SIGPIPE signal when syslog-ng closes its connection

Added:
    trunk/packages/syslog-ocaml/trunk/debian/patches/aux.dpatch   (with props)
Modified:
    trunk/packages/syslog-ocaml/trunk/debian/changelog
    trunk/packages/syslog-ocaml/trunk/debian/patches/00list

Modified: trunk/packages/syslog-ocaml/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/packages/syslog-ocaml/trunk/debian/changelog?rev=3815&op=diff
==============================================================================
--- trunk/packages/syslog-ocaml/trunk/debian/changelog (original)
+++ trunk/packages/syslog-ocaml/trunk/debian/changelog Sat Jun  9 19:28:17 2007
@@ -1,3 +1,11 @@
+syslog-ocaml (1.3-4) unstable; urgency=low
+
+  * Use send(2) with MSG_NOSIGNAL flag instead of write(2),
+    to avoid a SIGPIPE signal when syslog-ng closes its connection
+    (closes: #395469)
+
+ -- Eric Cooper <ecc at cmu.edu>  Sat, 09 Jun 2007 15:26:38 -0400
+
 syslog-ocaml (1.3-3) unstable; urgency=low
 
   * Changed dependency on ocaml-tools to ocamlmakefile.

Modified: trunk/packages/syslog-ocaml/trunk/debian/patches/00list
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/packages/syslog-ocaml/trunk/debian/patches/00list?rev=3815&op=diff
==============================================================================
--- trunk/packages/syslog-ocaml/trunk/debian/patches/00list (original)
+++ trunk/packages/syslog-ocaml/trunk/debian/patches/00list Sat Jun  9 19:28:17 2007
@@ -1,2 +1,3 @@
 Makefile.dpatch
 META.dpatch
+aux.dpatch

Added: trunk/packages/syslog-ocaml/trunk/debian/patches/aux.dpatch
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/packages/syslog-ocaml/trunk/debian/patches/aux.dpatch?rev=3815&op=file
==============================================================================
--- trunk/packages/syslog-ocaml/trunk/debian/patches/aux.dpatch (added)
+++ trunk/packages/syslog-ocaml/trunk/debian/patches/aux.dpatch Sat Jun  9 19:28:17 2007
@@ -1,0 +1,82 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## aux.dpatch by Eric Cooper <ecc at cmu.edu>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: patch to add wrapper for send(2) with MSG_NOSIGNAL option
+
+ at DPATCH@
+diff -Naur syslog-ocaml-1.3/syslog.ml syslog-ocaml-1.3-new/syslog.ml
+--- syslog-ocaml-1.3/syslog.ml	2007-06-08 16:02:22.000000000 -0400
++++ syslog-ocaml-1.3-new/syslog.ml	2007-06-08 16:05:40.000000000 -0400
+@@ -209,7 +209,7 @@
+ 	  String.blit "<truncated>" 0 !realmsg 1012 11
+ 	end;
+ 	begin try
+-	  ignore (Unix.write loginfo.fd !realmsg 0 (String.length !realmsg))
++	  ignore (Aux.send loginfo.fd !realmsg 0 (String.length !realmsg) [Aux.MSG_NOSIGNAL])
+ 	with 
+ 	  | Unix.Unix_error(_,_,_) -> (* on error, attempt to reconnect *)
+ 	      (try close loginfo.fd
+diff -Naur syslog-ocaml-1.3/aux.ml syslog-ocaml-1.3-new/aux.ml
+--- syslog-ocaml-1.3/aux.ml	1969-12-31 19:00:00.000000000 -0500
++++ syslog-ocaml-1.3-new/aux.ml	2007-06-08 16:05:40.000000000 -0400
+@@ -0,0 +1,14 @@
++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 -Naur syslog-ocaml-1.3/aux_stubs.c syslog-ocaml-1.3-new/aux_stubs.c
+--- syslog-ocaml-1.3/aux_stubs.c	1969-12-31 19:00:00.000000000 -0500
++++ syslog-ocaml-1.3-new/aux_stubs.c	2007-06-08 16:05:40.000000000 -0400
+@@ -0,0 +1,30 @@
++#include <string.h>
++#include <sys/socket.h>
++#include <caml/mlvalues.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 -Naur syslog-ocaml-1.3/Makefile syslog-ocaml-1.3-new/Makefile
+--- syslog-ocaml-1.3/Makefile	2007-06-08 16:02:22.000000000 -0400
++++ syslog-ocaml-1.3-new/Makefile	2007-06-08 16:05:40.000000000 -0400
+@@ -1,6 +1,6 @@
+ -include Makefile.conf
+ 
+-SOURCES=syslog.mli syslog.ml
++SOURCES=syslog.mli aux.ml syslog.ml aux_stubs.c
+ RESULT=syslog
+ PACKS=unix
+ 

Propchange: trunk/packages/syslog-ocaml/trunk/debian/patches/aux.dpatch
------------------------------------------------------------------------------
    svn:executable = *




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