shithub: plan9front

Download patch

ref: 1d748edeaf62b2e919db1d2d5f0066dd529ea5fa
parent: bcde2519e2031396fef161416d66695861c3527f
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Dec 18 17:26:54 EST 2022

scram, aux/acpi: open /proc/$pid/ctl instead of #p/$pid/ctl for wirecpu0()

--- a/sys/src/cmd/aux/acpi.c
+++ b/sys/src/cmd/aux/acpi.c
@@ -248,15 +248,12 @@
 static void
 wirecpu0(void)
 {
-	char buf[128];
+	char buf[32];
 	int ctl;
 
 	snprint(buf, sizeof(buf), "/proc/%d/ctl", getpid());
-	if((ctl = open(buf, OWRITE)) < 0){
-		snprint(buf, sizeof(buf), "#p/%d/ctl", getpid());
-		if((ctl = open(buf, OWRITE)) < 0)
-			return;
-	}
+	if((ctl = open(buf, OWRITE)) < 0)
+		return;
 	write(ctl, "wired 0", 7);
 	close(ctl);
 }
--- a/sys/src/cmd/scram.c
+++ b/sys/src/cmd/scram.c
@@ -114,17 +114,14 @@
 	int ctl;
 
 	snprint(buf, sizeof(buf), "/proc/%d/ctl", getpid());
-	if((ctl = open(buf, OWRITE)) < 0){
-		snprint(buf, sizeof(buf), "#p/%d/ctl", getpid());
-		if((ctl = open(buf, OWRITE)) < 0)
-			return;
-	}
+	if((ctl = open(buf, OWRITE)) < 0)
+		return;
 	write(ctl, "wired 0", 7);
 	close(ctl);
 }
 
 void
-main()
+main(void)
 {
 	int n;