// Copyright 2009 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.//go:build unix || (js && wasm) || wasip1 || windowspackage pollimport ()// eofError returns io.EOF when fd is available for reading end of// file.func ( *FD) ( int, error) error {if == 0 && == nil && .ZeroReadIsEOF {returnio.EOF }return}// Shutdown wraps syscall.Shutdown.func ( *FD) ( int) error {if := .incref(); != nil {return }defer .decref()returnsyscall.Shutdown(.Sysfd, )}// Fchown wraps syscall.Fchown.func ( *FD) (, int) error {if := .incref(); != nil {return }defer .decref()returnignoringEINTR(func() error {returnsyscall.Fchown(.Sysfd, , ) })}// Ftruncate wraps syscall.Ftruncate.func ( *FD) ( int64) error {if := .incref(); != nil {return }defer .decref()returnignoringEINTR(func() error {returnsyscall.Ftruncate(.Sysfd, ) })}// RawControl invokes the user-defined function f for a non-IO// operation.func ( *FD) ( func(uintptr)) error {if := .incref(); != nil {return }defer .decref() (uintptr(.Sysfd))returnnil}// ignoringEINTR makes a function call and repeats it if it returns// an EINTR error. This appears to be required even though we install all// signal handlers with SA_RESTART: see #22838, #38033, #38836, #40846.// Also #20400 and #36644 are issues in which a signal handler is// installed without setting SA_RESTART. None of these are the common case,// but there are enough of them that it seems that we can't avoid// an EINTR loop.func ignoringEINTR( func() error) error {for { := ()if != syscall.EINTR {return } }}// ignoringEINTR2 is ignoringEINTR, but returning an additional value.func ignoringEINTR2[ any]( func() (, error)) (, error) {for { , := ()if != syscall.EINTR {return , } }}
The pages are generated with Goldsv0.7.3. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.