aboutsummaryrefslogtreecommitdiffstats
path: root/rwcancel/poll_linux.go
blob: d9938c5785e935190f23a6bda8d88d1809ac9743 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* SPDX-License-Identifier: MIT
 *
 * Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved.
 */

package rwcancel

import "golang.org/x/sys/unix"

func poll(fds []unix.PollFd, timeout int) (n int, err error) {
	var ts *unix.Timespec
	if timeout >= 0 {
		ts = new(unix.Timespec)
		*ts = unix.NsecToTimespec(int64(timeout) * 1e6)
	}
	return unix.Ppoll(fds, ts, nil)
}