10 examples of 'golang os open' in Go

Every line of 'golang os open' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Go code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
10func open(path string, mode int, perm uint32) (fd int, err error) {
11 var _p0 *byte
12 _p0, err = BytePtrFromString(path)
13 if err != nil {
14 return
15 }
16 r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
17 fd = int(r0)
18 if e1 != 0 {
19 err = e1
20 }
21 return
22}
835func Open(path string, mode int, perm uint32) (fd int, err error) {
836 var _p0 *byte
837 _p0, err = BytePtrFromString(path)
838 if err != nil {
839 return
840 }
841 r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
842 fd = int(r0)
843 if e1 != 0 {
844 err = e1
845 }
846 return
847}
638func Open(path string, mode int, perm uint32) (fd int, err error) {
639 var _p0 *byte
640 _p0, err = BytePtrFromString(path)
641 if err != nil {
642 return
643 }
644 r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&libc_Open)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0, 0)
645 use(unsafe.Pointer(_p0))
646 fd = int(r0)
647 if e1 != 0 {
648 err = errnoErr(e1)
649 }
650 return
651}
40func Open(path string, mode int32, perm uint32) int32 {
41 var fd, _ = syscall.Open(path, int(mode), perm)
42 return int32(fd)
43}
153func (self *Ptfs) Open(path string, flags int) (errc int, fh uint64) {
154 defer trace(path, flags)(&errc, &fh)
155 return self.open(path, flags, 0)
156}
10func open() (pty, tty *os.File, err error) {
11 p, err := os.OpenFile("/dev/ptmx", os.O_RDWR, 0)
12 if err != nil {
13 return nil, nil, err
14 }
15
16 sname, err := ptsname(p)
17 if err != nil {
18 return nil, nil, err
19 }
20
21 err = unlockpt(p)
22 if err != nil {
23 return nil, nil, err
24 }
25
26 t, err := os.OpenFile(sname, os.O_RDWR|syscall.O_NOCTTY, 0)
27 if err != nil {
28 return nil, nil, err
29 }
30 return p, t, nil
31}
430func callopenat(dirfd int, _p0 uintptr, flags int, mode uint32) (r1 uintptr, e1 Errno) {
431 r1 = uintptr(C.openat(C.int(dirfd), C.uintptr_t(_p0), C.int(flags), C.uint(mode)))
432 e1 = syscall.GetErrno()
433 return
434}
112func (c *linuxConsole) open(flag int) (*os.File, error) {
113 r, e := syscall.Open(c.slavePath, flag, 0)
114 if e != nil {
115 return nil, &os.PathError{
116 Op: "open",
117 Path: c.slavePath,
118 Err: e,
119 }
120 }
121 return os.NewFile(uintptr(r), c.slavePath), nil
122}
25func open(path string) (io.ReadCloser, error) {
26 if path == "-" {
27 return os.Stdin, nil
28 }
29
30 return os.Open(path)
31}
35func (f *WSSFile) Open(path string) error {
36 f.path = path
37 file, err := os.OpenFile(path, os.O_RDWR, os.ModeExclusive)
38 f.file = file
39 return err
40}

Related snippets