Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 31 for SetNonblock (0.16 sec)

  1. src/runtime/internal/wasitest/testdata/nonblock.go

    	for _, path := range os.Args[2:] {
    		f, err := os.Open(path)
    		if err != nil {
    			panic(err)
    		}
    		switch mode {
    		case "os.OpenFile":
    		case "os.NewFile":
    			fd := f.Fd()
    			if err := syscall.SetNonblock(int(fd), true); err != nil {
    				panic(err)
    			}
    			f = os.NewFile(fd, path)
    		default:
    			panic("invalid test mode")
    		}
    
    		spawnWait := make(chan struct{})
    
    		wg.Add(1)
    		go func(f *os.File) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 26 17:59:52 UTC 2023
    - 1K bytes
    - Viewed (0)
  2. src/syscall/net_js.go

    func SetReadDeadline(fd int, t int64) error {
    	return ENOSYS
    }
    
    func SetWriteDeadline(fd int, t int64) error {
    	return ENOSYS
    }
    
    func Shutdown(fd int, how int) error {
    	return ENOSYS
    }
    
    func SetNonblock(fd int, nonblocking bool) error {
    	return nil
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 25 00:12:41 UTC 2023
    - 1.4K bytes
    - Viewed (0)
  3. src/os/pipe_test.go

    func TestReadNonblockingFd(t *testing.T) {
    	switch runtime.GOOS {
    	case "windows":
    		t.Skip("Windows doesn't support SetNonblock")
    	}
    	if os.Getenv("GO_WANT_READ_NONBLOCKING_FD") == "1" {
    		fd := syscallDescriptor(os.Stdin.Fd())
    		syscall.SetNonblock(fd, true)
    		defer syscall.SetNonblock(fd, false)
    		_, err := os.Stdin.Read(make([]byte, 1))
    		if err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 05 23:35:29 UTC 2023
    - 12.4K bytes
    - Viewed (0)
  4. src/syscall/fs_wasip1.go

    	// runtime supports non-blocking stdio, the Go runtime is able to
    	// use the WASI net poller to poll for read/write readiness and is
    	// able to schedule goroutines while waiting.
    	SetNonblock(0, true)
    	SetNonblock(1, true)
    	SetNonblock(2, true)
    }
    
    type uintptr32 = uint32
    type size = uint32
    type fdflags = uint32
    type filesize = uint64
    type filetype = uint8
    type lookupflags = uint32
    type oflags = uint32
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 15 19:57:43 UTC 2024
    - 24.1K bytes
    - Viewed (0)
  5. src/os/os_unix_test.go

    		t.Fatalf("pipe: %v", err)
    	}
    	defer syscall.Close(p[1])
    
    	// Set the read-side to non-blocking.
    	if !blocking {
    		if err := syscall.SetNonblock(p[0], true); err != nil {
    			syscall.Close(p[0])
    			t.Fatalf("SetNonblock: %v", err)
    		}
    	}
    	// Convert it to a file.
    	file := NewFile(uintptr(p[0]), "notapipe")
    	if file == nil {
    		syscall.Close(p[0])
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Sep 18 17:32:43 UTC 2023
    - 11.5K bytes
    - Viewed (0)
  6. src/os/fifo_test.go

    	}
    }
    
    func TestNewFileNonBlocking(t *testing.T) {
    	var p [2]int
    	if err := syscall.Pipe(p[:]); err != nil {
    		t.Fatal(err)
    	}
    	if err := syscall.SetNonblock(p[0], true); err != nil {
    		t.Fatal(err)
    	}
    	f := os.NewFile(uintptr(p[0]), "pipe")
    	nonblock, err := unix.IsNonblock(p[0])
    	if err != nil {
    		t.Fatal(err)
    	}
    	defer f.Close()
    	if !nonblock {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 19 11:47:23 UTC 2024
    - 6.1K bytes
    - Viewed (0)
  7. src/runtime/os_aix.go

    }
    
    //go:nosplit
    func fcntl(fd, cmd, arg int32) (int32, int32) {
    	r, errno := syscall3(&libc_fcntl, uintptr(fd), uintptr(cmd), uintptr(arg))
    	return int32(r), int32(errno)
    }
    
    //go:nosplit
    func setNonblock(fd int32) {
    	flags, _ := fcntl(fd, _F_GETFL, 0)
    	if flags != -1 {
    		fcntl(fd, _F_SETFL, flags|_O_NONBLOCK)
    	}
    }
    
    // sigPerThreadSyscall is only used on linux, so we assign a bogus signal
    // number.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 25 19:53:03 UTC 2024
    - 8.9K bytes
    - Viewed (0)
  8. src/os/file_unix.go

    		// non-blocking mode.
    		if nonBlocking {
    			// See the comments on net_newUnixFile.
    			if kind == kindSock {
    				f.nonblock = true // tell Fd to return blocking descriptor
    			}
    		} else if err := syscall.SetNonblock(fd, true); err == nil {
    			f.nonblock = true
    			clearNonBlock = true
    		} else {
    			pollable = false
    		}
    	}
    
    	// An error here indicates a failure to register
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 13:52:34 UTC 2024
    - 14.9K bytes
    - Viewed (0)
  9. src/syscall/exec_unix.go

    	n = 0
    	for i, s := range ss {
    		bb[i] = &b[n]
    		copy(b[n:], s)
    		n += len(s) + 1
    	}
    	return bb, nil
    }
    
    func CloseOnExec(fd int) { fcntl(fd, F_SETFD, FD_CLOEXEC) }
    
    func SetNonblock(fd int, nonblocking bool) (err error) {
    	flag, err := fcntl(fd, F_GETFL, 0)
    	if err != nil {
    		return err
    	}
    	if (flag&O_NONBLOCK != 0) == nonblocking {
    		return nil
    	}
    	if nonblocking {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Feb 26 21:03:59 UTC 2024
    - 8.7K bytes
    - Viewed (0)
  10. src/syscall/syscall_wasip1.go

    	clockProcessCPUTimeID
    	clockThreadCPUTimeID
    )
    
    //go:wasmimport wasi_snapshot_preview1 clock_time_get
    //go:noescape
    func clock_time_get(id clockid, precision timestamp, time unsafe.Pointer) Errno
    
    func SetNonblock(fd int, nonblocking bool) error {
    	flags, err := fd_fdstat_get_flags(fd)
    	if err != nil {
    		return err
    	}
    	if nonblocking {
    		flags |= FDFLAG_NONBLOCK
    	} else {
    		flags &^= FDFLAG_NONBLOCK
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Feb 26 21:03:59 UTC 2024
    - 9.4K bytes
    - Viewed (0)
Back to top