Adjust OpenBSD code to set the process state to be less wrong. (#4579)

Use the p_stat of the main thread to decide in which state the process is.
For multi-threaded applications this is still not quite correct but at
least this compiles on OpenBSD-current.

See also 5d4f90ee10

Fix for #4576
This commit is contained in:
Claudio Jeker 2024-07-28 12:05:46 +02:00 committed by GitHub
parent 2b4aa5351e
commit 0ef349398e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -218,16 +218,19 @@ RzDebugInfo *bsd_info(RzDebug *dbg, const char *arg) {
rdi->gid = kp->p__pgid;
rdi->exe = strdup(kp->p_comm);
rdi->status = RZ_DBG_PROC_STOP;
if (kp->p_psflags & PS_ZOMBIE) {
rdi->status = RZ_DBG_PROC_ZOMBIE;
} else if (kp->p_psflags & PS_STOPPED) {
switch (kp->p_stat) {
case SDEAD:
rdi->status = RZ_DBG_PROC_DEAD;
break;
case SSTOP:
rdi->status = RZ_DBG_PROC_STOP;
} else if (kp->p_psflags & PS_PPWAIT) {
break;
case SSLEEP:
rdi->status = RZ_DBG_PROC_SLEEP;
} else if ((kp->p_psflags & PS_EXEC) || (kp->p_psflags & PS_INEXEC)) {
break;
default:
rdi->status = RZ_DBG_PROC_RUN;
break;
}
}