shithub: riscv

Download patch

ref: e534c4147e1ab3f5891c8821c2cbac1c66bec93c
parent: 97a2e35a0c4a408285f2e94667f6ae069bb462e8
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");