[SCM] Samba Shared Repository - branch v4-2-test updated

Karolin Seeger kseeger at samba.org
Sun Mar 1 15:50:07 MST 2015


The branch, v4-2-test has been updated
       via  f645571 snprintf: Try to support %j
       via  d0a5a6f tevent: version 0.9.23
       via  bc8585b Add Solaris ports as a tevent backend.
       via  2f50cd2 Update the tevent_data.dox tutrial stuff to fix some errors, including white space problems.
       via  3c4e071 ctdb-io: Do not use sys_write to write to client sockets
       via  811fad3 smbd: Stop using vfs_Chdir after SMB_VFS_DISCONNECT.
       via  a8d285f vfs: Add a brief vfs_ceph manpage.
       via  aadfc40 doc:man:vfs_glusterfs: improve the configuration section.
       via  081a730 doc:man:vfs_glusterfs: improve and update description.
       via  9c5e310 doc:man:vfs_glusterfs: remove extra % signs.
       via  38d6d20 debug: Set close-on-exec for the main log file FD
      from  3a1f881 VERSION: Bump version up to 4.2.0...

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-2-test


- Log -----------------------------------------------------------------
commit f64557172da25c2745986600324311a5aee4e962
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 11 17:16:50 2015 +0100

    snprintf: Try to support %j
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Feb 12 23:34:33 CET 2015 on sn-devel-104
    
    (cherry picked from commit 5f08d8b1728cc4559e61e0c928577724e0e2f9d2)
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11119
    lib/replace/sprintf.c needs to support format specifier %j
    
    Autobuild-User(v4-2-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-2-test): Sun Mar  1 23:49:26 CET 2015 on sn-devel-104

commit d0a5a6f4797efb167086d54b47c61c0e89634f15
Author: Michael Adam <obnox at samba.org>
Date:   Fri Feb 27 00:27:29 2015 +0100

    tevent: version 0.9.23
    
    * Add Solaris ports as tevent backend.
    * Improvements to the tevent_data tutorial.
    * Remove use of the 'staticforward' macro.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User(master): Michael Adam <obnox at samba.org>
    Autobuild-Date(master): Fri Feb 27 03:48:57 CET 2015 on sn-devel-104
    
    (cherry picked from commit 04b8e19e1708c5670d180f5cd86d8ed139e9e5a4)
    
    The last 3 patches address
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11118
    Add Solaris Ports as a tevent backend

commit bc8585b0120eb5956a0b9397fe07902c76fea072
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Jul 22 14:23:33 2013 -0700

    Add Solaris ports as a tevent backend.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: David Disseldorp <ddiss at samba.org>
    
    Autobuild-User(master): David Disseldorp <ddiss at samba.org>
    Autobuild-Date(master): Sun Feb 15 23:25:07 CET 2015 on sn-devel-104
    
    (cherry picked from commit 88c1eb4ae10a9f69d2e828b4e5543915c1d990c6)

commit 2f50cd2554ac400ea1fc2e6aa5c7127d8b5f876f
Author: Richard Sharpe <rsharpe at samba.org>
Date:   Fri Jan 23 21:56:19 2015 -0800

    Update the tevent_data.dox tutrial stuff to fix some errors, including white space problems.
    
    Signed-off-by: Richard Sharpe <rsharpe at samba.org>
    Reviewed-by: Ralph Boehme <rb at sernet.de>
    
    Autobuild-User(master): Richard Sharpe <sharpe at samba.org>
    Autobuild-Date(master): Sat Jan 24 09:33:03 CET 2015 on sn-devel-104
    
    (cherry picked from commit 6a56bdf9869162e57c816c067598552bd33c2910)

