summaryrefslogtreecommitdiff
path: root/sys/src/cmd/nusb
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2020-03-08 16:06:37 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2020-03-08 16:06:37 +0100
commitfe393882506834722eda40d94289133366f5a210 (patch)
treefe38dcd149d36e4cda57471d4ad9ee9a65878b78 /sys/src/cmd/nusb
parent06b9aa5039d6ce366870b5de1075c245111fd161 (diff)
nusb/usbd: cleanup processes on unmount
this makes sure that when postsharesrv() fails (for example because the shr file already exists), the worker process gets killed and all file descriptors to devusb get closed.
Diffstat (limited to 'sys/src/cmd/nusb')
-rw-r--r--sys/src/cmd/nusb/usbd/usbd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/src/cmd/nusb/usbd/usbd.c b/sys/src/cmd/nusb/usbd/usbd.c
index fa56f6866..4c2d70100 100644
--- a/sys/src/cmd/nusb/usbd/usbd.c
+++ b/sys/src/cmd/nusb/usbd/usbd.c
@@ -338,8 +338,15 @@ usbdstart(Srv*)
}
}
+static void
+usbdend(Srv*)
+{
+ postnote(PNGROUP, getpid(), "shutdown");
+}
+
Srv usbdsrv = {
.start = usbdstart,
+ .end = usbdend,
.attach = usbdattach,
.walk1 = usbdwalk,
.read = usbdread,