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