| | 1948 | | tm_notify(tp, mp) |
| | 1949 | | struct task *tp; |
| | 1950 | | struct pmsg *mp; |
| | 1951 | | { |
| | 1952 | | int what, flags, ctx, tag, count, tid; |
| | 1953 | | struct hostd *hp; |
| | 1954 | | struct pmsg *mp2; |
| | 1955 | | struct waitc *wp; |
| | 1956 | | int i; |
| | 1957 | | |
| | 1958 | | if (upkint(mp, &what) |
| | 1959 | | || upkint(mp, &ctx) |
| | 1960 | | || upkint(mp, &tag) |
| | 1961 | | || upkint(mp, &count)) { |
| | 1962 | | pvmlogerror("tm_notify() bad msg format\n"); |
| | 1963 | | return 0; |
| | 1964 | | } |
| | 1965 | | |
| | 1966 | | flags = what; |
| | 1967 | | what &= 0xff; |
| | 1968 | | switch (what) { |
| | 1969 | | |
| | 1970 | | |
| | 1971 | | |
| | 1972 | | |
| | 1973 | | |
| | 1974 | | |
| | 1975 | | case PvmTaskExit:
|
| | 1976 | | for (i = 0; i < count; i++) { |
| | 1977 | | if (upkuint(mp, &tid)) { |
| | 1978 | | pvmlogerror("tm_notify() bad msg format\n"); |
| | | | ... |
| | 2073 | | wp->wa_on = hp->hd_hostpart; |
| | 2074 | | wp->wa_mesg = mp2; |
| | 2075 | | |
| | 2076 | | } else { |
| | 2077 | | sendmessage(mp2); |
| | 2078 | | } |
| | 2079 | | } |
| | 2080 | | } |
| | 2081 | | break; |
| | 2082 | | |
| | 2083 | | case PvmHostAdd:
|
| | 2084 | | |
| | 2085 | | FORLIST (wp, waitlist, wa_link)
|
| | 2086 | | if (wp->wa_kind == WT_HOSTA
|
| | 2087 | | && wp->wa_tid == tp->t_tid |
| | 2088 | | && wp->wa_mesg->m_ctx == ctx |
| | 2089 | | && wp->wa_mesg->m_tag == tag) |
| | 2090 | | break; |
| | 2091 | | |
| | 2092 | | |
| | 2093 | | |
| | 2094 | | if (count == 0 || (flags & PvmNotifyCancel)) {
|
| | 2095 | | if (wp != waitlist) |
| | 2096 | | wait_delete(wp); |
| | 2097 | | |
| | 2098 | | |
| | 2099 | | } else { |
| | 2100 | | if (wp == waitlist) { |
| | 2101 | | wp = wait_new(WT_HOSTA);
|
| | 2102 | | wp->wa_tid = tp->t_tid; |
| | 2103 | | wp->wa_on = tp->t_tid; |