summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]sys/src/libmach/map.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/src/libmach/map.c b/sys/src/libmach/map.c
index c745d82a6..c668defd1 100644..100755
--- a/sys/src/libmach/map.c
+++ b/sys/src/libmach/map.c
@@ -89,11 +89,13 @@ attachproc(int pid, int kflag, int corefd, Fhdr *fp)
map = newmap(0, 4);
if (!map)
return 0;
- if(kflag)
+ if(kflag) {
regs = "kregs";
- else
+ mode = OREAD;
+ } else {
regs = "regs";
- mode = ORDWR;
+ mode = ORDWR;
+ }
if (mach->regsize) {
sprint(buf, "/proc/%d/%s", pid, regs);
fd = open(buf, mode);