--- freem/src/jobtab.c 2025/05/01 21:02:31 1.9 +++ freem/src/jobtab.c 2025/05/12 18:18:00 1.10 @@ -1,5 +1,5 @@ /* - * $Id: jobtab.c,v 1.9 2025/05/01 21:02:31 snw Exp $ + * $Id: jobtab.c,v 1.10 2025/05/12 18:18:00 snw Exp $ * job table implementation * * @@ -24,6 +24,9 @@ * along with FreeM. If not, see . * * $Log: jobtab.c,v $ + * Revision 1.10 2025/05/12 18:18:00 snw + * Further work on shared memory + * * Revision 1.9 2025/05/01 21:02:31 snw * Documentation updates * @@ -155,7 +158,7 @@ job_slot_t *job_init(short is_fmadm) logprintf (FM_LOG_FATAL, "job_init: failed to get job table semaphore"); } - for (s = shm_config->hdr->jobtab_head; s != NULL; s = s->next) { + for (s = SOA(shm_config->hdr->jobtab_head); s != NULL; s = SOA(s->next)) { if (((s->flags & JFLG_DEFUNCT) == JFLG_DEFUNCT) || (s->pid == pid)) { goto skip_alloc; @@ -187,8 +190,8 @@ skip_alloc: } } - s->next = shm_config->hdr->jobtab_head; - shm_config->hdr->jobtab_head = s; + s->next = SBM(shm_config->hdr->jobtab_head); + shm_config->hdr->jobtab_head = SBM(s); jobtab_release_sem (); @@ -199,17 +202,16 @@ skip_alloc: void job_remove(const pid_t pid) { - job_slot_t *t = shm_config->hdr->jobtab_head; + job_slot_t *t = SOM(shm_config->hdr->jobtab_head); job_slot_t *p = NULL; if (jobtab_get_sem () == FALSE) { logprintf (FM_LOG_FATAL, "job_remove: failed to get job table semaphore"); - exit (1); } if ((t != (job_slot_t *) NULL) && (t->pid == pid)) { - shm_config->hdr->jobtab_head = t->next; + shm_config->hdr->jobtab_head = SBM(t->next); shm_free (t); jobtab_release_sem (); @@ -220,7 +222,7 @@ void job_remove(const pid_t pid) while ((t != NULL) && (t->pid != pid)) { p = t; - t = t->next; + t = SBA(t->next); } if (t == NULL) { @@ -228,7 +230,7 @@ void job_remove(const pid_t pid) return; } - p->next = t->next; + p->next = SBA(t->next); shm_free (t); jobtab_release_sem (); @@ -245,7 +247,7 @@ void job_request_stop(const pid_t target logprintf (FM_LOG_FATAL, "job_request_stop: failed to get job table semaphore"); } - for (s = shm_config->hdr->jobtab_head; s != NULL; s = s->next) { + for (s = SOA(shm_config->hdr->jobtab_head); s != NULL; s = SOA(s->next)) { if (s->pid == target_pid) { s->stop_requested = pid;