[Pkg-erlang-commits] r1369 - yaws/trunk/debian/patches

sgolovan at alioth.debian.org sgolovan at alioth.debian.org
Fri Dec 16 20:42:14 UTC 2011


Author: sgolovan
Date: 2011-12-16 20:42:14 +0000 (Fri, 16 Dec 2011)
New Revision: 1369

Modified:
   yaws/trunk/debian/patches/driver.diff
Log:
[yaws]
  * Fixed compatibility with r15b.


Modified: yaws/trunk/debian/patches/driver.diff
===================================================================
--- yaws/trunk/debian/patches/driver.diff	2011-12-16 10:15:24 UTC (rev 1368)
+++ yaws/trunk/debian/patches/driver.diff	2011-12-16 20:42:14 UTC (rev 1369)
@@ -1,24 +1,105 @@
-Patch fixes compatibility with Erlang R15B.
+Patch by upstream fixes compatibility with Erlang R15B.
 
 --- yaws-1.91.orig/c_src/setuid_drv.c
 +++ yaws-1.91/c_src/setuid_drv.c
-@@ -131,6 +131,9 @@
+@@ -131,6 +131,17 @@
      setuid_driver_entry.finish       = NULL;
      setuid_driver_entry.control      = NULL;
      setuid_driver_entry.outputv      = NULL;
++    setuid_driver_entry.ready_async     = NULL;
++    setuid_driver_entry.flush           = NULL;
++    setuid_driver_entry.call            = NULL;
++    setuid_driver_entry.event           = NULL;
 +    setuid_driver_entry.extended_marker = ERL_DRV_EXTENDED_MARKER;
-+    setuid_driver_entry.major_version = ERL_DRV_EXTENDED_MAJOR_VERSION;
-+    setuid_driver_entry.minor_version = ERL_DRV_EXTENDED_MINOR_VERSION;
++    setuid_driver_entry.major_version   = ERL_DRV_EXTENDED_MAJOR_VERSION;
++    setuid_driver_entry.minor_version   = ERL_DRV_EXTENDED_MINOR_VERSION;
++    setuid_driver_entry.driver_flags    = 0;
++    setuid_driver_entry.handle2         = NULL;
++    setuid_driver_entry.process_exit    = NULL;
++    setuid_driver_entry.stop_select     = NULL;
      return (ErlDrvEntry*) &setuid_driver_entry;
  }
  
 --- yaws-1.91.orig/c_src/yaws_sendfile_drv.c
 +++ yaws-1.91/c_src/yaws_sendfile_drv.c
-@@ -292,7 +292,15 @@
+@@ -24,6 +24,15 @@
+ #include "erl_driver_compat.h"
+ #endif
+ 
++/*
++ * previously drv_output(..., int len)
++ * since R15B drv_output(..., ErlDrvSizeT len)
++ * use int if OTP < R15B
++ */
++#if ERL_DRV_EXTENDED_MAJOR_VERSION < 2
++typedef int ErlDrvSizeT;
++#endif
++
+ #include "hashtable.h"
+ 
+ #define lshift_index(s, i, shift, t) (((t)((unsigned char*)(s))[i]) << (shift))
+@@ -130,10 +139,10 @@
+     }* result;
+ } Buffer;
+ 
+-static size_t set_error_buffer(Buffer* b, int socket_fd, int err)
++static ErlDrvSizeT set_error_buffer(Buffer* b, int socket_fd, int err)
+ {
+     char* s, *t;
+-    size_t result_size = sizeof *(b->result);
++    ErlDrvSizeT result_size = sizeof *(b->result);
+     memset(b->result, 0, result_size);
+     put_int32(socket_fd, &(b->result->out_fd));
+     s = erl_errno_id(err);
+@@ -185,7 +194,8 @@
+ #endif
+ }
+ 
+-static void yaws_sendfile_drv_output(ErlDrvData handle, char* buf, int buflen)
++static void yaws_sendfile_drv_output(ErlDrvData handle, char* buf,
++                                     ErlDrvSizeT buflen)
+ {
+     int fd, socket_fd;
+     Desc* d = (Desc*)handle;
+@@ -194,7 +204,7 @@
+     socket_fd = get_int32(&(b.args->out_fd));
+     fd = open(b.args->filename, O_RDONLY | O_NONBLOCK);
+     if (fd < 0) {
+-        int out_buflen = set_error_buffer(&b, socket_fd, errno);
++        ErlDrvSizeT out_buflen = set_error_buffer(&b, socket_fd, errno);
+         driver_output(d->port, buf, out_buflen);
+     } else {
+         Transfer* xfer;
+@@ -206,12 +216,14 @@
+                driver stops, or if an insertion error occurs below. */
+             xfer = (Transfer*)malloc(sizeof(Transfer));
+             if (xfer == NULL) {
+-                int out_buflen = set_error_buffer(&b, socket_fd, ENOMEM);
++                ErlDrvSizeT out_buflen = set_error_buffer(&b, socket_fd,
++                                                          ENOMEM);
+                 driver_output(d->port, buf, out_buflen);
+                 return;
+             }
+             if (!hashtable_insert(d->xfer_table, sfd.hashkey, xfer)) {
+-                int out_buflen = set_error_buffer(&b, socket_fd, ENOMEM);
++                ErlDrvSizeT out_buflen = set_error_buffer(&b, socket_fd,
++                                                          ENOMEM);
+                 driver_output(d->port, buf, out_buflen);
+                 free(xfer);
+                 return;
+@@ -254,7 +266,7 @@
+         }
+     } else {
+         int save_errno = errno;
+-        int out_buflen;
++        ErlDrvSizeT out_buflen;
+         char buf[36];
+         Buffer b;
+         b.buffer = buf;
+@@ -292,6 +304,18 @@
      NULL,
      NULL,
      NULL,
--    NULL
 +    NULL,
 +    NULL,
 +    NULL,
@@ -27,7 +108,10 @@
 +    NULL,
 +    ERL_DRV_EXTENDED_MARKER,
 +    ERL_DRV_EXTENDED_MAJOR_VERSION,
-+    ERL_DRV_EXTENDED_MINOR_VERSION
++    ERL_DRV_EXTENDED_MINOR_VERSION,
++    0,
++    NULL,
++    NULL,
+     NULL
  };
  
- DRIVER_INIT(yaws_sendfile_drv)




More information about the Pkg-erlang-commits mailing list