|
|
1.1 ! root 1: /* task_act.c - routines to manipulate task activity blocks */ ! 2: ! 3: #ifndef lint ! 4: static char *rcsid = "$Header: /f/osi/quipu/RCS/task_act.c,v 7.0 89/11/23 22:18:11 mrose Rel $"; ! 5: #endif ! 6: ! 7: /* ! 8: * $Header: /f/osi/quipu/RCS/task_act.c,v 7.0 89/11/23 22:18:11 mrose Rel $ ! 9: * ! 10: * ! 11: * $Log: task_act.c,v $ ! 12: * Revision 7.0 89/11/23 22:18:11 mrose ! 13: * Release 6.0 ! 14: * ! 15: */ ! 16: ! 17: /* ! 18: * NOTICE ! 19: * ! 20: * Acquisition, use, and distribution of this module and related ! 21: * materials are subject to the restrictions of a license agreement. ! 22: * Consult the Preface in the User's Manual for the full terms of ! 23: * this agreement. ! 24: * ! 25: */ ! 26: ! 27: ! 28: #include "quipu/util.h" ! 29: #include "quipu/connection.h" ! 30: ! 31: extern LLog * log_dsap; ! 32: ! 33: struct task_act *task_alloc() ! 34: { ! 35: struct task_act * tk_ret; ! 36: ! 37: tk_ret = (struct task_act *) calloc(1,sizeof(struct task_act)); ! 38: ! 39: tk_ret->tk_result = &(tk_ret->tk_resp.di_result.dr_res); ! 40: tk_ret->tk_error = &(tk_ret->tk_resp.di_error.de_err); ! 41: ! 42: return(tk_ret); ! 43: } ! 44: ! 45: task_free(tk) ! 46: struct task_act * tk; ! 47: { ! 48: DLOG(log_dsap, LLOG_TRACE, ("task_free()")); ! 49: ! 50: op_arg_free (&(tk->tk_dx.dx_arg)); ! 51: ! 52: free((char *)tk); ! 53: } ! 54: ! 55: /* ! 56: * Extract task from list held by the connection it was received on. ! 57: */ ! 58: task_conn_extract(tk) ! 59: struct task_act * tk; ! 60: { ! 61: struct task_act * tk_tmp; ! 62: struct task_act **tk_p; ! 63: ! 64: DLOG(log_dsap, LLOG_TRACE, ("task_conn_extract()")); ! 65: ! 66: tk_p = &(tk->tk_conn->cn_tasklist); ! 67: for(tk_tmp = (*tk_p); tk_tmp!=NULLTASK; tk_tmp=tk_tmp->tk_next) ! 68: { ! 69: if(tk_tmp == tk) ! 70: break; ! 71: ! 72: tk_p = &(tk_tmp->tk_next); ! 73: } ! 74: if(tk_tmp == NULLTASK) ! 75: { ! 76: LLOG(log_dsap, LLOG_EXCEPTIONS, ("task_conn_extract: task lost from connections list.")); ! 77: } ! 78: else ! 79: { ! 80: (*tk_p) = tk->tk_next; ! 81: } ! 82: } ! 83: ! 84: task_extract(tk) ! 85: struct task_act * tk; ! 86: { ! 87: struct oper_act * on; ! 88: ! 89: DLOG (log_dsap,LLOG_TRACE, ("task_extract()")); ! 90: if(tk == NULLTASK) ! 91: { ! 92: LLOG (log_dsap,LLOG_FATAL,("Attempted to extract NULLTASK!!")); ! 93: return; ! 94: } ! 95: ! 96: for(on = tk->tk_operlist; on!=NULLOPER; on = on->on_next_task) ! 97: { ! 98: oper_task_extract(on); ! 99: if(on->on_conn == NULLCONN) ! 100: oper_free(on); ! 101: } ! 102: ! 103: task_free(tk); ! 104: DLOG (log_dsap,LLOG_TRACE, ("task block extracted")); ! 105: } ! 106: ! 107: task_log(tk) ! 108: struct task_act * tk; ! 109: { ! 110: struct oper_act * on; ! 111: ! 112: DLOG (log_dsap,LLOG_NOTICE, ("Task id = %d, state = %d, prio = %d.", ! 113: tk->tk_dx.dx_id, tk->tk_state, tk->tk_prio)); ! 114: if(tk->tk_operlist != NULLOPER) ! 115: DLOG (log_dsap,LLOG_DEBUG, ("Task-Opers:")); ! 116: for(on=tk->tk_operlist; on != NULLOPER; on = on->on_next_task) ! 117: oper_log(on); ! 118: } ! 119:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.