aboutsummaryrefslogtreecommitdiff
path: root/sendusr1.go
blob: e61df231aef1a2f49384b6c0a4cbdd04119998ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
	"os"
	"syscall"

	"github.com/rfjakob/gocryptfs/internal/toggledlog"
)

// Send signal USR1 to "pid" (usually our parent process). This notifies it
// that the mounting has completed sucessfully.
func sendUsr1(pid int) {
	p, err := os.FindProcess(pid)
	if err != nil {
		toggledlog.Warn.Printf("sendUsr1: FindProcess: %v\n", err)
		return
	}
	err = p.Signal(syscall.SIGUSR1)
	if err != nil {
		toggledlog.Warn.Printf("sendUsr1: Signal: %v\n", err)
	}
}