// MACHINE GENERATED BY 'go generate' COMMAND; DO NOT EDIT

package goselect

import "unsafe"
import "syscall"

var _ unsafe.Pointer

var (
	modws2_32 = syscall.NewLazyDLL("ws2_32.dll")

	procselect       = modws2_32.NewProc("select")
	proc__WSAFDIsSet = modws2_32.NewProc("__WSAFDIsSet")
)

func _select(nfds int, readfds *FDSet, writefds *FDSet, exceptfds *FDSet, timeout *syscall.Timeval) (total int, err error) {
	r0, _, e1 := syscall.Syscall6(procselect.Addr(), 5, uintptr(nfds), uintptr(unsafe.Pointer(readfds)), uintptr(unsafe.Pointer(writefds)), uintptr(unsafe.Pointer(exceptfds)), uintptr(unsafe.Pointer(timeout)), 0)
	total = int(r0)
	if total == 0 {
		if e1 != 0 {
			err = error(e1)
		} else {
			err = syscall.EINVAL
		}
	}
	return
}

func __WSAFDIsSet(handle syscall.Handle, fdset *FDSet) (isset int, err error) {
	r0, _, e1 := syscall.Syscall(proc__WSAFDIsSet.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(fdset)), 0)
	isset = int(r0)
	if isset == 0 {
		if e1 != 0 {
			err = error(e1)
		} else {
			err = syscall.EINVAL
		}
	}
	return
}
