Source File
zero_copy_posix.go
Belonging Package
os
// Copyright 2024 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 || wasip1 || windows
package os
import (
)
// wrapSyscallError takes an error and a syscall name. If the error is
// a syscall.Errno, it wraps it in an os.SyscallError using the syscall name.
func ( string, error) error {
if , := .(syscall.Errno); {
= NewSyscallError(, )
}
return
}
// tryLimitedReader tries to assert the io.Reader to io.LimitedReader, it returns the io.LimitedReader,
// the underlying io.Reader and the remaining amount of bytes if the assertion succeeds,
// otherwise it just returns the original io.Reader and the theoretical unlimited remaining amount of bytes.
func ( io.Reader) (*io.LimitedReader, io.Reader, int64) {
var int64 = 1<<63 - 1 // by default, copy until EOF
, := .(*io.LimitedReader)
if ! {
return nil, ,
}
= .N
return , .R,
}
The pages are generated with Golds v0.7.6. (GOOS=linux GOARCH=amd64)