• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/bash-92/bash-3.2/

Lines Matching defs:js

157 struct jobstats js = { -1L, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NO_JOB, NO_JOB, 0, 0 };
348 js = zerojs;
493 if (js.j_jobslots == 0)
495 js.j_jobslots = JOB_SLOTS;
496 jobs = (JOB **)xmalloc (js.j_jobslots * sizeof (JOB *));
499 for (i = 0; i < js.j_jobslots; i++)
502 js.j_firstj = js.j_lastj = js.j_njobs = 0;
510 for (i = js.j_jobslots; i; i--)
518 for (i = js.j_lastj+1; i != js.j_lastj; i++)
520 if (i >= js.j_jobslots)
525 if (i == js.j_lastj)
526 i = js.j_jobslots;
529 for (i = js.j_lastj ? js.j_lastj + 1 : js.j_lastj; i < js.j_jobslots; i++)
538 if ((interactive_shell == 0 || subshell_environment) && i == js.j_jobslots && js.j_jobslots >= MAX_JOBS_IN_ARRAY)
542 if (i == js.j_jobslots)
544 js.j_jobslots += JOB_SLOTS;
545 jobs = (JOB **)xrealloc (jobs, (js.j_jobslots * sizeof (JOB *)));
547 for (j = i; j < js.j_jobslots; j++)
600 js.c_reaped += n; /* wouldn't have been done since this was not part of a job */
601 js.j_ndead++;
603 js.c_injobs += n;
605 js.j_lastj = i;
606 js.j_njobs++;
612 js.j_lastmade = newjob;
620 js.j_lastasync = newjob;
648 return (js.j_current);
689 if (bgpids.npid > js.c_childmax)
766 while (bgpids.npid > js.c_childmax)
775 /* Reset the values of js.j_lastj and js.j_firstj after one or both have
776 been deleted. The caller should check whether js.j_njobs is 0 before
784 if (jobs[js.j_firstj] == 0)
786 old = js.j_firstj++;
787 if (old >= js.j_jobslots)
788 old = js.j_jobslots - 1;
789 while (js.j_firstj != old)
791 if (js.j_firstj >= js.j_jobslots)
792 js.j_firstj = 0;
793 if (jobs[js.j_firstj] || js.j_firstj == old) /* needed if old == 0 */
795 js.j_firstj++;
797 if (js.j_firstj == old)
798 js.j_firstj = js.j_lastj = js.j_njobs = 0;
800 if (jobs[js.j_lastj] == 0)
802 old = js.j_lastj--;
805 while (js.j_lastj != old)
807 if (js.j_lastj < 0)
808 js.j_lastj = js.j_jobslots - 1;
809 if (jobs[js.j_lastj] || js.j_lastj == old) /* needed if old == js.j_jobslots */
811 js.j_lastj--;
813 if (js.j_lastj == old)
814 js.j_firstj = js.j_lastj = js.j_njobs = 0;
825 if (js.j_jobslots == 0 || jobs_list_frozen)
830 /* XXX could use js.j_firstj and js.j_lastj here */
831 for (i = 0; i < js.j_jobslots; i++)
834 if (i < js.j_firstj && jobs[i])
835 itrace("cleanup_dead_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
836 if (i > js.j_lastj && jobs[i])
837 itrace("cleanup_dead_jobs: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
900 nsize = ((js.j_njobs + JOB_SLOTS - 1) / JOB_SLOTS);
902 i = js.j_njobs % JOB_SLOTS;
907 nlist = (js.j_jobslots == nsize) ? jobs : (JOB **) xmalloc (nsize * sizeof (JOB *));
909 for (i = j = 0; i < js.j_jobslots; i++)
912 if (i == js.j_current)
914 if (i == js.j_previous)
920 itrace ("realloc_jobs_list: resize jobs list from %d to %d", js.j_jobslots, nsize);
921 itrace ("realloc_jobs_list: j_lastj changed from %d to %d", js.j_lastj, (j > 0) ? j - 1 : 0);
922 itrace ("realloc_jobs_list: j_njobs changed from %d to %d", js.j_njobs, (j > 0) ? j - 1 : 0);
925 js.j_firstj = 0;
926 js.j_lastj = (j > 0) ? j - 1 : 0;
927 js.j_njobs = j;
928 js.j_jobslots = nsize;
941 js.j_current = ncur;
943 js.j_previous = nprev;
946 if (js.j_current == NO_JOB || js.j_previous == NO_JOB || js.j_current > js.j_lastj || js.j_previous > js.j_lastj)
950 itrace ("realloc_jobs_list: reset js.j_current (%d) and js.j_previous (%d)", js.j_current, js.j_previous);
959 available slot in the compacted list. If that value is js.j_jobslots, then
961 this returns > 0 and < js.j_jobslots. FLAGS is reserved for future use. */
966 if (js.j_jobslots == 0 || jobs_list_frozen)
967 return js.j_jobslots;
973 itrace("compact_jobs_list: returning %d", (js.j_lastj || jobs[js.j_lastj]) ? js.j_lastj + 1 : 0);
976 return ((js.j_lastj || jobs[js.j_lastj]) ? js.j_lastj + 1 : 0);
989 if (js.j_jobslots == 0 || jobs_list_frozen)
1007 if (temp == js.j_lastmade)
1008 js.j_lastmade = 0;
1009 else if (temp == js.j_lastasync)
1010 js.j_lastasync = 0;
1015 js.c_injobs -= ndel;
1018 js.c_reaped -= ndel;
1019 js.j_ndead--;
1020 if (js.c_reaped < 0)
1023 itrace("delete_job (%d pgrp %d): js.c_reaped (%d) < 0 ndel = %d js.j_ndead = %d", job_index, temp->pgrp, js.c_reaped, ndel, js.j_ndead);
1025 js.c_reaped = 0;
1034 js.j_njobs--;
1035 if (js.j_njobs == 0)
1036 js.j_firstj = js.j_lastj = 0;
1037 else if (jobs[js.j_firstj] == 0 || jobs[js.j_lastj] == 0)
1040 if (job_index == js.j_current || job_index == js.j_previous)
1051 if (js.j_jobslots == 0)
1176 if (js.j_jobslots == 0)
1181 /* XXX could use js.j_firstj here */
1182 for (i = result = 0; i < js.j_jobslots; i++)
1185 if (i < js.j_firstj && jobs[i])
1186 itrace("map_over_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
1187 if (i > js.j_lastj && jobs[i])
1188 itrace("map_over_jobs: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
1220 /* XXX could use js.j_firstj here */
1221 for (i = 0; i < js.j_jobslots; i++)
1238 /* XXX could use js.j_firstj here */
1239 for (i = 0; i < js.j_jobslots; i++)
1322 /* XXX could use js.j_firstj here, and should check js.j_lastj */
1323 for (i = 0; i < js.j_jobslots; i++)
1326 if (i < js.j_firstj && jobs[i])
1327 itrace("find_job: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
1328 if (i > js.j_lastj && jobs[i])
1329 itrace("find_job: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
1604 (job_index == js.j_current) ? '+':
1605 (job_index == js.j_previous) ? '-' : ' ');
1844 if ((js.c_reaped + bgpids.npid) >= js.c_childmax)
1851 js.c_totforked++;
1852 js.c_living++;
2109 /* XXX could use js.j_firstj and js.j_lastj here */
2110 for (i = 0; i < js.j_jobslots; i++)
2113 if (i < js.j_firstj && jobs[i])
2114 itrace("wait_for_background_pids: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
2115 if (i > js.j_lastj && jobs[i])
2116 itrace("wait_for_background_pids: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
2121 if (i == js.j_jobslots)
2404 js.c_living = 0; /* no living child processes */
2408 js.c_reaped++;
2409 js.j_ndead++;
2486 if (check_window_size && (job == js.j_current || IS_FOREGROUND (job)))
2661 if (js.j_current != job)
2663 js.j_previous = js.j_current;
2664 js.j_current = job;
2668 if (js.j_previous != js.j_current &&
2669 js.j_previous != NO_JOB &&
2670 jobs[js.j_previous] &&
2671 STOPPED (js.j_previous))
2677 if (STOPPED (js.j_current))
2679 candidate = job_last_stopped (js.j_current);
2683 js.j_previous = candidate;
2692 alternative to use based on whether or not JOBSTATE(js.j_current) is
2695 candidate = RUNNING (js.j_current) ? job_last_running (js.j_current)
2696 : job_last_running (js.j_jobslots);
2700 js.j_previous = candidate;
2705 js.j_previous = js.j_current;
2712 stopped job, the js.j_previous is the newest non-running job. If there
2721 if (js.j_jobslots && js.j_current != NO_JOB && jobs[js.j_current] && STOPPED (js.j_current))
2722 candidate = js.j_current;
2728 if (js.j_previous != NO_JOB && jobs[js.j_previous] && STOPPED (js.j_previous))
2729 candidate = js.j_previous;
2733 candidate = job_last_stopped (js.j_jobslots);
2737 candidate = job_last_running (js.j_jobslots);
2745 js.j_current = js.j_previous = NO_JOB;
2822 s = (job == js.j_current) ? "+ ": ((job == js.j_previous) ? "- " : " ");
3050 js.c_living--;
3069 js.c_totreaped++;
3071 js.c_reaped++;
3182 js.j_ndead++;
3372 if (jobs == 0 || js.j_jobslots == 0)
3386 /* XXX could use js.j_firstj here */
3387 for (job = 0, dir = (char *)NULL; job < js.j_jobslots; job++)
3602 if (js.c_childmax < 0)
3603 js.c_childmax = getmaxchild ();
3604 if (js.c_childmax < 0)
3605 js.c_childmax = DEFAULT_CHILD_MAX;
3781 if (js.j_jobslots)
3783 js.j_current = js.j_previous = NO_JOB;
3785 /* XXX could use js.j_firstj here */
3786 for (i = 0; i < js.j_jobslots; i++)
3789 if (i < js.j_firstj && jobs[i])
3790 itrace("delete_all_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
3791 if (i > js.j_lastj && jobs[i])
3792 itrace("delete_all_jobs: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
3800 js.j_jobslots = 0;
3801 js.j_firstj = js.j_lastj = js.j_njobs = 0;
3822 if (js.j_jobslots)
3824 /* XXX could use js.j_firstj here */
3825 for (i = 0; i < js.j_jobslots; i++)
3841 /* XXX could use js.j_firstj here */
3842 for (i = n = 0; i < js.j_jobslots; i++)
3845 if (i < js.j_firstj && jobs[i])
3846 itrace("count_all_jobs: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
3847 if (i > js.j_lastj && jobs[i])
3848 itrace("count_all_jobs: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
3863 if (js.j_jobslots == 0)
3868 /* XXX could use js.j_firstj here */
3869 for (i = 0; i < js.j_jobslots; i++)
3873 js.j_ndead++;
3890 if (js.j_jobslots == 0)
3899 /* XXX could use js.j_firstj here */
3900 for (i = 0; i < js.j_jobslots; i++)
3916 /* XXX could use js.j_firstj here */
3917 for (i = ndead = ndeadproc = 0; i < js.j_jobslots; i++)
3920 if (i < js.j_firstj && jobs[i])
3921 itrace("mark_dead_jobs_as_notified: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
3922 if (i > js.j_lastj && jobs[i])
3923 itrace("mark_dead_jobs_as_notified: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
3933 if (ndeadproc != js.c_reaped)
3934 itrace("mark_dead_jobs_as_notified: ndeadproc (%d) != js.c_reaped (%d)", ndeadproc, js.c_reaped);
3935 if (ndead != js.j_ndead)
3936 itrace("mark_dead_jobs_as_notified: ndead (%d) != js.j_ndead (%d)", ndead, js.j_ndead);
3939 if (js.c_childmax < 0)
3940 js.c_childmax = getmaxchild ();
3941 if (js.c_childmax < 0)
3942 js.c_childmax = DEFAULT_CHILD_MAX;
3946 if (ndeadproc <= js.c_childmax)
3953 itrace("mark_dead_jobs_as_notified: child_max = %d ndead = %d ndeadproc = %d", js.c_childmax, ndead, ndeadproc);
3963 size of jobs array (js.j_jobslots) and running count of number of jobs
3967 /* XXX could use js.j_firstj here */
3968 for (i = 0; i < js.j_jobslots; i++)
3973 if (i < js.j_firstj && jobs[i])
3974 itrace("mark_dead_jobs_as_notified: job %d non-null before js.j_firstj (%d)", i, js.j_firstj);
3975 if (i > js.j_lastj && jobs[i])
3976 itrace("mark_dead_jobs_as_notified: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
3982 if ((ndeadproc -= processes_in_job (i)) <= js.c_childmax)