static int Sys_Alarm(struct Interrupt_State *state) { Set_Handler(Get_Current(), SIGALRM, state->ecx); Start_Timer(state->ebx, NULL); /* weak */ return 0; }
/* * Register a signal handler for a process * Params: * state->ebx - pointer to handler function * state->ecx - signal number * Returns: 0 on success or error code (< 0) on error */ static int Sys_Signal(struct Interrupt_State *state) { int rc; if (state->ecx == SIGKILL) return EINVALID; if (!IS_SIGNUM(state->ecx)) return EINVALID; rc = Set_Handler(state->ebx, state->ecx); return rc; }
/* * Register the Return_Signal trampoline for this process. * Signals cannot be delivered until this is registered. * Params: * state->ebx - pointer to Return_Signal function * state->ecx - pointer to the default handler * state->edx - pointer to the ignore handler * * Returns: 0 on success or error code (< 0) on error */ static int Sys_RegDeliver(struct Interrupt_State* state) { struct Kernel_Thread* kthread = Get_Current(); kthread->userContext->returnSignal = state->ebx; kthread->userContext->dflHandler = state->ecx; kthread->userContext->ignHandler = state->edx; for(int i = 1; i <= MAXSIG; i++) Set_Handler(kthread, i, state->ecx); return 0; //TODO("Sys_RegDeliver system call"); }
/* * Register a signal handler for a process * Params: * state->ebx - pointer to handler function * state->ecx - signal number * Returns: 0 on success or error code (< 0) on error */ static int Sys_Signal(struct Interrupt_State* state) { Set_Handler(Get_Current(), state->ecx, state->ebx); return 0; //TODO("Sys_Signal system call"); }
void HdmFcpTargetInit::TI_Build_Tables() { U32 loop, id; _LunXlate *pX; union { IDLUN idlun; long l; } sig; ExportTableEntry *pExport; TRACE_ENTRY(HdmFcpTargetInit::TI_Build_Tables); // Scan the Export Table to read all the entries that belong to us // and get the data we need to build the translation table pExport = TI_TS_Export; for (loop = 0; loop < m_nTableRows; loop++) { // use entries on our loop only if (pExport->FCInstance != config.loop_instance) { pExport++; // next entry continue; } // use the LUN and id fields to build key sig.idlun.HostId = (U8)pExport->InitiatorId; sig.idlun.id = (U8)pExport->TargetId; //sig.idlun.id = 0; sig.idlun.LUN = (U16)pExport->ExportedLUN; if (sig.idlun.HostId == 0xff) { // allow all hosts to access this LUN for (id = 0; id < MAX_FC_IDS; id++) { pX = new Xlt; // each entry must have a new Xlt pX->pNext = NULL; pX->vd = pExport->vdNext; pX->Row = pExport->rid; // save this entries row ID // set same state as the Export entry pX->state = pExport->ReadyState; Set_Handler(pX); sig.idlun.HostId = (U8)id; pX->key.l = sig.l; if (Add_Hash_Entry(sig.l, (void *)pX)) { TRACE_HEX(TRACE_L2, "\n\rAdd_Hash_Entry: key extended = ", (U32)sig.l); TRACE_HEX(TRACE_L2, " hash ", (U32)Hash(sig.l)); } } } else { // make a new Xlt record and fill it in pX = new Xlt; pX->pNext = NULL; pX->vd = pExport->vdNext; pX->Row = pExport->rid; // save this entries row ID pX->key.l = sig.l; // set temporary state pX->state = pExport->ReadyState; Set_Handler(pX); if (Add_Hash_Entry(sig.l, (void *)pX)) { TRACE_HEX(TRACE_L2, "\n\rAdd_Hash_Entry: key extended = ", (U32)sig.l); TRACE_HEX(TRACE_L2, " hash ", (U32)Hash(sig.l)); } num_valid_exports++; } // check the Export table entry state, if it is: StateConfigured, // change the export table entry state to: StateConfiguredAndExporting. if (pExport->ReadyState == StateConfigured) { // use the last Xlt to send the state change pX->state = StateConfiguredAndExporting; TI_TblModifyExportState(&pX->Row, &pX->state); } // next entry pExport++; } } // TI_Build_Tables