From owner-svn-src-all@FreeBSD.ORG Sat Nov 1 20:41:41 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 168D6D11; Sat, 1 Nov 2014 20:41:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC971315; Sat, 1 Nov 2014 20:41:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1KfeYl034451; Sat, 1 Nov 2014 20:41:40 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1Kfeiw034450; Sat, 1 Nov 2014 20:41:40 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201411012041.sA1Kfeiw034450@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 1 Nov 2014 20:41:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273943 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 20:41:41 -0000 Author: ngie Date: Sat Nov 1 20:41:40 2014 New Revision: 273943 URL: https://svnweb.freebsd.org/changeset/base/273943 Log: Port t_kevent to FreeBSD Submitted by: pho Modified: head/contrib/netbsd-tests/lib/libc/sys/t_kevent.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_kevent.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_kevent.c Sat Nov 1 20:33:42 2014 (r273942) +++ head/contrib/netbsd-tests/lib/libc/sys/t_kevent.c Sat Nov 1 20:41:40 2014 (r273943) @@ -43,12 +43,18 @@ __RCSID("$NetBSD: t_kevent.c,v 1.6 2012/ #include #include #include +#ifdef __NetBSD__ #include +#endif #include #include #include #include +#ifdef __FreeBSD__ +#define DRVCTLDEV "/nonexistent" +#endif + ATF_TC(kevent_zerotimer); ATF_TC_HEAD(kevent_zerotimer, tc) { @@ -108,9 +114,15 @@ ATF_TC_BODY(kqueue_desc_passing, tc) if (recvmsg(s[1], &m, 0) == -1) err(1, "child: could not recvmsg"); +#ifdef __FreeBSD__ + bcopy(CMSG_DATA(msg), &kq, sizeof(kq)); + printf("child (pid %d): received kq fd %d\n", getpid(), kq); + _exit(0); +#else kq = *(int *)CMSG_DATA(msg); printf("child (pid %d): received kq fd %d\n", getpid(), kq); exit(0); +#endif } close(s[1]); @@ -122,15 +134,29 @@ ATF_TC_BODY(kqueue_desc_passing, tc) msg->cmsg_type = SCM_RIGHTS; msg->cmsg_len = CMSG_LEN(sizeof(int)); +#ifdef __FreeBSD__ + /* + * What is should have been + * bcopy(&s[0], CMSG_DATA(msg), sizeof(kq)); + */ + bcopy(&kq, CMSG_DATA(msg), sizeof(kq)); +#else *(int *)CMSG_DATA(msg) = kq; +#endif EV_SET(&ev, 1, EVFILT_TIMER, EV_ADD|EV_ENABLE, 0, 1, 0); ATF_CHECK(kevent(kq, &ev, 1, NULL, 0, NULL) != -1); printf("parent (pid %d): sending kq fd %d\n", getpid(), kq); if (sendmsg(s[0], &m, 0) == -1) { +#if defined(__NetBSD__) ATF_REQUIRE_EQ_MSG(errno, EBADF, "errno is %d", errno); atf_tc_skip("PR kern/46523"); +#endif +#if defined(__FreeBSD__) + ATF_REQUIRE_EQ_MSG(errno, EOPNOTSUPP, "errno is %d", errno); + close(s[0]); +#endif } close(kq);