Diff for /freem/src/jobtab.c between versions 1.7 and 1.10

version 1.7, 2025/04/17 00:34:04 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
    *   Work on entryref parser
    *
  *   Revision 1.7  2025/04/17 00:34:04  snw   *   Revision 1.7  2025/04/17 00:34:04  snw
  *   More logging improvements   *   More logging improvements
  *   *
Line 120  short jobtab_get_sem(void) Line 129  short jobtab_get_sem(void)
             return TRUE;              return TRUE;
         }          }
   
         logprintf (FM_LOG_WARNING, "jobtab_get_sem:  sleeping for retry [tries = %d]", tries);          logprintf (FM_LOG_INFO, "jobtab_get_sem:  sleeping for retry [tries = %d]", tries);
         sleep (1);          sleep (1);
   
     }      }
Line 149  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 181  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 193  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 214  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 222  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 238  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;

Removed from v.1.7  
changed lines
  Added in v.1.10


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>