1// Copyright 2018 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5//go:build !plan9 6 7package os 8 9import ( 10 "runtime" 11) 12 13// rawConn implements syscall.RawConn. 14type rawConn struct { 15 file *File 16} 17 18func (c *rawConn) Control(f func(uintptr)) error { 19 if err := c.file.checkValid("SyscallConn.Control"); err != nil { 20 return err 21 } 22 err := c.file.pfd.RawControl(f) 23 runtime.KeepAlive(c.file) 24 return err 25} 26 27func (c *rawConn) Read(f func(uintptr) bool) error { 28 if err := c.file.checkValid("SyscallConn.Read"); err != nil { 29 return err 30 } 31 err := c.file.pfd.RawRead(f) 32 runtime.KeepAlive(c.file) 33 return err 34} 35 36func (c *rawConn) Write(f func(uintptr) bool) error { 37 if err := c.file.checkValid("SyscallConn.Write"); err != nil { 38 return err 39 } 40 err := c.file.pfd.RawWrite(f) 41 runtime.KeepAlive(c.file) 42 return err 43} 44 45func newRawConn(file *File) (*rawConn, error) { 46 return &rawConn{file: file}, nil 47} 48