commit 3c4e071a5419e310276b59789e146b6b037ac89c
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Mon Feb 23 12:38:11 2015 +1100

    ctdb-io: Do not use sys_write to write to client sockets
    
    When sending messages to clients, ctdb checks for EAGAIN error code and
    schedules next write in the subsequent event loop.  Using sys_write in
    these places causes ctdb to loop hard till a client is able to read from
    the socket.  With real time scheduling, ctdb daemon spins consuming 100%
    of CPU trying to write to the client sockets.  This can be quite harmful
    when running under VMs or machines with single CPU.
    
    This regression was introduced when all read/write calls were replaced to
    use sys_read/sys_write wrappers (c1558adeaa980fb4bd6177d36250ec8262e9b9fe).
    
    The existing code backs off in case of EAGAIN failures and waits for an
    event loop to process the write again.  This should give ctdb clients
    a chance to get scheduled and to process the ctdb socket.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    Autobuild-User(master): Martin Schwenke <martins at samba.org>
    Autobuild-Date(master): Tue Feb 24 12:29:30 CET 2015 on sn-devel-104
    
    (cherry picked from commit 04a061e4d19d5bdbd8179fb0fab8b0875eec243e)
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11124
    CTDB daemon is non responsive and consuming 100% CPU

commit 811fad364241d5553ac12402652cef2b522191f9
Author: Ira Cooper <ira at samba.org>
Date:   Thu Jan 15 11:41:50 2015 -0500

    smbd: Stop using vfs_Chdir after SMB_VFS_DISCONNECT.
    
    This sequencing is causing problems for vfs_ceph, and likely
    other vfs modules.
    
    Signed-off-by: Ira Cooper <ira at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Fri Jan 16 00:13:17 CET 2015 on sn-devel-104
    
    (cherry picked from commit 81464daea71e5fa3067ec7d5f5c69c890c0f7949)
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11115
    S3: vfs_Chdir() is called after SMB_VFS_DISCONNECT in
    source3/smbd/service.c::close_cnum().

commit a8d285feb9a455895aec7d4660eb67e891b4a107
Author: Günther Deschner <gd at samba.org>
Date:   Thu Feb 5 15:59:52 2015 +0100

    vfs: Add a brief vfs_ceph manpage.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11088
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit aadfc401a2ed686cee2222a4b2f117e46c53bd5e
Author: Michael Adam <obnox at samba.org>
Date:   Thu Feb 19 16:59:00 2015 +0100

    doc:man:vfs_glusterfs: improve the configuration section.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    
    Autobuild-User(master): Günther Deschner <gd at samba.org>
    Autobuild-Date(master): Fri Feb 20 14:29:21 CET 2015 on sn-devel-104
    
    (cherry picked from commit e6e6f563e6968dcb3ae558a7857f8dff49d2939f)
    
    The last 3 patches address
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11117
    vfs_glusterfs manpage corrections

commit 081a73054666fc97a996e596901e081a1882302b
Author: Michael Adam <obnox at samba.org>
Date:   Fri Feb 13 01:04:11 2015 +0100

    doc:man:vfs_glusterfs: improve and update description.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    (cherry picked from commit 7852dd9e4c806d4e2b5428cb783b8ce6db8902d0)

commit 9c5e310d63d7d1fea219e4fe43b94a46a5461d3c
Author: Michael Adam <obnox at samba.org>
Date:   Fri Feb 13 01:03:21 2015 +0100

    doc:man:vfs_glusterfs: remove extra % signs.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    (cherry picked from commit b9bf3c4d785606573ee3b9cb8e727bb04b3be6fb)

commit 38d6d2047ce8be04c73e510cda54b80ff644018d
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Feb 16 15:59:11 2015 +1300

    debug: Set close-on-exec for the main log file FD
    
    This does not change the properties of dup2() of the fd as STDERR, however this is closed
    before we start smbd or winbindd as child processes.
    
    This is needed otherwise the logfile remains open in the child process, and
    logfile rotation can mean this old log remains on disk indefinatly.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11100
    Pair-programmed-with: Garming Sam <garming at catalyst.net.nz>
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Mon Feb 16 11:42:47 CET 2015 on sn-devel-104
    
    (cherry picked from commit 1d95b0afc3547a91f8558873ce58652c271ed9eb)

-----------------------------------------------------------------------

