-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathrlimit_windows.go
61 lines (51 loc) · 1.48 KB
/
rlimit_windows.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// +build windows
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
// windows specific implementations/stubs.
var _ = fmt.Printf
var _ = syscall.EscapeArg
func ShowRlimit() {
// var rLimit syscall.Rlimit
// err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit)
// if err != nil {
// panic(fmt.Sprintf("Error Getting Rlimit '%s'", err))
// }
// fmt.Printf("starting rlimit.Cur = %d, rlimit.Max = %d\n", rLimit.Cur, rLimit.Max)
}
func SetRlimit() {
// var rLimit syscall.Rlimit
// rLimit.Max = 999999
// rLimit.Cur = 999999
// err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit)
// if err != nil {
// panic(fmt.Sprintf("Error Setting Rlimit '%s'", err))
// }
// err = syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit)
// if err != nil {
// panic(fmt.Sprintf("Error Getting Rlimit '%s'", err))
// }
// fmt.Printf("final: rlimit.Cur = %d, rlimit.Max = %d\n", rLimit.Cur, rLimit.Max)
}
func systemCallSetGroup(c *exec.Cmd) {
//c.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
}
func killProcessGroup(pid int) {
// // try to kill via PGID; we ran this child in its own process group for this.
// pgid, pgidErr := syscall.Getpgid(pid)
// proc, err := os.FindProcess(w.Pid)
// _ = err // ignored. possible race; might already be gone.
// if pgidErr == nil {
// syscall.Kill(-pgid, 9) // note the minus sign
// }
}
func killWithQuit(jobservPid int) {
proc, err := os.FindProcess(jobservPid)
if err == nil {
proc.Kill() // jobservPid, syscall.SIGQUIT)
}
}