Commit 95d05c1e authored by Guillaume J. Charmes's avatar Guillaume J. Charmes Committed by GitHub
Browse files

Prevent golang to set the non-block flag on ptmx open to avoid 100% CPU usage on reads (#53)


Signed-off-by: default avatarGuillaume J. Charmes <guillaume@charmes.net>
parent 2c10821d
......@@ -8,10 +8,11 @@ import (
)
func open() (pty, tty *os.File, err error) {
p, err := os.OpenFile("/dev/ptmx", os.O_RDWR, 0)
pFD, err := syscall.Open("/dev/ptmx", syscall.O_RDWR|syscall.O_CLOEXEC, 0)
if err != nil {
return nil, nil, err
}
p := os.NewFile(uintptr(pFD), "/dev/ptmx")
sname, err := ptsname(p)
if err != nil {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment