On 6/22/21 20:00, Gabriel Ivăncescu wrote:
+static data_size_t query_job_pids( struct job *job, data_size_t count, data_size_t maxcount, process_id_t *pids ) +{
- struct process *process;
- struct job *j;
- LIST_FOR_EACH_ENTRY( process, &job->process_list, struct process, job_entry )
- {
if (process->end_time) continue;
if (count < maxcount) pids[count] = process->id;
count++;
- }
- LIST_FOR_EACH_ENTRY( j, &job->child_job_list, struct job, parent_job_entry )
count = query_job_pids( j, count, maxcount, pids );
- return count;
+}
The other job enumerations (for terminating jobs and sending completions) do it for children first on then for parent. Do you know that this should not be the case for job pids? I don't know if the pid sort order is important for anything or consistent on Windows, but if not testing the order explicitly I'd suggest to enumerate in the same order as in the other places.