git: 9front

Download patch

ref: 3aa3659d51e86822766b3545097f6a9d61d4dff0
parent: 50b5ed42a484cc88f24aa68c1ee35cf3e3d0ea46
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Sep 8 19:31:30 EDT 2018

libmach: substitute /dev/zero for /proc/$pid/fpregs when missing (for snapfs)

--- a/sys/src/libmach/map.c
+++ b/sys/src/libmach/map.c
@@ -108,11 +108,8 @@
 	if (mach->fpregsize) {
 		sprint(buf, "/proc/%d/fpregs", pid);
 		fd = open(buf, mode);
-		if(fd < 0) {
-			close(map->seg[0].fd);
-			free(map);
-			return 0;
-		}
+		if(fd < 0)
+			fd = open("/dev/zero", OREAD);
 		setmap(map, fd, mach->regsize, mach->regsize+mach->fpregsize, 0, "fpregs");
 	}
 	setmap(map, corefd, fp->txtaddr, fp->txtaddr+fp->txtsz, fp->txtaddr, "text");
--