shithub: riscv

Download patch

ref: fe393882506834722eda40d94289133366f5a210
parent: 06b9aa5039d6ce366870b5de1075c245111fd161
author: cinap_lenrek <[email protected]>
date: Sun Mar 8 12:06:37 EDT 2020

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.

--- a/sys/src/cmd/nusb/usbd/usbd.c
+++ b/sys/src/cmd/nusb/usbd/usbd.c
@@ -338,8 +338,15 @@
 	}
 }
 
+static void
+usbdend(Srv*)
+{
+	postnote(PNGROUP, getpid(), "shutdown");
+}
+
 Srv usbdsrv = {
 	.start = usbdstart,
+	.end = usbdend,
 	.attach = usbdattach,
 	.walk1 = usbdwalk,
 	.read = usbdread,