| | 2943 | | dm_db(hp, mp) |
| | 2944 | | struct hostd *hp; |
| | 2945 | | struct pmsg *mp; |
| | 2946 | | { |
| | 2947 | | int opcode; |
| | 2948 | | int tid; |
| | 2949 | | int req; |
| | 2950 | | int flags; |
| | 2951 | | char *name = 0; |
| | 2952 | | struct pmsg *mp2 = 0; |
| | 2953 | | struct pmsg *mp3 = 0; |
| | 2954 | | |
| | 2955 | | struct waitc *wp, *wp2; |
| | 2956 | | struct pmsg *mp4 = 0; |
| | 2957 | | struct hostd *hp2; |
| | 2958 | | |
| | 2959 | | struct pvmmclass *np, *np2; |
| | 2960 | | struct pvmmentry *ep, *ep2; |
| | 2961 | | int *noresets; |
| | 2962 | | int nnr; |
| | 2963 | | int found; |
| | 2964 | | int cc; |
| | 2965 | | int i; |
| | 2966 | | int notified; |
| | 2967 | | |
| | 2968 | | hp = hp; |
| | 2969 | | |
| | 2970 | | if (upkint(mp, &opcode) || upkint(mp, &tid) |
| | 2971 | | || upkstralloc(mp, &name) || upkint(mp, &req) || upkint(mp, &flags)) |
| | 2972 | | goto badformat; |
| | 2973 | | |
| | 2974 | | mp2 = mesg_new(0); |
| | 2975 | | mp2->m_dst = mp->m_src; |
| | 2976 | | mp2->m_tag = DM_DBACK;
|
| | 2977 | | mp2->m_wid = mp->m_wid; |
| | 2978 | | |
| | 2979 | | switch (opcode) { |
| | 2980 | | |
| | 2981 | | case TMDB_PUT:
|
| | 2982 | | mp3 = mesg_new(0); |
| | 2983 | | if (pmsg_unpack(mp, mp3)) |
| | 2984 | | goto badformat; |
| | 2985 | | if ((req = mb_insert(tid, name, req, flags, mp3)) < 0) |
| | 2986 | | pmsg_unref(mp3); |
| | 2987 | | else { |
| | 2988 | | |
| | 2989 | | |
| | | | ... |
| | 3070 | | pmsg_unref(mp3); |
| | 3071 | | } |
| | 3072 | | } |
| | 3073 | | break; |
| | 3074 | | |
| | 3075 | | case TMDB_NAMES:
|
| | 3076 | | pkint(mp2, 0); |
| | 3077 | | req = mb_names(tid, name, mp2); |
| | 3078 | | break; |
| | 3079 | | |
| | 3080 | | case TMDB_RESET:
|
| | 3081 | | if ( upkint(mp, &nnr) ) |
| | 3082 | | goto badformat; |
| | 3083 | | noresets = TALLOC( nnr, int, "int" );
|
| | 3084 | | for ( i=0 ; i < nnr ; i++ ) { |
| | 3085 | | if ( upkint(mp, &(noresets[i])) ) { |
| | 3086 | | PVM_FREE(noresets);
|
| | 3087 | | goto badformat; |
| | 3088 | | } |
| | 3089 | | } |
| | 3090 | | pkint(mp2, 0); |
| | 3091 | | for (np = pvmmboxclasses->mc_link; np != pvmmboxclasses; |
| | 3092 | | np = np2) { |
| | 3093 | | np2 = np->mc_link; |
| | 3094 | | |
| | 3095 | | |
| | 3096 | | if ( *name == '\0' || !strcmp( np->mc_name, name ) ) { |
| | 3097 | | |
| | 3098 | | for (ep = np->mc_ent->me_link; ep != np->mc_ent; ep = ep2) { |
| | 3099 | | ep2 = ep->me_link; |
| | 3100 | | |
| | 3101 | | |
| | 3102 | | |
| | 3103 | | if ( req < 0 || req == ep->me_ind ) { |
| | 3104 | | |
| | 3105 | | |
| | 3106 | | if ( ep->me_flags & PvmMboxPersistent ) {
|
| | 3107 | | |
| | 3108 | | |
| | 3109 | | if (!(ep->me_tid)) { |
| | 3110 | | me_free(np, ep); |
| | 3111 | | if (np2->mc_rlink != np) |
| | 3112 | | break; |
| | 3113 | | } |
| | 3114 | | |
| | 3115 | | |
| | 3116 | | |
| | 3117 | | else if ( flags ) { |
| | 3118 | | for ( i=0, found=0 ; i < nnr && !found ; i++ ) |
| | 3119 | | if ( noresets[i] == ep->me_tid ) |
| | 3120 | | found++; |
| | 3121 | | |
| | 3122 | | |
| | 3123 | | |
| | 3124 | | if ( !found ) { |
| | 3125 | | wp = wait_new(WT_RESET);
|
| | 3126 | | wp->wa_on = ep->me_tid; |
| | 3127 | | wp->wa_tid = pvmmytid; |
| | 3128 | | wp->wa_dep = 0; |
| | 3129 | | wp->wa_mesg = (struct pmsg *) NULL;
|
| | 3130 | | |
| | 3131 | | |
| | 3132 | | hp2 = tidtohost(hosts, ep->me_tid); |
| | 3133 | | if ( hp2 && hp2->hd_hostpart != myhostpart ) |
| | 3134 | | { |