From owner-freebsd-current@FreeBSD.ORG Sat Aug 2 09:40:04 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C5D9C5DB; Sat, 2 Aug 2014 09:40:04 +0000 (UTC) Received: from mail-qg0-x234.google.com (mail-qg0-x234.google.com [IPv6:2607:f8b0:400d:c04::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 78BC92839; Sat, 2 Aug 2014 09:40:04 +0000 (UTC) Received: by mail-qg0-f52.google.com with SMTP id f51so6730197qge.39 for ; Sat, 02 Aug 2014 02:40:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:from:date:message-id:subject:to:cc:content-type; bh=8IAdaKslnIZn10Sm9Ta60kc8Pk9V/U4k1e16mrD0R2o=; b=YQssxVmrSypbMDOS7TzHIT5W2uzngo/RCMfJ1dvkT/OYLQyQXt4+k+bHpZ/k8tec6T eRQOr+SoiJwUrSVVRP9Lgg35iev7CST2re6svk8CaS3Y20doLkTEvenaYDcNSlEgt7kG DOfjm8CpwGgcXqiLoxjhQuUtx69+R71y3Dq1SkeovyP6DK66BKIrim/jB9z+GXl/O+NS HLl2289xRyd720lDUUzyrhps1a5hOtk7o+TUK+dnsmCt7bCElyqgOvxIu0VjHuCOrMKf aHzqizo3q5Dd0gT58GHIyWHlQ7LmHTZp5bAE8HhLGwuRD2CLXeQSy+Xpmk/D6qkjOLQ2 z9Og== X-Received: by 10.229.211.132 with SMTP id go4mr17470792qcb.0.1406972403527; Sat, 02 Aug 2014 02:40:03 -0700 (PDT) MIME-Version: 1.0 Sender: fedor.indutny@gmail.com Received: by 10.96.198.227 with HTTP; Sat, 2 Aug 2014 02:39:43 -0700 (PDT) From: Fedor Indutny Date: Sat, 2 Aug 2014 13:39:43 +0400 X-Google-Sender-Auth: 9llRlbfxgOIvFJt-6R3cRu5BLQE Message-ID: Subject: KQueue 0-length UDP packet To: freebsd-current@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18 Cc: Mark Johnston X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 09:40:05 -0000 Hello! I'm trying to figure out, why this code: https://github.com/indutny/0-udp Which basically sends a 0-length UDP packet to a server and polls kqueue events on the server fd. Return 1 kevent on FreeBSD, and blocks indefinitely without returning any events on OSX. So far I could see that FreeBSD and OSX are treating NOTE_LOWAT differently: * https://github.com/opensource-apple/xnu/blob/2fa84067f6cdeb23267f877ca4fd26201316da1b/bsd/kern/uipc_socket.c#L4461 * https://github.com/freebsd/freebsd/blob/6901832d8588537c81afbdb91d1a22deb5582c47/sys/kern/uipc_socket.c#L3163-L3164 FreeBSD's NOTE_LOWAT is overriding SO_RCVLOWAT, and OSX is using SO_RVCLOWAT as a minimum value. But, since NOTE_LOWAT is not involved here by default, I'm failing to see where exactly this event could pass through kqueue filter. Could anyone with UDP and/or KQueue implementation knowledge share some insights with me? Thank you very much! Fedor. (NOTE: Duplicate, first email wasn't posted, because I wasn't subscribed to the ML)