ref: dab1b23cf5049a8f51a7135a7b0ee3882155dc42
parent: 9816ffde4ff0842330ea914d528835d9f654a726
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Dec 18 17:44:00 EST 2022
vncs: use procsetname() instead of rolling your own
--- a/sys/src/cmd/vnc/vncs.c
+++ b/sys/src/cmd/vnc/vncs.c
@@ -49,9 +49,6 @@
static void vncaccept(Vncs*);
static int vncsfmt(Fmt*);
static void getremote(char*, char*);
-static void vncname(char*, ...);
-#pragma varargck argpos vncname 1
-
#pragma varargck type "V" Vncs*
void
@@ -233,7 +230,7 @@
atexit(shutdown);
notify(noteshutdown);
for(;;){
- vncname("listener");
+ procsetname("listener");
cfd = listen(adir, ldir);
if(cfd < 0)
break;
@@ -614,24 +611,7 @@
}
}
-static void
-vncname(char *fmt, ...)
-{
- int fd;
- char name[64], buf[32];
- va_list arg;
- va_start(arg, fmt);
- vsnprint(name, sizeof name, fmt, arg);
- va_end(arg);
-
- sprint(buf, "/proc/%d/args", getpid());
- if((fd = open(buf, OWRITE)) >= 0){
- write(fd, name, strlen(name));
- close(fd);
- }
-}
-
/*
* Set the pixel format being sent. Can only happen once.
* (Maybe a client would send this again if the screen changed
@@ -731,7 +711,7 @@
char *buf;
Rectangle r;
- vncname("read %V", v);
+ procsetname("read %V", v);
for(;;){
type = vncrdchar(v);
@@ -1150,7 +1130,7 @@
{
ulong last = 0;
- vncname("write %V", v);
+ procsetname("write %V", v);
while(!v->ndead){
sleep(sleeptime);
updatesnarf(v);