aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2025-10-22 03:48:31 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2025-10-22 03:48:31 +0000
commit9fe4157b82f62ee4b209325b0c25580ad0a068ec (patch)
tree6ebf1c3708712efcec485538f19a0a2d2de5a48d /src
parentb1b5cca013c200014799953dd40d0b9e2ea88e63 (diff)
downloads6-9fe4157b82f62ee4b209325b0c25580ad0a068ec.tar.gz
Fix storage of struct thinfo_s in s6-background-watch
Diffstat (limited to 'src')
-rw-r--r--src/supervision/s6-background-watch.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/supervision/s6-background-watch.c b/src/supervision/s6-background-watch.c
index 847e844..c7aac83 100644
--- a/src/supervision/s6-background-watch.c
+++ b/src/supervision/s6-background-watch.c
@@ -136,6 +136,8 @@ struct thinfo_s
pid_t pid ;
} ;
+static struct thinfo_s thinfo ;
+
static void *keventwait (void *arg)
{
struct thinfo_s *t = arg ;
@@ -152,23 +154,22 @@ static void *keventwait (void *arg)
static void keventstart (pid_t pid, int *fd, pthread_t *th)
{
- struct thinfo_s t ;
int p[2] ;
pthread_attr_t attr ;
struct kevent ke ;
int e ;
- t.kq = kqueue() ;
- if (t.kq == -1) strerr_diefu1sys(111, "kqueue") ;
+ thinfo.kq = kqueue() ;
+ if (thinfo.kq == -1) strerr_diefu1sys(111, "kqueue") ;
EV_SET(&ke, pid, EVFILT_PROC, EV_ADD | EV_ONESHOT, NOTE_EXIT, 0, 0) ;
- if (kevent(t.kq, &ke, 1, 0, 0, 0) == -1) strerr_diefu1sys(111, "register kevent") ;
+ if (kevent(thinfo.kq, &ke, 1, 0, 0, 0) == -1) strerr_diefu1sys(111, "register kevent") ;
if (pipe(p) == -1) strerr_diefu2sys(111, "pipe") ;
- t.fdw = p[1] ;
- t.pid = pid ;
+ thinfo.fdw = p[1] ;
+ thinfo.pid = pid ;
e = pthread_attr_init(&attr) ;
if (e) { errno = e ; strerr_diefu1sys(111, "pthread_attr_init") ; }
pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN) ;
- e = pthread_create(th, &attr, &keventwait, &t) ;
+ e = pthread_create(th, &attr, &keventwait, &thinfo) ;
if (e) { errno = e ; strerr_diefu1sys(111, "pthread_create") ; }
*fd = p[0] ;
}