Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 9 of 9 for findProcess (0.19 sec)

  1. src/os/pidfd_linux_test.go

    	}
    	p.Wait()
    
    	// Use pid of a non-existing process.
    	proc, err := os.FindProcess(p.Pid)
    	// FindProcess should never return errors on Unix.
    	if err != nil {
    		t.Fatalf("FindProcess: got error %v, want <nil>", err)
    	}
    	// FindProcess should never return nil Process.
    	if proc == nil {
    		t.Fatal("FindProcess: got nil, want non-nil")
    	}
    	if proc.Status() != os.StatusDone {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 11 18:08:44 UTC 2024
    - 1.6K bytes
    - Viewed (0)
  2. src/os/exec_unix_test.go

    		// EINVAL (see waitid in usr/src/uts/common/os/exit.c in
    		// illumos). This is configurable via sysconf(_SC_MAXPID), but
    		// we'll just take the default.
    		pid = 30000-1
    	}
    
    	p, err := FindProcess(pid)
    	if err != nil {
    		t.Fatalf("FindProcess(math.MaxInt32) got err %v, want nil", err)
    	}
    
    	if ps, err := p.Wait(); !errors.Is(err, syscall.ECHILD) {
    		t.Errorf("Wait() got err %v (ps %+v), want %v", err, ps, syscall.ECHILD)
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 11 18:08:44 UTC 2024
    - 2K bytes
    - Viewed (0)
  3. src/os/signal/example_unix_test.go

    // it should abandon its work after a signal is received.
    func ExampleNotifyContext() {
    	ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)
    	defer stop()
    
    	p, err := os.FindProcess(os.Getpid())
    	if err != nil {
    		log.Fatal(err)
    	}
    
    	// On a Unix-like system, pressing Ctrl+C on a keyboard sends a
    	// SIGINT signal to the process of the program in execution.
    	//
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Nov 09 15:34:56 UTC 2023
    - 1.1K bytes
    - Viewed (0)
  4. src/os/exec_test.go

    	"os"
    	"os/signal"
    	"runtime"
    	"syscall"
    	"testing"
    	"time"
    )
    
    func TestProcessLiteral(t *testing.T) {
    	if runtime.GOOS == "windows" {
    		t.Skip("Process literals do not work on Windows. FindProcess/etc must initialize the process handle")
    	}
    	if runtime.GOARCH == "wasm" {
    		t.Skip("Signals send + notify not fully supported om wasm port")
    	}
    
    	c := make(chan os.Signal, 1)
    	signal.Notify(c, os.Interrupt)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 11 18:08:44 UTC 2024
    - 1.8K bytes
    - Viewed (0)
  5. src/cmd/go/testdata/script/test2json_interrupt.txt

    			// to the main test process and its parent.
    			for _, pid := range strings.Split(pids, ",") {
    				i, err := strconv.Atoi(pid)
    				if err != nil {
    					t.Fatal(err)
    				}
    				if p, err := os.FindProcess(i); err == nil {
    					p.Signal(os.Interrupt)
    					sentInterrupt = true // Only send interrupts once.
    				}
    			}
    		}
    		time.Sleep(1 * time.Millisecond)  // Delay the fuzzer a bit to avoid wasting CPU.
    	})
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Dec 08 03:52:44 UTC 2022
    - 1.7K bytes
    - Viewed (0)
  6. src/os/exec_plan9.go

    	p.Pid = -1
    
    	// Just mark the PID unusable.
    	p.pidDeactivate(statusReleased)
    
    	// no need for a finalizer anymore
    	runtime.SetFinalizer(p, nil)
    	return nil
    }
    
    func findProcess(pid int) (p *Process, err error) {
    	// NOOP for Plan 9.
    	return newPIDProcess(pid), nil
    }
    
    // ProcessState stores information about a process, as reported by Wait.
    type ProcessState struct {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 10 22:06:47 UTC 2024
    - 3.4K bytes
    - Viewed (0)
  7. src/os/exec_unix.go

    	case modePID:
    		// Just mark the PID unusable.
    		p.pidDeactivate(statusReleased)
    	}
    	// no need for a finalizer anymore
    	runtime.SetFinalizer(p, nil)
    	return nil
    }
    
    func findProcess(pid int) (p *Process, err error) {
    	h, err := pidfdFind(pid)
    	if err == ErrProcessDone {
    		// We can't return an error here since users are not expecting
    		// it. Instead, return a process with a "done" state already
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 10 22:06:47 UTC 2024
    - 4.1K bytes
    - Viewed (0)
  8. src/os/exec_windows.go

    	}
    
    	// no need for a finalizer anymore
    	runtime.SetFinalizer(p, nil)
    	return nil
    }
    
    func (p *Process) closeHandle() {
    	syscall.CloseHandle(syscall.Handle(p.handle))
    }
    
    func findProcess(pid int) (p *Process, err error) {
    	const da = syscall.STANDARD_RIGHTS_READ |
    		syscall.PROCESS_QUERY_INFORMATION | syscall.SYNCHRONIZE
    	h, e := syscall.OpenProcess(da, false, uint32(pid))
    	if e != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 10 22:06:47 UTC 2024
    - 5K bytes
    - Viewed (0)
  9. doc/next/9-todo.md

    CL 570681 ("os: make FindProcess use pidfd on Linux") mentions accepted proposal go.dev/issue/51246 (described as fully implemented in Go 1.22) and NeedsInvestigation continuation issue go.dev/issue/62654.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 11 17:18:52 UTC 2024
    - 6K bytes
    - Viewed (0)
Back to top