From patchwork Mon Apr 28 15:29:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Bilka X-Patchwork-Id: 726 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx21.g.dreamhost.com (peon2454.g.dreamhost.com [208.113.200.127]) by wilcox.dreamhost.com (Postfix) with ESMTP id 800F1360060 for ; Mon, 28 Apr 2014 08:29:47 -0700 (PDT) Received: by homiemail-mx21.g.dreamhost.com (Postfix, from userid 14307373) id 574D213CE938; Mon, 28 Apr 2014 08:29:45 -0700 (PDT) X-Original-To: glibc@patchwork.siddhesh.in Delivered-To: x14307373@homiemail-mx21.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx21.g.dreamhost.com (Postfix) with ESMTPS id 8D8A7148CF01 for ; Mon, 28 Apr 2014 08:29:45 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; q=dns; s=default; b=Q16/K7QIqLiS3EojtgYEdpl5g1zu6 NR4b8gqKJhX99a+v5sMAebFc3Vu3kMl6cZ3c1lUGBl+ugZkImlmS0g2WHSRLkLzP FJAduZr6rWr+h4WqtUNUR6GsEQjpwKcx1VUHTTbyDFNK75HzFZlUBo79cPGcnwR4 iUr8U72S3XEBK8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; s=default; bh=xEtGzd95kgDQrMWETG7WtrTQvQg=; b=AEG l6gDa5VBwf41RUklWSKJ+zghl/1R6MFZDANxAt+TMK9s+IExxt7CTx/IOYIA+E85 9wMZRyb3dUNIXCR3BFl+c3hAPpj3R14JkN0d01HuV77r5EloQqUZGHVBbAllrMny OYz2vbE+d8q66UET/nz1j2zolNxUOQYvbSDIsGt4= Received: (qmail 26406 invoked by alias); 28 Apr 2014 15:29:42 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 26383 invoked by uid 89); 28 Apr 2014 15:29:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, SPF_NEUTRAL autolearn=no version=3.3.2 X-HELO: popelka.ms.mff.cuni.cz Date: Mon, 28 Apr 2014 17:29:37 +0200 From: =?utf-8?B?T25kxZllaiBCw61sa2E=?= To: libc-alpha@sourceware.org Subject: [PATCH][BZ 16852] Do not clobber recvmmsg argument. Message-ID: <20140428152937.GA1736@domone.podge> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-DH-Original-To: glibc@patchwork.siddhesh.in Hi, here Rich asked about intended behaviour of recvmmsg timeout argument. A kernel overwrites it by remaining time but we declare it with const argument. So who is correct? If we want to make timeout constant following patch should work. Comments? * sysdeps/unix/sysv/linux/recvmmsg.c (recvmmsg): Do not clobber timeout argument. diff --git a/sysdeps/unix/sysv/linux/recvmmsg.c b/sysdeps/unix/sysv/linux/recvmmsg.c index 57ddf31..56690ff 100644 --- a/sysdeps/unix/sysv/linux/recvmmsg.c +++ b/sysdeps/unix/sysv/linux/recvmmsg.c @@ -37,6 +37,10 @@ int recvmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags, const struct timespec *tmo) { + struct timespec dummy; + memcpy (&dummy, tmo, sizeof (struct timespec)); + tmo = &dummy; + if (SINGLE_THREAD_P) return INLINE_SYSCALL (recvmmsg, 5, fd, vmessages, vlen, flags, tmo); @@ -61,6 +65,10 @@ int recvmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags, const struct timespec *tmo) { + struct timespec dummy; + memcpy (&dummy, tmo, sizeof (struct timespec)); + tmo = &dummy; + if (__glibc_likely (have_recvmmsg >= 0)) { int ret = __internal_recvmmsg (fd, vmessages, vlen, flags, tmo);