Source File
fd_posix.go
Belonging Package
internal/poll
// 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 {return io.EOF}return}// Shutdown wraps syscall.Shutdown.func ( *FD) ( int) error {if := .incref(); != nil {return}defer .decref()return syscall.Shutdown(.Sysfd, )}// Fchown wraps syscall.Fchown.func ( *FD) (, int) error {if := .incref(); != nil {return}defer .decref()return ignoringEINTR(func() error {return syscall.Fchown(.Sysfd, , )})}// Ftruncate wraps syscall.Ftruncate.func ( *FD) ( int64) error {if := .incref(); != nil {return}defer .decref()return ignoringEINTR(func() error {return syscall.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))return nil}// 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 ( func() error) error {for {:= ()if != syscall.EINTR {return}}}
![]() |
The pages are generated with Golds v0.6.7. (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 @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |