[PATCHES] messaging iov / recvfrom

Andreas Schneider asn at samba.org
Tue May 27 01:51:10 MDT 2014


On Monday 26 May 2014 17:07:44 Michael Adam wrote:
> Oops, there was a bug in the first patch.
> Sorry for posting prematurely...
> Attaching a fixed version.

> diff --git a/source3/lib/unix_msg/unix_msg.c
> b/source3/lib/unix_msg/unix_msg.c index 956e3a3..bcabd28 100644
> --- a/source3/lib/unix_msg/unix_msg.c
> +++ b/source3/lib/unix_msg/unix_msg.c
> @@ -233,8 +233,22 @@ static void unix_dgram_recv_handler(struct poll_watch
> *w, int fd, short events,> 
>  {
>  
>  	struct unix_dgram_ctx *ctx = (struct unix_dgram_ctx *)private_data;
>  	ssize_t received;
> 
> +	struct msghdr msg;
> +	struct iovec iov;
> +
> +	iov = (struct iovec) {
> +		.iov_base = (void *)ctx->recv_buf,
> +		.iov_len = ctx->max_msg,
> +	};
> +

Please use ZERO_STRUCT(msg) here!

> +	msg = (struct msghdr) {
> +		.msg_iov = &iov,
> +		.msg_iovlen = 1,
> +		.msg_control = NULL,
> +		.msg_controllen = 0,

msg_control might not be available on all platforms, at least not without 
setting special flags to enable support for it! So for now please to not set 
it!

We can add it later when it is needed and we already found out with 
socket_wrapper tests how to get it working on BSD and Solaris ...



	-- andreas

-- 
Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             asn at samba.org
www.samba.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140527/74446044/attachment.pgp>


More information about the samba-technical mailing list