MCPcopy Create free account
hub / github.com/brimdata/super / OpenFile

Function OpenFile

pkg/fs/open_windows.go:31–40  ·  view source on GitHub ↗

OpenFile mimics the os.OpenFile call, but always uses the FILE_SHARE_DELETE flag. Differences from os.OpenFile: - It's not possible to support the testlog package connection for tests since testlog is an internal package. - This will not try to open directories if there's a failure to open a file wi

(name string, flag int, perm os.FileMode)

Source from the content-addressed store, hash-verified

29// - WriteAt will not return an error if the file is opened in append mode, as the
30// required variable to do so is not exported from package os.
31func OpenFile(name string, flag int, perm os.FileMode) (*os.File, error) {
32 if name == "" {
33 return nil, &os.PathError{Op: "open", Path: name, Err: syscall.ENOENT}
34 }
35 h, e := syscallOpen(fixLongPath(name), flag|syscall.O_CLOEXEC, syscallMode(perm))
36 if e != nil {
37 return nil, e
38 }
39 return os.NewFile(uintptr(h), name), nil
40}
41
42func Open(name string) (*os.File, error) {
43 return OpenFile(name, os.O_RDONLY, 0)

Callers 3

OpenFileFunction · 0.92
OpenFunction · 0.70
CreateFunction · 0.70

Calls 3

syscallOpenFunction · 0.85
fixLongPathFunction · 0.85
syscallModeFunction · 0.85

Tested by

no test coverage detected