- Timestamp:
- Dec 9, 2004, 9:19:34 AM (21 years ago)
- Location:
- trunk/src/emx/src/lib
- Files:
-
- 5 edited
-
process/wait.c (modified) (1 diff, 1 prop)
-
process/wait4.c (modified) (2 diffs, 1 prop)
-
process/waitid.c (modified) (1 diff, 1 prop)
-
process/waitpid.c (modified) (1 diff, 1 prop)
-
sys/b_processWait.c (modified) (4 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/lib/process/wait.c
-
Property cvs2svn:cvs-rev
changed from
1.5to1.6
r1722 r1723 50 50 * Just pass it along to waitpid. 51 51 */ 52 pid_t pid = wait pid(-1, piStatus, 0);52 pid_t pid = wait); 53 53 if (pid > 0) 54 54 LIBCLOG_RETURN_MSG(pid, "ret %d (%#x) iStatus=%#x\n", pid, pid, piStatus ? *piStatus : -1); -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/wait4.c
-
Property cvs2svn:cvs-rev
changed from
1.2to1.3
r1722 r1723 2 2 /** @file 3 3 * 4 * LIBC - wait 3().4 * LIBC - wait(). 5 5 * 6 6 * Copyright (c) 2004 knut st. osmundsen <[email protected]> … … 62 62 { 63 63 LIBC_ASSERTM_FAILED("pRUsage=%p - not implemented\n", (void *)pRUsage); 64 errno = ENOSYS; 64 /* errno = ENOSYS; 65 LIBCLOG_RETURN_INT(-1); */ 66 } 67 if (fOptions & ~(WEXITED | WUNTRACED | WSTOPPED | WCONTINUED | WNOHANG | WNOWAIT)) 68 { 69 LIBC_ASSERTM_FAILED("Unknown options %#x. (fOptions=%#x)\n", 70 fOptions & ~(WEXITED | WUNTRACED | WSTOPPED | WCONTINUED | WNOHANG | WNOWAIT), fOptions); 71 errno = EINVAL; 65 72 LIBCLOG_RETURN_INT(-1); 66 73 } 67 74 68 75 /* 69 * Let waitpid do the job.76 * . 70 77 */ 71 pid = waitpid(pid, piStatus, fOptions); 78 /* convert pid to enmIdType and Id. */ 79 id_t Id; 80 idtype_t enmIdType; 72 81 if (pid > 0) 73 LIBCLOG_RETURN_MSG(pid, "ret %d (%#x) iStatus=%#x\n", pid, pid, piStatus ? *piStatus : -1); 74 LIBCLOG_RETURN_INT(pid); 82 { 83 enmIdType = P_PID; 84 Id = pid; 85 } 86 else if (pid == 0) 87 { 88 enmIdType = P_PGID; 89 Id = 0; 90 } 91 else if (pid == -1) 92 { 93 enmIdType = P_ALL; 94 Id = 0; 95 } 96 else 97 { 98 Id = -pid; 99 enmIdType = P_PGID; 100 } 101 102 /* do the call */ 103 siginfo_t SigInfo = {0}; 104 int rc = __libc_Back_processWait(enmIdType, Id, &SigInfo, fOptions | WEXITED, pRUsage); 105 if (!rc) 106 { 107 /* 108 * Convert signal info to status code. 109 */ 110 int iStatus; 111 switch (SigInfo.si_code) 112 { 113 default: 114 LIBC_ASSERTM_FAILED("Invalid si_code=%d\n", SigInfo.si_code); 115 case CLD_EXITED: iStatus = W_EXITCODE(SigInfo.si_status, 0); break; 116 case CLD_KILLED: iStatus = W_EXITCODE(0, SigInfo.si_status); break; 117 case CLD_DUMPED: iStatus = W_EXITCODE(0, SigInfo.si_status) | WCOREFLAG; break; 118 case CLD_TRAPPED: iStatus = W_STOPCODE(SigInfo.si_status); break; 119 case CLD_STOPPED: iStatus = W_STOPCODE(SigInfo.si_status); break; 120 case CLD_CONTINUED: iStatus = W_STOPCODE(SigInfo.si_status); break; 121 122 } 123 if (piStatus) 124 *piStatus = iStatus; 125 LIBCLOG_RETURN_MSG(SigInfo.si_pid, "ret %d (%#x) iStatus=%#x\n", 126 SigInfo.si_pid, SigInfo.si_pid, iStatus); 127 } 128 129 /* 130 * wait4() doesn't return EINVAL for anything but invalid fOptions 131 * and since we've already validated those, they cannot be the cause 132 * of EINVAL. 133 */ 134 if (rc == -EINVAL) 135 rc = -ECHILD; 136 errno = -rc; 137 LIBCLOG_RETURN_INT((pid_t)-1); 75 138 } 76 139 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/waitid.c
-
Property cvs2svn:cvs-rev
changed from
1.2to1.3
r1722 r1723 42 42 * @returns 0 on success, pSigInfo containing status info. 43 43 * @returns -1 and errno on failure. 44 45 46 44 47 * @param enmIdType What kind of process specification Id contains. 45 48 * @param Id Process specification of the enmIdType sort. -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/waitpid.c
-
Property cvs2svn:cvs-rev
changed from
1.6to1.7
r1722 r1723 54 54 { 55 55 LIBCLOG_ENTER("pid=%#x (%d) piStatus=%p fOptions=%#x\n", pid, pid, (void *)piStatus, fOptions); 56 57 56 /* 58 * Call waitid to do the actual waiting.57 * . 59 58 */ 60 /* convert pid to enmIdType and Id. */ 61 id_t Id; 62 idtype_t enmIdType; 59 pid = wait4(pid, piStatus, fOptions, NULL); 63 60 if (pid > 0) 64 { 65 enmIdType = P_PID; 66 Id = pid; 67 } 68 else if (pid == 0) 69 { 70 enmIdType = P_PGID; 71 Id = 0; 72 } 73 else if (pid == -1) 74 { 75 enmIdType = P_ALL; 76 Id = 0; 77 } 78 else 79 { 80 Id = -pid; 81 enmIdType = P_PGID; 82 } 83 84 /* do the call */ 85 siginfo_t SigInfo = {0}; 86 int rc = waitid(P_ALL, 0, &SigInfo, fOptions | WEXITED); 87 if (!rc) 88 { 89 /* 90 * Convert signal info to status code. 91 */ 92 int iStatus; 93 switch (SigInfo.si_code) 94 { 95 default: 96 LIBC_ASSERTM_FAILED("Invalid si_code=%d\n", SigInfo.si_code); 97 case CLD_EXITED: iStatus = W_EXITCODE(SigInfo.si_status, 0); break; 98 case CLD_KILLED: iStatus = W_EXITCODE(0, SigInfo.si_status); break; 99 case CLD_DUMPED: iStatus = W_EXITCODE(0, SigInfo.si_status) | WCOREFLAG; break; 100 case CLD_TRAPPED: iStatus = W_STOPCODE(SigInfo.si_status); break; 101 case CLD_STOPPED: iStatus = W_STOPCODE(SigInfo.si_status); break; 102 case CLD_CONTINUED: iStatus = W_STOPCODE(SigInfo.si_status); break; 103 104 } 105 if (piStatus) 106 *piStatus = iStatus; 107 LIBCLOG_RETURN_MSG(SigInfo.si_pid, "ret %d (%#x) iStatus=%#x\n", 108 SigInfo.si_pid, SigInfo.si_pid, iStatus); 109 } 110 LIBCLOG_RETURN_INT(rc); 61 LIBCLOG_RETURN_MSG(pid, "ret %d (%#x) iStatus=%#x\n", pid, pid, piStatus ? *piStatus : -1); 62 LIBCLOG_RETURN_INT(-1); 111 63 } 112 64 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_processWait.c
-
Property cvs2svn:cvs-rev
changed from
1.6to1.7
r1722 r1723 736 736 { 737 737 case P_ALL: 738 738 739 case P_PID: 740 741 742 743 744 745 739 746 case P_PGID: 747 748 749 750 751 740 752 break; 741 753 default: … … 803 815 if (fFlag && (fFlag & fOptions)) 804 816 { 805 if ( enmIdType == P_ALL 806 || (enmIdType == P_PID && pInfo->pid == pid) 807 || (enmIdType == P_PGID && pInfo->pgrp == pid)) 817 if (enmIdType == P_ALL) 818 break; 819 else if (enmIdType == P_PID) 820 { 821 if (pInfo->pid == pid) 822 break; 823 } 824 else if (enmIdType == P_PGID && pInfo->pgrp == pid) 808 825 break; 809 826 } … … 885 902 * Should call DosVerifyPidTid and DosGetPPid(). */ 886 903 waitSemRelease(); 887 rc = -ECHILD; /* this ain't correct!*/904 rc = -ECHILD; */ 888 905 break; 889 906 } … … 894 911 if (rc) 895 912 { 913 896 914 waitSemRelease(); 897 rc = -ECHILD; 915 rc = -ECHILD; 898 916 break; 899 917 } 900 918 } 901 919 waitSemRelease(); 920 921 922 923 924 925 926 927 928 902 929 903 930 /* -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.
