Sys *syscall.SysProcAttr
}
+// A Signal can represent any operating system signal.
+type Signal interface {
+ String() string
+}
+
// Getpid returns the process id of the caller.
func Getpid() int { return syscall.Getpid() }
return newProcess(pid, h), nil
}
+// Plan9Note implements the Signal interface on Plan 9.
+type Plan9Note string
+
+func (note Plan9Note) String() string {
+ return string(note)
+}
+
+func (p *Process) Signal(sig Signal) Error {
+ if p.done {
+ return NewError("os: process already finished")
+ }
+
+ f, e := OpenFile("/proc/"+itoa(p.Pid)+"/note", O_WRONLY, 0)
+ if iserror(e) {
+ return NewSyscallError("signal", e)
+ }
+ defer f.Close()
+ _, e = f.Write([]byte(sig.String()))
+ return e
+}
+
// Kill causes the Process to exit immediately.
func (p *Process) Kill() Error {
f, e := OpenFile("/proc/"+itoa(p.Pid)+"/ctl", O_WRONLY, 0)
}
if waitmsg.Pid == p.Pid {
+ p.done = true
break
}
}
"syscall"
)
-// A Signal can represent any operating system signal.
-type Signal interface {
- String() string
-}
-
type UnixSignal int32
func (sig UnixSignal) String() string {
fd int
name string
dirinfo *dirInfo // nil unless directory being read
- nepipe int // number of consecutive EPIPE in Write
}
// Fd returns the integer Unix file descriptor referencing the open file.
return nil
}
-// ChownPlan9 changes the uid and gid strings of the named file.
-func ChownPlan9(name, uid, gid string) Error {
- var d Dir
- d.Null()
-
- d.Uid = uid
- d.Gid = gid
-
- if e := syscall.Wstat(name, pdir(nil, &d)); iserror(e) {
- return &PathError{"chown_plan9", name, e}
- }
- return nil
-}
-
// Chtimes changes the access and modification times of the named
// file, similar to the Unix utime() or utimes() functions.
//