Summary of changes:
 ctdb/common/ctdb_io.c                              |   6 +-
 .../manpages/{vfs_snapper.8.xml => vfs_ceph.8.xml} |  65 +-
 docs-xml/manpages/vfs_glusterfs.8.xml              |  61 +-
 docs-xml/wscript_build                             |   1 +
 lib/replace/snprintf.c                             |   4 +
 lib/replace/system/select.h                        |   4 +
 lib/replace/wscript                                |   5 +
 .../ABI/{tevent-0.9.21.sigs => tevent-0.9.23.sigs} |   0
 lib/tevent/doc/tevent_data.dox                     |  30 +-
 lib/tevent/tevent.c                                |   5 +-
 lib/tevent/tevent_internal.h                       |   3 +
 lib/tevent/tevent_port.c                           | 779 +++++++++++++++++++++
 lib/tevent/wscript                                 |   5 +-
 lib/util/debug.c                                   |   3 +
 lib/util/wscript_build                             |   2 +-
 source3/smbd/service.c                             |   6 +-
 16 files changed, 911 insertions(+), 68 deletions(-)
 copy docs-xml/manpages/{vfs_snapper.8.xml => vfs_ceph.8.xml} (52%)
 copy lib/tevent/ABI/{tevent-0.9.21.sigs => tevent-0.9.23.sigs} (100%)
 create mode 100644 lib/tevent/tevent_port.c


Changeset truncated at 500 lines:

diff --git a/ctdb/common/ctdb_io.c b/ctdb/common/ctdb_io.c
index 467ec9a..53486f4 100644
--- a/ctdb/common/ctdb_io.c
+++ b/ctdb/common/ctdb_io.c
@@ -232,9 +232,9 @@ static void queue_io_write(struct ctdb_queue *queue)
 		struct ctdb_queue_pkt *pkt = queue->out_queue;
 		ssize_t n;
 		if (queue->ctdb->flags & CTDB_FLAG_TORTURE) {
-			n = sys_write(queue->fd, pkt->data, 1);
+			n = write(queue->fd, pkt->data, 1);
 		} else {
-			n = sys_write(queue->fd, pkt->data, pkt->length);
+			n = write(queue->fd, pkt->data, pkt->length);
 		}
 
 		if (n == -1 && errno != EAGAIN && errno != EWOULDBLOCK) {
@@ -310,7 +310,7 @@ int ctdb_queue_send(struct ctdb_queue *queue, uint8_t *data, uint32_t length)
 	   queue overhead. This relies on non-blocking sockets */
 	if (queue->out_queue == NULL && queue->fd != -1 &&
 	    !(queue->ctdb->flags & CTDB_FLAG_TORTURE)) {
-		ssize_t n = sys_write(queue->fd, data, length2);
+		ssize_t n = write(queue->fd, data, length2);
 		if (n == -1 && errno != EAGAIN && errno != EWOULDBLOCK) {
 			talloc_free(queue->fde);
 			queue->fde = NULL;
diff --git a/docs-xml/manpages/vfs_snapper.8.xml b/docs-xml/manpages/vfs_ceph.8.xml
similarity index 52%
copy from docs-xml/manpages/vfs_snapper.8.xml
copy to docs-xml/manpages/vfs_ceph.8.xml
index 0e06ec5..978f6b3 100644
--- a/docs-xml/manpages/vfs_snapper.8.xml
+++ b/docs-xml/manpages/vfs_ceph.8.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 <!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
-<refentry id="vfs_snapper.8">
+<refentry id="vfs_ceph.8">
 
 <refmeta>
-	<refentrytitle>vfs_snapper</refentrytitle>
+	<refentrytitle>vfs_ceph</refentrytitle>
 	<manvolnum>8</manvolnum>
 	<refmiscinfo class="source">Samba</refmiscinfo>
 	<refmiscinfo class="manual">System Administration tools</refmiscinfo>
@@ -12,15 +12,15 @@
 
 
 <refnamediv>
-	<refname>vfs_snapper</refname>
+	<refname>vfs_ceph</refname>
 	<refpurpose>
-		Expose snapshots managed by snapper as shadow-copies
+		Utilize features provided by CephFS
 	</refpurpose>
 </refnamediv>
 
 <refsynopsisdiv>
 	<cmdsynopsis>
-		<command>vfs objects = snapper</command>
+		<command>vfs objects = ceph</command>
 	</cmdsynopsis>
 </refsynopsisdiv>
 
@@ -32,14 +32,22 @@
 	<manvolnum>8</manvolnum></citerefentry> suite.</para>
 
 	<para>
-		The <command>vfs_snapper</command> VFS module exposes snapshots
-		managed by snapper for use by Samba. This provides the ability
-		for remote SMB clients to access shadow-copies via Windows
-		Explorer using the "previous versions" dialog.
+		The <command>vfs_ceph</command> VFS module exposes
+		CephFS specific features for use by Samba.
 	</para>
 
 	<para>
-		This module is stackable.
+		Ceph is a distributed network file system designed to provide
+		excellent performance, reliability, and scalability. This is a
+		shared library allowing applications to access a Ceph
+		distributed file system via a POSIX-like interface.
+	</para>
+
+	<para>
+		This module can be combined with other modules, but it
+		should be the last module in the <command>vfs objects</command>
+		list. Modules added to this list to the right of the ceph
+		entry may not have any effect at all.
 	</para>
 </refsect1>
 
@@ -47,29 +55,36 @@
 	<title>CONFIGURATION</title>
 
 	<para>
-		The underlying share path must have a corresponding snapper
-		configuration file. The snapshot directory tree must allow
-		access for relavent users.
+		<command>vfs_ceph</command> requires that the underlying share
+		path is a Ceph filesystem.
 	</para>
 
 	<programlisting>
 		<smbconfsection name="[share]"/>
-		<smbconfoption name="vfs objects">snapper</smbconfoption>
+		<smbconfoption name="vfs objects">ceph</smbconfoption>
 	</programlisting>
 </refsect1>
 
 <refsect1>
-	<title>PERMISSIONS</title>
-	<para>
-		Snapper stores snapshots under a .snapshots subdirectory. This
-		directory must permit traversal for any users wishing to access
-		snapshots via the Windows Explorer previous versions dialog.
-		By default, traversal is forbidden for all non-root users.
-		Additionally, users must be granted permission to list snapshots
-		managed by snapper, via snapper's ALLOW_USERS or ALLOW_GROUPS
-		options. Snapper can grant these users and groups .snapshots
-		traversal access automatically via the SYNC_ACL option.
-	</para>
+	<title>OPTIONS</title>
+
+	<variablelist>
+
+		<varlistentry>
+		<term>ceph:config_file = path</term>
+		<listitem>
+		<para>
+			Allows to define a ceph configfile to use. Empty by default.
+		</para>
+		<para>
+			Example: ceph:config_file =
+			/etc/ceph/ceph.conf
+		</para>
+		</listitem>
+		</varlistentry>
+
+	</variablelist>
+
 </refsect1>
 
 <refsect1>
diff --git a/docs-xml/manpages/vfs_glusterfs.8.xml b/docs-xml/manpages/vfs_glusterfs.8.xml
index 83032cc..c0c320c 100644
--- a/docs-xml/manpages/vfs_glusterfs.8.xml
+++ b/docs-xml/manpages/vfs_glusterfs.8.xml
@@ -32,28 +32,29 @@
 	<manvolnum>8</manvolnum></citerefentry> suite.</para>
 
 	<para>
-		The <command>vfs_glusterfs</command> VFS module exposes
-		GlusterFS specific features for use by Samba.
+		GlusterFS
+		(<ulink url="http://www.gluster.org/">http://www.gluster.org</ulink>)
+		is an Open Source clustered file system capable of scaling to
+		several peta-bytes.  With its FUSE based native client,
+		GlusterFS is available as a POSIX compliant file system and can
+		hence be shared by Samba without additional steps.
 	</para>
 
 	<para>
-		GlusterFS is a clustered file system, capable of scaling
-		to several peta-bytes. It aggregates various storage bricks
-		over Infiniband RDMA or TCP/IP and interconnect into one large
-		parallel network file system. Storage bricks can be made of any
-		commodity hardware, such as x86-64 server with SATA-II RAID and
-		Infiniband HBA.
-
-		GlusterFS is fully POSIX compliant file system. It supports
-		standard clients running standard applications over any standard
-		IP network and also FUSE. It works seemlessly on
-		different operating systems, currently supported on GNU/Linux
-		and Solaris.
+		The <command>vfs_glusterfs</command> VFS module provides an
+		alternative, and superior way to access a Gluster filesystem
+		from Samba for sharing. It does not require a Gluster FUSE mount
+		but directly accesses the GlusterFS daemon through its library
+		<command>libgfapi</command>, thereby omitting the expensive
+		kernel-userspace context switches and taking advantage of some
+		of the more advanced features of GlusterFS.
 	</para>
 
 	<para>
-		This module is stackable, provided glusterfs lies in the bottom
-		of the stack.
+		This module can be combined with other modules, but it
+		should be the last module in the <command>vfs objects</command>
+		list. Modules added to this list to the right of the glusterfs
+		entry may not have any effect at all.
 	</para>
 </refsect1>
 
@@ -61,14 +62,33 @@
 	<title>CONFIGURATION</title>
 
 	<para>
-		<command>vfs_glusterfs</command> requires that the underlying share
-		path is a Gluster filesystem.
+		A basic configuration looks like this.
 	</para>
 
 	<programlisting>
 		<smbconfsection name="[share]"/>
 		<smbconfoption name="vfs objects">glusterfs</smbconfoption>
+		<smbconfoption name="path">/relative/base/path</smbconfoption>
+		<smbconfoption name="glusterfs:volume">gv0</smbconfoption>
+		<smbconfoption name="kernel share modes">no</smbconfoption>
 	</programlisting>
+
+	<para>
+		Note that since <command>vfs_glusterfs</command> does not
+		require a Gluster mount, the share <command>path</command> is
+		treated differently than for other shares: It is interpreted as
+		the base path of the share relative to the gluster volume used.
+		Because this is usually not at the same time a system path, in a
+		ctdb cluster setup where ctdb manages Samba, you need to set
+		<command>CTDB_SAMBA_SKIP_SHARE_CHECK=yes</command> in ctdb's
+		configuration file. Otherwise ctdb will not get healthy.
+	</para>
+
+	<para>
+		Note that currently kernel share modes have to be disabled
+		in a share running with the glusterfs vfs module for file
+		serving to work properly.
+	</para>
 </refsect1>
 
 <refsect1>
@@ -82,12 +102,11 @@
 		<para>
 			Defines whether and where to store a vfs_glusterfs specific
 			logfile. Client variable substitution is supported (i.e.
-			%M, %m, %I), hence per client log file can be
-			%specified.
+			%M, %m, %I), hence per client log file can be specified.
 		</para>
 		<para>
 			Example: glusterfs:logfile =
-			%/var/log/samba/glusterfs-vol2.%M.log
+			/var/log/samba/glusterfs-vol2.%M.log
 		</para>
 		</listitem>
 		</varlistentry>
diff --git a/docs-xml/wscript_build b/docs-xml/wscript_build
index 0bc3f54..e4a3f5f 100644
--- a/docs-xml/wscript_build
+++ b/docs-xml/wscript_build
@@ -53,6 +53,7 @@ manpages='''
          manpages/vfs_cacheprime.8
          manpages/vfs_cap.8
          manpages/vfs_catia.8
+         manpages/vfs_ceph.8
          manpages/vfs_commit.8
          manpages/vfs_crossrename.8
          manpages/vfs_default_quota.8
diff --git a/lib/replace/snprintf.c b/lib/replace/snprintf.c
index 6b4a711..86ba74c 100644
--- a/lib/replace/snprintf.c
+++ b/lib/replace/snprintf.c
@@ -445,6 +445,10 @@ static int dopr(char *buffer, size_t maxlen, const char *format, va_list args_in
 					ch = *format++;
 				}
 				break;
+			case 'j':
+				cnk->cflags = DP_C_LLONG;
+				ch = *format++;
+				break;
 			case 'L':
 				cnk->cflags = DP_C_LDOUBLE;
 				ch = *format++;
diff --git a/lib/replace/system/select.h b/lib/replace/system/select.h
index 11c5390..9e945c3 100644
--- a/lib/replace/system/select.h
+++ b/lib/replace/system/select.h
@@ -34,6 +34,10 @@
 #include <sys/epoll.h>
 #endif
 
+#ifdef HAVE_SOLARIS_PORTS
+#include <port.h>
+#endif
+
 #ifndef SELECT_CAST
 #define SELECT_CAST
 #endif
diff --git a/lib/replace/wscript b/lib/replace/wscript
index 4d4d182..f8a0179 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -38,6 +38,7 @@ def configure(conf):
     conf.CHECK_HEADERS('libaio.h locale.h ndir.h pwd.h')
     conf.CHECK_HEADERS('shadow.h sys/acl.h')
     conf.CHECK_HEADERS('sys/attributes.h attr/attributes.h sys/capability.h sys/dir.h sys/epoll.h')
+    conf.CHECK_HEADERS('port.h')
     conf.CHECK_HEADERS('sys/fcntl.h sys/filio.h sys/filsys.h sys/fs/s5param.h sys/fs/vx/quota.h')
     conf.CHECK_HEADERS('sys/id.h sys/ioctl.h sys/ipc.h sys/mman.h sys/mode.h sys/ndir.h sys/priv.h')
     conf.CHECK_HEADERS('sys/resource.h sys/security.h sys/shm.h sys/statfs.h sys/statvfs.h sys/termio.h')
@@ -283,6 +284,7 @@ def configure(conf):
     conf.CHECK_FUNCS('timegm getifaddrs freeifaddrs mmap setgroups syscall setsid')
     conf.CHECK_FUNCS('getgrent_r getgrgid_r getgrnam_r getgrouplist getpagesize')
     conf.CHECK_FUNCS('getpwent_r getpwnam_r getpwuid_r epoll_create')
+    conf.CHECK_FUNCS('port_create')
 
     conf.SET_TARGET_TYPE('attr', 'EMPTY')
 
@@ -487,6 +489,9 @@ removeea setea
     if conf.CONFIG_SET('HAVE_EPOLL_CREATE') and conf.CONFIG_SET('HAVE_SYS_EPOLL_H'):
         conf.DEFINE('HAVE_EPOLL', 1)
 
+    if conf.CONFIG_SET('HAVE_PORT_CREATE') and conf.CONFIG_SET('HAVE_PORT_H'):
+        conf.DEFINE('HAVE_SOLARIS_PORTS', 1)
+
     conf.CHECK_HEADERS('poll.h')
     conf.CHECK_FUNCS('poll')
 
diff --git a/lib/tevent/ABI/tevent-0.9.21.sigs b/lib/tevent/ABI/tevent-0.9.23.sigs
similarity index 100%
copy from lib/tevent/ABI/tevent-0.9.21.sigs
copy to lib/tevent/ABI/tevent-0.9.23.sigs
diff --git a/lib/tevent/doc/tevent_data.dox b/lib/tevent/doc/tevent_data.dox
index 4ee4ac2..dbe7a04 100644
--- a/lib/tevent/doc/tevent_data.dox
+++ b/lib/tevent/doc/tevent_data.dox
@@ -46,18 +46,19 @@ struct testA {
 
 
 static void foo_done(struct tevent_req *req) {
-// a->x contains 9
-struct foo_state *a = tevent_req_data(req, struct foo_state);
+    // a->x contains 10 since it came from foo_send
+    struct foo_state *a = tevent_req_data(req, struct foo_state);
 
-// b->y contains 10
-struct testA *b = tevent_req_callback_data(req, struct testA);
+    // b->y contains 9 since it came from run
+    struct testA *b = tevent_req_callback_data(req, struct testA);
 
-// c->y contains 10
-struct testA *c = (struct testA *)tevent_req_callback_data_void(req);
+    // c->y contains 9 since it came from run we just used a different way
+    // of getting it.
+    struct testA *c = (struct testA *)tevent_req_callback_data_void(req);
 
-printf("a->x: %d\n", a->x);
-printf("b->y: %d\n", b->y);
-printf("c->y: %d\n", c->y);
+    printf("a->x: %d\n", a->x);
+    printf("b->y: %d\n", b->y);
+    printf("c->y: %d\n", c->y);
 }
 
 
@@ -77,6 +78,9 @@ static void run(struct tevent_context *ev, struct tevent_timer *te,
                 struct timeval current_time, void *private_data) {
     struct tevent_req *req;
     struct testA *tmp = talloc(ev, struct testA);
+
+    // Note that we did not use the private data passed in
+
     tmp->y = 9;
     req = foo_send(ev, ev);
 
@@ -101,7 +105,7 @@ int main (int argc, char **argv) {
         return EXIT_FAILURE;
 
     data = talloc(mem_ctx, struct testA);
-    data->y = 10;
+    data->y = 11;
 
     time_event = tevent_add_timer(event_ctx,
                                   mem_ctx,
@@ -125,9 +129,9 @@ int main (int argc, char **argv) {
 Output of this example is:
 
 @code
-a->x: 9
-b->y: 10
-c->y: 10
+a->x: 10
+b->y: 9
+c->y: 9
 @endcode
 
 */
diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c
index be0afd4..843cf05 100644
--- a/lib/tevent/tevent.c
+++ b/lib/tevent/tevent.c
@@ -123,9 +123,12 @@ static void tevent_backend_init(void)
 	tevent_select_init();
 	tevent_poll_init();
 	tevent_poll_mt_init();
-#ifdef HAVE_EPOLL
+#if defined(HAVE_EPOLL)
 	tevent_epoll_init();
+#elif defined(HAVE_SOLARIS_PORTS)
+	tevent_port_init();
 #endif
+
 	tevent_standard_init();
 }
 
diff --git a/lib/tevent/tevent_internal.h b/lib/tevent/tevent_internal.h
index d25dc05..10cc4a4 100644
--- a/lib/tevent/tevent_internal.h
+++ b/lib/tevent/tevent_internal.h
@@ -351,6 +351,9 @@ void tevent_epoll_set_panic_fallback(struct tevent_context *ev,
 			bool (*panic_fallback)(struct tevent_context *ev,
 					       bool replay));
 #endif
+#ifdef HAVE_SOLARIS_PORTS
+bool tevent_port_init(void);
+#endif
 
 
 void tevent_trace_point_callback(struct tevent_context *ev,
diff --git a/lib/tevent/tevent_port.c b/lib/tevent/tevent_port.c
new file mode 100644
index 0000000..93e94b2
--- /dev/null
+++ b/lib/tevent/tevent_port.c
@@ -0,0 +1,779 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   Main select loop and event handling - Solaris port implementation.
+   Losely based on the Linux epoll backend.
+
+   Copyright (C) Jeremy Allison		2013
+
+     ** NOTE! The following LGPL license applies to the tevent
+     ** library. This does NOT imply that all of Samba is released
+     ** under the LGPL
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 3 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "replace.h"
+#include "system/filesys.h"
+#include "system/select.h"
+#include "tevent.h"
+#include "tevent_internal.h"
+#include "tevent_util.h"
+
+struct port_associate_vals {
+	struct port_associate_vals *prev, *next;
+	struct port_event_context *port_ev;
+	int events;
+	struct tevent_fd *fde;
+	bool associated_event;
+};
+
+struct port_event_context {
+	/* a pointer back to the generic event_context */
+	struct tevent_context *ev;
+
+	/* This is the handle from port_create */
+	int port_fd;
+
+	pid_t pid;
+
+	/* List of associations. */
+	struct port_associate_vals *po_vals;
+};
+
+#define PORT_ADDITIONAL_FD_FLAG_HAS_ASSOCIATION	(1<<0)
+#define PORT_ADDITIONAL_FD_FLAG_REPORT_ERROR	(1<<1)
+#define PORT_ADDITIONAL_FD_FLAG_GOT_ERROR	(1<<2)
+#define PORT_ADDITIONAL_FD_FLAG_HAS_MPX		(1<<3)
+
+/*
+  Map from TEVENT_FD_* to POLLIN/POLLOUT
+*/
+static int port_map_flags(uint16_t flags)
+{
+	int ret = 0;
+	if (flags & TEVENT_FD_READ) ret |= (POLLIN | POLLERR | POLLHUP);
+	if (flags & TEVENT_FD_WRITE) ret |= (POLLOUT | POLLERR | POLLHUP);
+	return ret;
+}
+
+/*
+ Free the port fd
+*/
+static int port_ctx_destructor(struct port_event_context *port_ev)
+{
+	close(port_ev->port_fd);
+	port_ev->port_fd = -1;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list