From 42a0bed351979cb4a59c641fa5f03e49609561fd Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 30 Mar 2022 16:36:31 +0900 Subject: Prefix ccan headers (#4568) * Prefixed ccan headers * Remove unprefixed names in ccan/build_assert * Remove unprefixed names in ccan/check_type * Remove unprefixed names in ccan/container_of * Remove unprefixed names in ccan/list Co-authored-by: Samuel Williams --- process.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'process.c') diff --git a/process.c b/process.c index 2282fc92dc..da663f9765 100644 --- a/process.c +++ b/process.c @@ -1076,7 +1076,7 @@ do_waitpid(rb_pid_t pid, int *st, int flags) #define WAITPID_LOCK_ONLY ((struct waitpid_state *)-1) struct waitpid_state { - struct list_node wnode; + struct ccan_list_node wnode; rb_execution_context_t *ec; rb_nativethread_cond_t *cond; rb_pid_t ret; @@ -1110,12 +1110,12 @@ waitpid_signal(struct waitpid_state *w) // Used for VM memsize reporting. Returns the size of a list of waitpid_state // structs. Defined here because the struct definition lives here as well. size_t -rb_vm_memsize_waiting_list(struct list_head *waiting_list) +rb_vm_memsize_waiting_list(struct ccan_list_head *waiting_list) { struct waitpid_state *waitpid = 0; size_t size = 0; - list_for_each(waiting_list, waitpid, wnode) { + ccan_list_for_each(waiting_list, waitpid, wnode) { size += sizeof(struct waitpid_state); } @@ -1132,10 +1132,10 @@ sigwait_fd_migrate_sleeper(rb_vm_t *vm) { struct waitpid_state *w = 0; - list_for_each(&vm->waiting_pids, w, wnode) { + ccan_list_for_each(&vm->waiting_pids, w, wnode) { if (waitpid_signal(w)) return; } - list_for_each(&vm->waiting_grps, w, wnode) { + ccan_list_for_each(&vm->waiting_grps, w, wnode) { if (waitpid_signal(w)) return; } } @@ -1152,18 +1152,18 @@ rb_sigwait_fd_migrate(rb_vm_t *vm) extern volatile unsigned int ruby_nocldwait; /* signal.c */ /* called by timer thread or thread which acquired sigwait_fd */ static void -waitpid_each(struct list_head *head) +waitpid_each(struct ccan_list_head *head) { struct waitpid_state *w = 0, *next; - list_for_each_safe(head, w, next, wnode) { + ccan_list_for_each_safe(head, w, next, wnode) { rb_pid_t ret = do_waitpid(w->pid, &w->status, w->options | WNOHANG); if (!ret) continue; if (ret == -1) w->errnum = errno; w->ret = ret; - list_del_init(&w->wnode); + ccan_list_del_init(&w->wnode); waitpid_signal(w); } } @@ -1177,11 +1177,11 @@ ruby_waitpid_all(rb_vm_t *vm) #if RUBY_SIGCHLD rb_native_mutex_lock(&vm->waitpid_lock); waitpid_each(&vm->waiting_pids); - if (list_empty(&vm->waiting_pids)) { + if (ccan_list_empty(&vm->waiting_pids)) { waitpid_each(&vm->waiting_grps); } /* emulate SA_NOCLDWAIT */ - if (list_empty(&vm->waiting_pids) && list_empty(&vm->waiting_grps)) { + if (ccan_list_empty(&vm->waiting_pids) && ccan_list_empty(&vm->waiting_grps)) { while (ruby_nocldwait && do_waitpid(-1, 0, WNOHANG) > 0) ; /* keep looping */ } @@ -1222,7 +1222,7 @@ ruby_waitpid_locked(rb_vm_t *vm, rb_pid_t pid, int *status, int options, assert(!ruby_thread_has_gvl_p() && "must not have GVL"); waitpid_state_init(&w, pid, options); - if (w.pid > 0 || list_empty(&vm->waiting_pids)) + if (w.pid > 0 || ccan_list_empty(&vm->waiting_pids)) w.ret = do_waitpid(w.pid, &w.status, w.options | WNOHANG); if (w.ret) { if (w.ret == -1) w.errnum = errno; @@ -1231,7 +1231,7 @@ ruby_waitpid_locked(rb_vm_t *vm, rb_pid_t pid, int *status, int options, int sigwait_fd = -1; w.ec = 0; - list_add(w.pid > 0 ? &vm->waiting_pids : &vm->waiting_grps, &w.wnode); + ccan_list_add(w.pid > 0 ? &vm->waiting_pids : &vm->waiting_grps, &w.wnode); do { if (sigwait_fd < 0) sigwait_fd = rb_sigwait_fd_get(0); @@ -1247,7 +1247,7 @@ ruby_waitpid_locked(rb_vm_t *vm, rb_pid_t pid, int *status, int options, rb_native_cond_wait(w.cond, &vm->waitpid_lock); } } while (!w.ret); - list_del(&w.wnode); + ccan_list_del(&w.wnode); /* we're done, maybe other waitpid callers are not: */ if (sigwait_fd >= 0) { @@ -1280,14 +1280,14 @@ waitpid_cleanup(VALUE x) struct waitpid_state *w = (struct waitpid_state *)x; /* - * XXX w->ret is sometimes set but list_del is still needed, here, - * Not sure why, so we unconditionally do list_del here: + * XXX w->ret is sometimes set but ccan_list_del is still needed, here, + * Not sure why, so we unconditionally do ccan_list_del here: */ if (TRUE || w->ret == 0) { rb_vm_t *vm = rb_ec_vm_ptr(w->ec); rb_native_mutex_lock(&vm->waitpid_lock); - list_del(&w->wnode); + ccan_list_del(&w->wnode); rb_native_mutex_unlock(&vm->waitpid_lock); } @@ -1307,7 +1307,7 @@ waitpid_wait(struct waitpid_state *w) */ rb_native_mutex_lock(&vm->waitpid_lock); - if (w->pid > 0 || list_empty(&vm->waiting_pids)) { + if (w->pid > 0 || ccan_list_empty(&vm->waiting_pids)) { w->ret = do_waitpid(w->pid, &w->status, w->options | WNOHANG); } @@ -1323,7 +1323,7 @@ waitpid_wait(struct waitpid_state *w) if (need_sleep) { w->cond = 0; /* order matters, favor specified PIDs rather than -1 or 0 */ - list_add(w->pid > 0 ? &vm->waiting_pids : &vm->waiting_grps, &w->wnode); + ccan_list_add(w->pid > 0 ? &vm->waiting_pids : &vm->waiting_grps, &w->wnode); } rb_native_mutex_unlock(&vm->waitpid_lock); @@ -4229,7 +4229,7 @@ retry_fork_async_signal_safe(struct rb_process_status *status, int *ep, if (waitpid_lock) { if (pid > 0 && w != WAITPID_LOCK_ONLY) { w->pid = pid; - list_add(&GET_VM()->waiting_pids, &w->wnode); + ccan_list_add(&GET_VM()->waiting_pids, &w->wnode); } rb_native_mutex_unlock(waitpid_lock); } -- cgit v1.2.1