|
|
| version 1.8, 2025/04/30 20:03:09 | version 1.10, 2025/05/12 18:18:00 |
|---|---|
| Line 24 | Line 24 |
| * along with FreeM. If not, see <https://www.gnu.org/licenses/>. | * along with FreeM. If not, see <https://www.gnu.org/licenses/>. |
| * | * |
| * $Log$ | * $Log$ |
| * 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 | |
| * | |
| * Revision 1.8 2025/04/30 20:03:09 snw | * Revision 1.8 2025/04/30 20:03:09 snw |
| * Work on entryref parser | * Work on entryref parser |
| * | * |
| Line 152 job_slot_t *job_init(short is_fmadm) | Line 158 job_slot_t *job_init(short is_fmadm) |
| logprintf (FM_LOG_FATAL, "job_init: failed to get job table semaphore"); | 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)) { | if (((s->flags & JFLG_DEFUNCT) == JFLG_DEFUNCT) || (s->pid == pid)) { |
| goto skip_alloc; | goto skip_alloc; |
| Line 184 skip_alloc: | Line 190 skip_alloc: |
| } | } |
| } | } |
| s->next = shm_config->hdr->jobtab_head; | s->next = SBM(shm_config->hdr->jobtab_head); |
| shm_config->hdr->jobtab_head = s; | shm_config->hdr->jobtab_head = SBM(s); |
| jobtab_release_sem (); | jobtab_release_sem (); |
| Line 196 skip_alloc: | Line 202 skip_alloc: |
| void job_remove(const pid_t pid) | 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; | job_slot_t *p = NULL; |
| if (jobtab_get_sem () == FALSE) { | if (jobtab_get_sem () == FALSE) { |
| logprintf (FM_LOG_FATAL, "job_remove: failed to get job table semaphore"); | logprintf (FM_LOG_FATAL, "job_remove: failed to get job table semaphore"); |
| exit (1); | |
| } | } |
| if ((t != (job_slot_t *) NULL) && (t->pid == pid)) { | 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); | shm_free (t); |
| jobtab_release_sem (); | jobtab_release_sem (); |
| Line 217 void job_remove(const pid_t pid) | Line 222 void job_remove(const pid_t pid) |
| while ((t != NULL) && (t->pid != pid)) { | while ((t != NULL) && (t->pid != pid)) { |
| p = t; | p = t; |
| t = t->next; | t = SBA(t->next); |
| } | } |
| if (t == NULL) { | if (t == NULL) { |
| Line 225 void job_remove(const pid_t pid) | Line 230 void job_remove(const pid_t pid) |
| return; | return; |
| } | } |
| p->next = t->next; | p->next = SBA(t->next); |
| shm_free (t); | shm_free (t); |
| jobtab_release_sem (); | jobtab_release_sem (); |
| locktab_unlock_all_by_pid (pid); | |
| } | } |
| void job_request_stop(const pid_t target_pid) | void job_request_stop(const pid_t target_pid) |
| Line 241 void job_request_stop(const pid_t target | Line 247 void job_request_stop(const pid_t target |
| logprintf (FM_LOG_FATAL, "job_request_stop: failed to get job table semaphore"); | 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) { | if (s->pid == target_pid) { |
| s->stop_requested = pid; | s->stop_requested = pid; |