|
Lines 674-679
Link Here
|
| 674 |
int error, status; |
674 |
int error, status; |
| 675 |
|
675 |
|
| 676 |
error = kern_wait(td, WAIT_ANY, &status, 0, NULL); |
676 |
error = kern_wait(td, WAIT_ANY, &status, 0, NULL); |
|
|
677 |
|
| 677 |
if (error == 0) |
678 |
if (error == 0) |
| 678 |
td->td_retval[1] = status; |
679 |
td->td_retval[1] = status; |
| 679 |
return (error); |
680 |
return (error); |
|
Lines 684-690
Link Here
|
| 684 |
* The dirty work is handled by kern_wait(). |
685 |
* The dirty work is handled by kern_wait(). |
| 685 |
*/ |
686 |
*/ |
| 686 |
int |
687 |
int |
| 687 |
sys_wait4(struct thread *td, struct wait_args *uap) |
688 |
sys_wait4(struct thread *td, struct wait4_args *uap) |
| 688 |
{ |
689 |
{ |
| 689 |
struct rusage ru, *rup; |
690 |
struct rusage ru, *rup; |
| 690 |
int error, status; |
691 |
int error, status; |
|
Lines 693-703
Link Here
|
| 693 |
rup = &ru; |
694 |
rup = &ru; |
| 694 |
else |
695 |
else |
| 695 |
rup = NULL; |
696 |
rup = NULL; |
|
|
697 |
|
| 696 |
error = kern_wait(td, uap->pid, &status, uap->options, rup); |
698 |
error = kern_wait(td, uap->pid, &status, uap->options, rup); |
|
|
699 |
|
| 700 |
if (uap->status != NULL && error == 0) |
| 701 |
error = copyout(&status, uap->status, sizeof(status)); |
| 702 |
if (uap->rusage != NULL && error == 0) |
| 703 |
error = copyout(&ru, uap->rusage, sizeof(struct rusage)); |
| 704 |
return (error); |
| 705 |
} |
| 706 |
|
| 707 |
int |
| 708 |
sys_wait6(struct thread *td, struct wait6_args *uap) |
| 709 |
{ |
| 710 |
struct rusage ru, *rup; |
| 711 |
siginfo_t si, *sip; |
| 712 |
int error, status; |
| 713 |
idtype_t idtype; |
| 714 |
id_t id; |
| 715 |
|
| 716 |
idtype = uap->idtype; |
| 717 |
id = uap->id; |
| 718 |
|
| 719 |
if (uap->rusage != NULL) |
| 720 |
rup = &ru; |
| 721 |
else |
| 722 |
rup = NULL; |
| 723 |
|
| 724 |
if (uap->info != NULL) |
| 725 |
sip = &si; |
| 726 |
else |
| 727 |
sip = NULL; |
| 728 |
|
| 729 |
/* |
| 730 |
* We expect all callers of wait6() |
| 731 |
* to know about WEXITED and WTRAPPED! |
| 732 |
*/ |
| 733 |
error = kern_wait6(td, idtype, id, &status, uap->options, rup, sip); |
| 734 |
|
| 697 |
if (uap->status != NULL && error == 0) |
735 |
if (uap->status != NULL && error == 0) |
| 698 |
error = copyout(&status, uap->status, sizeof(status)); |
736 |
error = copyout(&status, uap->status, sizeof(status)); |
| 699 |
if (uap->rusage != NULL && error == 0) |
737 |
if (uap->rusage != NULL && error == 0) |
| 700 |
error = copyout(&ru, uap->rusage, sizeof(struct rusage)); |
738 |
error = copyout(&ru, uap->rusage, sizeof(struct rusage)); |
|
|
739 |
if (uap->info != NULL && error == 0) |
| 740 |
error = copyout(&si, uap->info, sizeof(siginfo_t)); |
| 701 |
return (error); |
741 |
return (error); |
| 702 |
} |
742 |
} |
| 703 |
|
743 |
|
|
Lines 707-714
Link Here
|
| 707 |
* lock as part of its work. |
747 |
* lock as part of its work. |
| 708 |
*/ |
748 |
*/ |
| 709 |
void |
749 |
void |
| 710 |
proc_reap(struct thread *td, struct proc *p, int *status, int options, |
750 |
proc_reap(struct thread *td, struct proc *p, int *status, int options) |
| 711 |
struct rusage *rusage) |
|
|
| 712 |
{ |
751 |
{ |
| 713 |
struct proc *q, *t; |
752 |
struct proc *q, *t; |
| 714 |
|
753 |
|
|
Lines 718-727
Link Here
|
| 718 |
KASSERT(p->p_state == PRS_ZOMBIE, ("proc_reap: !PRS_ZOMBIE")); |
757 |
KASSERT(p->p_state == PRS_ZOMBIE, ("proc_reap: !PRS_ZOMBIE")); |
| 719 |
|
758 |
|
| 720 |
q = td->td_proc; |
759 |
q = td->td_proc; |
| 721 |
if (rusage) { |
760 |
|
| 722 |
*rusage = p->p_ru; |
|
|
| 723 |
calcru(p, &rusage->ru_utime, &rusage->ru_stime); |
| 724 |
} |
| 725 |
PROC_SUNLOCK(p); |
761 |
PROC_SUNLOCK(p); |
| 726 |
td->td_retval[0] = p->p_pid; |
762 |
td->td_retval[0] = p->p_pid; |
| 727 |
if (status) |
763 |
if (status) |
|
Lines 834-841
Link Here
|
| 834 |
} |
870 |
} |
| 835 |
|
871 |
|
| 836 |
static int |
872 |
static int |
| 837 |
proc_to_reap(struct thread *td, struct proc *p, pid_t pid, int *status, |
873 |
proc_to_reap(struct thread *td, struct proc *p, |
| 838 |
int options, struct rusage *rusage) |
874 |
idtype_t idtype, id_t id, |
|
|
875 |
int *status, int options, |
| 876 |
struct rusage *rusage, siginfo_t *siginfo) |
| 839 |
{ |
877 |
{ |
| 840 |
struct proc *q; |
878 |
struct proc *q; |
| 841 |
|
879 |
|
|
Lines 843-857
Link Here
|
| 843 |
|
881 |
|
| 844 |
q = td->td_proc; |
882 |
q = td->td_proc; |
| 845 |
PROC_LOCK(p); |
883 |
PROC_LOCK(p); |
| 846 |
if (pid != WAIT_ANY && p->p_pid != pid && p->p_pgid != -pid) { |
884 |
|
|
|
885 |
switch (idtype) { |
| 886 |
case P_ALL: |
| 887 |
break; |
| 888 |
|
| 889 |
case P_PID: |
| 890 |
if (p->p_pid != (pid_t) id) { |
| 891 |
PROC_UNLOCK(p); |
| 892 |
return (0); |
| 893 |
} |
| 894 |
break; |
| 895 |
|
| 896 |
case P_PGID: |
| 897 |
if (p->p_pgid != (pid_t) id) { |
| 898 |
PROC_UNLOCK(p); |
| 899 |
return (0); |
| 900 |
} |
| 901 |
break; |
| 902 |
|
| 903 |
case P_SID: |
| 904 |
if (p->p_session->s_sid != (pid_t) id) { |
| 905 |
PROC_UNLOCK(p); |
| 906 |
return (0); |
| 907 |
} |
| 908 |
break; |
| 909 |
|
| 910 |
case P_UID: |
| 911 |
if (p->p_ucred->cr_uid != (uid_t) id) { |
| 912 |
PROC_UNLOCK(p); |
| 913 |
return (0); |
| 914 |
} |
| 915 |
break; |
| 916 |
|
| 917 |
case P_GID: |
| 918 |
if (p->p_ucred->cr_gid != (gid_t) id) { |
| 919 |
PROC_UNLOCK(p); |
| 920 |
return (0); |
| 921 |
} |
| 922 |
break; |
| 923 |
|
| 924 |
case P_ZONEID: /* jail */ |
| 925 |
if (! p->p_ucred->cr_prison || |
| 926 |
(p->p_ucred->cr_prison->pr_id != (int) id)) { |
| 927 |
PROC_UNLOCK(p); |
| 928 |
return (0); |
| 929 |
} |
| 930 |
break; |
| 931 |
|
| 932 |
#if 0 |
| 933 |
/* |
| 934 |
* It seems that the thread structures get zeroed out |
| 935 |
* at process exit. |
| 936 |
* This makes toast of all useful info related to |
| 937 |
* CPU, CPU set, and scheduling priority class. |
| 938 |
*/ |
| 939 |
|
| 940 |
case P_PSETID: |
| 941 |
{ |
| 942 |
struct thread *td1; |
| 943 |
|
| 944 |
td1 = FIRST_THREAD_IN_PROC(p); |
| 945 |
if (td1->td_cpuset->cs_id != (cpusetid_t) id) { |
| 946 |
PROC_UNLOCK(p); |
| 947 |
return (0); |
| 948 |
} |
| 949 |
} |
| 950 |
break; |
| 951 |
|
| 952 |
case P_CID: |
| 953 |
{ |
| 954 |
struct thread *td1; |
| 955 |
|
| 956 |
td1 = FIRST_THREAD_IN_PROC(p); |
| 957 |
if (td1->td_pri_class != (unsigned) id) { |
| 958 |
PROC_UNLOCK(p); |
| 959 |
return (0); |
| 960 |
} |
| 961 |
} |
| 962 |
break; |
| 963 |
|
| 964 |
|
| 965 |
/* |
| 966 |
* Is there a good place for this? |
| 967 |
* Supposedly also zeroed before it can be used, right? |
| 968 |
*/ |
| 969 |
|
| 970 |
case P_CPUID: |
| 971 |
{ |
| 972 |
struct thread *td1; |
| 973 |
|
| 974 |
td1 = FIRST_THREAD_IN_PROC(p); |
| 975 |
if (td1->td_lastcpu != (unsigned) id) { |
| 976 |
PROC_UNLOCK(p); |
| 977 |
return (0); |
| 978 |
} |
| 979 |
} |
| 980 |
break; |
| 981 |
#endif |
| 982 |
|
| 983 |
default: |
| 847 |
PROC_UNLOCK(p); |
984 |
PROC_UNLOCK(p); |
| 848 |
return (0); |
985 |
return (0); |
|
|
986 |
break; |
| 849 |
} |
987 |
} |
|
|
988 |
|
| 850 |
if (p_canwait(td, p)) { |
989 |
if (p_canwait(td, p)) { |
| 851 |
PROC_UNLOCK(p); |
990 |
PROC_UNLOCK(p); |
| 852 |
return (0); |
991 |
return (0); |
| 853 |
} |
992 |
} |
| 854 |
|
993 |
|
|
|
994 |
if (((options & WEXITED) == 0) && (p->p_state == PRS_ZOMBIE)) { |
| 995 |
PROC_UNLOCK(p); |
| 996 |
return (0); |
| 997 |
} |
| 998 |
|
| 855 |
/* |
999 |
/* |
| 856 |
* This special case handles a kthread spawned by linux_clone |
1000 |
* This special case handles a kthread spawned by linux_clone |
| 857 |
* (see linux_misc.c). The linux_wait4 and linux_waitpid |
1001 |
* (see linux_misc.c). The linux_wait4 and linux_waitpid |
|
Lines 867-874
Link Here
|
| 867 |
} |
1011 |
} |
| 868 |
|
1012 |
|
| 869 |
PROC_SLOCK(p); |
1013 |
PROC_SLOCK(p); |
|
|
1014 |
|
| 1015 |
/* New siginfo stuff... */ |
| 1016 |
|
| 1017 |
if (siginfo) { |
| 1018 |
bzero (siginfo, sizeof (*siginfo)); |
| 1019 |
siginfo->si_signo = SIGCHLD; |
| 1020 |
siginfo->si_errno = 0; |
| 1021 |
|
| 1022 |
/* |
| 1023 |
* Right, this is still a rough estimate. |
| 1024 |
* We will fix the cases TRAPPED, STOPPED, |
| 1025 |
* and CONTINUED later. |
| 1026 |
*/ |
| 1027 |
|
| 1028 |
if (WCOREDUMP(p->p_xstat)) |
| 1029 |
siginfo->si_code = CLD_DUMPED; |
| 1030 |
else if (WIFSIGNALED(p->p_xstat)) |
| 1031 |
siginfo->si_code = CLD_KILLED; |
| 1032 |
else |
| 1033 |
siginfo->si_code = CLD_EXITED; |
| 1034 |
|
| 1035 |
siginfo->si_pid = p->p_pid; |
| 1036 |
siginfo->si_uid = p->p_ucred->cr_uid; |
| 1037 |
siginfo->si_status = p->p_xstat; |
| 1038 |
|
| 1039 |
/* |
| 1040 |
* The si_addr field would be useful |
| 1041 |
* additional detail, but apparently |
| 1042 |
* the PC value may be lost when we |
| 1043 |
* reach this point. |
| 1044 |
*/ |
| 1045 |
siginfo->si_addr = NULL; /* XXX */ |
| 1046 |
} |
| 1047 |
|
| 1048 |
/* |
| 1049 |
* There should be no reason to limit resources usage info |
| 1050 |
* to exited processes only. |
| 1051 |
* A snapshot about any resources used by a stopped process |
| 1052 |
* may be exactly what is needed. |
| 1053 |
* (1) Solaris limits available info to times only. |
| 1054 |
* (2) Linux does not declare any limitations. |
| 1055 |
* (3) Now within the same PROC_SLOCK anyway. |
| 1056 |
*/ |
| 1057 |
|
| 1058 |
if (rusage) { |
| 1059 |
*rusage = p->p_ru; |
| 1060 |
calcru(p, &rusage->ru_utime, &rusage->ru_stime); |
| 1061 |
} |
| 1062 |
|
| 870 |
if (p->p_state == PRS_ZOMBIE) { |
1063 |
if (p->p_state == PRS_ZOMBIE) { |
| 871 |
proc_reap(td, p, status, options, rusage); |
1064 |
proc_reap(td, p, status, options); |
| 872 |
return (-1); |
1065 |
return (-1); |
| 873 |
} |
1066 |
} |
| 874 |
PROC_SUNLOCK(p); |
1067 |
PROC_SUNLOCK(p); |
|
Lines 877-900
Link Here
|
| 877 |
} |
1070 |
} |
| 878 |
|
1071 |
|
| 879 |
int |
1072 |
int |
| 880 |
kern_wait(struct thread *td, pid_t pid, int *status, int options, |
1073 |
kern_wait(struct thread *td, pid_t pid, |
| 881 |
struct rusage *rusage) |
1074 |
int *status, int options, struct rusage *rusage) |
|
|
1075 |
{ |
| 1076 |
idtype_t idtype; |
| 1077 |
id_t id; |
| 1078 |
|
| 1079 |
if (pid == WAIT_ANY) { |
| 1080 |
idtype = P_ALL; |
| 1081 |
id = 0; |
| 1082 |
} |
| 1083 |
else if (pid <= 0) { |
| 1084 |
idtype = P_PGID; |
| 1085 |
id = (id_t) -pid; |
| 1086 |
} |
| 1087 |
else { |
| 1088 |
idtype = P_PID; |
| 1089 |
id = (id_t) pid; |
| 1090 |
} |
| 1091 |
|
| 1092 |
/* |
| 1093 |
* For backward compatibility we implicitly |
| 1094 |
* add flags WEXITED and WTRAPPED here. |
| 1095 |
*/ |
| 1096 |
|
| 1097 |
options |= (WEXITED | WTRAPPED); |
| 1098 |
|
| 1099 |
return (kern_wait6 (td, idtype, id, status, options, rusage, NULL)); |
| 1100 |
} |
| 1101 |
|
| 1102 |
int |
| 1103 |
kern_wait6(struct thread *td, idtype_t idtype, id_t id, |
| 1104 |
int *status, int options, |
| 1105 |
struct rusage *rusage, siginfo_t *siginfo) |
| 882 |
{ |
1106 |
{ |
| 883 |
struct proc *p, *q; |
1107 |
struct proc *p, *q; |
| 884 |
int error, nfound, ret; |
1108 |
int error, nfound, ret; |
| 885 |
|
1109 |
|
| 886 |
AUDIT_ARG_PID(pid); |
1110 |
#if 0 |
|
|
1111 |
AUDIT_ARG_VALUE((int) idtype); /* XXX - This is likely wrong! */ |
| 1112 |
#endif |
| 1113 |
AUDIT_ARG_PID((pid_t) id); /* XXX - This may be wrong! */ |
| 887 |
AUDIT_ARG_VALUE(options); |
1114 |
AUDIT_ARG_VALUE(options); |
| 888 |
|
1115 |
|
| 889 |
q = td->td_proc; |
1116 |
q = td->td_proc; |
| 890 |
if (pid == 0) { |
1117 |
|
|
|
1118 |
if (((pid_t) id == WAIT_MYPGRP) && |
| 1119 |
((idtype == P_PID) || (idtype == P_PGID))) { |
| 891 |
PROC_LOCK(q); |
1120 |
PROC_LOCK(q); |
| 892 |
pid = -q->p_pgid; |
1121 |
id = (id_t) q->p_pgid; |
| 893 |
PROC_UNLOCK(q); |
1122 |
PROC_UNLOCK(q); |
|
|
1123 |
idtype = P_PGID; |
| 894 |
} |
1124 |
} |
|
|
1125 |
|
| 895 |
/* If we don't know the option, just return. */ |
1126 |
/* If we don't know the option, just return. */ |
| 896 |
if (options & ~(WUNTRACED|WNOHANG|WCONTINUED|WNOWAIT|WLINUXCLONE)) |
1127 |
if (options & ~(WUNTRACED|WNOHANG|WCONTINUED|WNOWAIT|WEXITED|WTRAPPED|WLINUXCLONE)) |
| 897 |
return (EINVAL); |
1128 |
return (EINVAL); |
|
|
1129 |
|
| 1130 |
if ((options & (WEXITED|WUNTRACED|WCONTINUED|WTRAPPED)) == 0) { |
| 1131 |
/* |
| 1132 |
* We will be unable to find any matching processes, |
| 1133 |
* because there are no known events to look for. |
| 1134 |
* So, to tell the programmer (s)he is doing something |
| 1135 |
* patently dysfunctional, we return EINVAL. |
| 1136 |
*/ |
| 1137 |
if (siginfo) |
| 1138 |
bzero (siginfo, sizeof (*siginfo)); |
| 1139 |
td->td_retval[0] = -1; |
| 1140 |
return (EINVAL); |
| 1141 |
} |
| 1142 |
|
| 898 |
loop: |
1143 |
loop: |
| 899 |
if (q->p_flag & P_STATCHILD) { |
1144 |
if (q->p_flag & P_STATCHILD) { |
| 900 |
PROC_LOCK(q); |
1145 |
PROC_LOCK(q); |
|
Lines 904-910
Link Here
|
| 904 |
nfound = 0; |
1149 |
nfound = 0; |
| 905 |
sx_xlock(&proctree_lock); |
1150 |
sx_xlock(&proctree_lock); |
| 906 |
LIST_FOREACH(p, &q->p_children, p_sibling) { |
1151 |
LIST_FOREACH(p, &q->p_children, p_sibling) { |
| 907 |
ret = proc_to_reap(td, p, pid, status, options, rusage); |
1152 |
ret = proc_to_reap(td, p, idtype, id, |
|
|
1153 |
status, options, rusage, siginfo); |
| 908 |
if (ret == 0) |
1154 |
if (ret == 0) |
| 909 |
continue; |
1155 |
continue; |
| 910 |
else if (ret == 1) |
1156 |
else if (ret == 1) |
|
Lines 914-933
Link Here
|
| 914 |
|
1160 |
|
| 915 |
PROC_LOCK(p); |
1161 |
PROC_LOCK(p); |
| 916 |
PROC_SLOCK(p); |
1162 |
PROC_SLOCK(p); |
| 917 |
if ((p->p_flag & P_STOPPED_SIG) && |
1163 |
|
|
|
1164 |
if ((options & WTRAPPED) && |
| 1165 |
(p->p_flag & P_TRACED) && |
| 1166 |
(p->p_flag & (P_STOPPED_TRACE | P_STOPPED_SIG)) && |
| 918 |
(p->p_suspcount == p->p_numthreads) && |
1167 |
(p->p_suspcount == p->p_numthreads) && |
| 919 |
(p->p_flag & P_WAITED) == 0 && |
1168 |
((p->p_flag & P_WAITED) == 0)) { |
| 920 |
(p->p_flag & P_TRACED || options & WUNTRACED)) { |
|
|
| 921 |
PROC_SUNLOCK(p); |
1169 |
PROC_SUNLOCK(p); |
| 922 |
p->p_flag |= P_WAITED; |
1170 |
|
|
|
1171 |
if ((options & WNOWAIT) == 0) |
| 1172 |
p->p_flag |= P_WAITED; |
| 1173 |
|
| 923 |
sx_xunlock(&proctree_lock); |
1174 |
sx_xunlock(&proctree_lock); |
| 924 |
td->td_retval[0] = p->p_pid; |
1175 |
td->td_retval[0] = p->p_pid; |
|
|
1176 |
|
| 925 |
if (status) |
1177 |
if (status) |
| 926 |
*status = W_STOPCODE(p->p_xstat); |
1178 |
*status = W_STOPCODE(p->p_xstat); |
| 927 |
|
1179 |
|
| 928 |
PROC_LOCK(q); |
1180 |
if (siginfo) { |
| 929 |
sigqueue_take(p->p_ksi); |
1181 |
siginfo->si_status = W_STOPCODE(p->p_xstat); |
| 930 |
PROC_UNLOCK(q); |
1182 |
siginfo->si_code = CLD_TRAPPED; |
|
|
1183 |
} |
| 1184 |
|
| 1185 |
if ((options & WNOWAIT) == 0) { |
| 1186 |
PROC_LOCK(q); |
| 1187 |
sigqueue_take(p->p_ksi); |
| 1188 |
PROC_UNLOCK(q); |
| 1189 |
} |
| 1190 |
|
| 1191 |
PROC_UNLOCK(p); |
| 1192 |
|
| 1193 |
return (0); |
| 1194 |
} |
| 1195 |
|
| 1196 |
if ((options & WUNTRACED) && |
| 1197 |
(p->p_flag & P_STOPPED_SIG) && |
| 1198 |
(p->p_suspcount == p->p_numthreads) && |
| 1199 |
((p->p_flag & P_WAITED) == 0)) { |
| 1200 |
PROC_SUNLOCK(p); |
| 1201 |
|
| 1202 |
if ((options & WNOWAIT) == 0) |
| 1203 |
p->p_flag |= P_WAITED; |
| 1204 |
|
| 1205 |
sx_xunlock(&proctree_lock); |
| 1206 |
td->td_retval[0] = p->p_pid; |
| 1207 |
|
| 1208 |
if (status) |
| 1209 |
*status = W_STOPCODE(p->p_xstat); |
| 1210 |
|
| 1211 |
if (siginfo) { |
| 1212 |
siginfo->si_status = W_STOPCODE(p->p_xstat); |
| 1213 |
siginfo->si_code = CLD_STOPPED; |
| 1214 |
} |
| 1215 |
|
| 1216 |
if ((options & WNOWAIT) == 0) { |
| 1217 |
PROC_LOCK(q); |
| 1218 |
sigqueue_take(p->p_ksi); |
| 1219 |
PROC_UNLOCK(q); |
| 1220 |
} |
| 1221 |
|
| 931 |
PROC_UNLOCK(p); |
1222 |
PROC_UNLOCK(p); |
| 932 |
|
1223 |
|
| 933 |
return (0); |
1224 |
return (0); |
|
Lines 936-950
Link Here
|
| 936 |
if (options & WCONTINUED && (p->p_flag & P_CONTINUED)) { |
1227 |
if (options & WCONTINUED && (p->p_flag & P_CONTINUED)) { |
| 937 |
sx_xunlock(&proctree_lock); |
1228 |
sx_xunlock(&proctree_lock); |
| 938 |
td->td_retval[0] = p->p_pid; |
1229 |
td->td_retval[0] = p->p_pid; |
| 939 |
p->p_flag &= ~P_CONTINUED; |
|
|
| 940 |
|
1230 |
|
| 941 |
PROC_LOCK(q); |
1231 |
if ((options & WNOWAIT) == 0) { |
| 942 |
sigqueue_take(p->p_ksi); |
1232 |
p->p_flag &= ~P_CONTINUED; |
| 943 |
PROC_UNLOCK(q); |
1233 |
|
|
|
1234 |
PROC_LOCK(q); |
| 1235 |
sigqueue_take(p->p_ksi); |
| 1236 |
PROC_UNLOCK(q); |
| 1237 |
} |
| 1238 |
|
| 944 |
PROC_UNLOCK(p); |
1239 |
PROC_UNLOCK(p); |
| 945 |
|
1240 |
|
| 946 |
if (status) |
1241 |
if (status) |
| 947 |
*status = SIGCONT; |
1242 |
*status = SIGCONT; |
|
|
1243 |
|
| 1244 |
if (siginfo) { |
| 1245 |
siginfo->si_status = SIGCONT; |
| 1246 |
siginfo->si_code = CLD_CONTINUED; |
| 1247 |
} |
| 1248 |
|
| 948 |
return (0); |
1249 |
return (0); |
| 949 |
} |
1250 |
} |
| 950 |
PROC_UNLOCK(p); |
1251 |
PROC_UNLOCK(p); |
|
Lines 963-969
Link Here
|
| 963 |
* to successfully wait until the child becomes a zombie. |
1264 |
* to successfully wait until the child becomes a zombie. |
| 964 |
*/ |
1265 |
*/ |
| 965 |
LIST_FOREACH(p, &q->p_orphans, p_orphan) { |
1266 |
LIST_FOREACH(p, &q->p_orphans, p_orphan) { |
| 966 |
ret = proc_to_reap(td, p, pid, status, options, rusage); |
1267 |
ret = proc_to_reap(td, p, idtype, id, |
|
|
1268 |
status, options, rusage, siginfo); |
| 967 |
if (ret == 0) |
1269 |
if (ret == 0) |
| 968 |
continue; |
1270 |
continue; |
| 969 |
else if (ret == 1) |
1271 |
else if (ret == 1) |
|
Lines 977-982
Link Here
|
| 977 |
} |
1279 |
} |
| 978 |
if (options & WNOHANG) { |
1280 |
if (options & WNOHANG) { |
| 979 |
sx_xunlock(&proctree_lock); |
1281 |
sx_xunlock(&proctree_lock); |
|
|
1282 |
if (siginfo) |
| 1283 |
bzero (siginfo, sizeof (*siginfo)); |
| 980 |
td->td_retval[0] = 0; |
1284 |
td->td_retval[0] = 0; |
| 981 |
return (0); |
1285 |
return (0); |
| 982 |
} |
1286 |
} |