1 2 /* 3 * This file and its contents are supplied under the terms of the 4 * Common Development and Distribution License ("CDDL"), version 1.0. 5 * You may only use this file in accordance with the terms of version 6 * 1.0 of the CDDL. 7 * 8 * A full copy of the text of the CDDL should have accompanied this 9 * source. A copy of the CDDL is also available via the Internet at 10 * http://www.illumos.org/license/CDDL. 11 */ 12 13 /* 14 * Copyright 2023 Oxide Computer Company 15 */ 16 17 #include <stdlib.h> 18 #include <unistd.h> 19 #include <fcntl.h> 20 #include <sys/devpoll.h> 21 22 #include "common.h" 23 24 int 25 main(void) 26 { 27 sigset_t mask; 28 29 assert(sigemptyset(&mask) == 0); 30 int sigfd1 = signalfd(-1, &mask, 0); 31 int sigfd2 = signalfd(-1, &mask, 0); 32 33 if (sigfd1 == -1 || sigfd2 == -1) { 34 test_fail("unable to initialize signalfd resources"); 35 } 36 37 int pfd = open("/dev/poll", O_RDWR); 38 if (pfd == -1) { 39 test_fail("unable to initialize devpoll resource"); 40 } 41 42 struct pollfd buf[2] = { 43 { 44 .fd = sigfd1, 45 .events = POLLIN, 46 }, 47 { 48 .fd = sigfd2, 49 .events = POLLIN, 50 } 51 }; 52 ssize_t wrote = write(pfd, buf, sizeof (buf)); 53 if (wrote != sizeof (buf)) { 54 test_fail("unable to establish polling"); 55 } 56 57 (void) close(sigfd1); 58 (void) close(sigfd2); 59 test_pass(); 60 } 61