/* paging of the requested subscriber has completed */
static int paging_cb_silent(unsigned int hooknum, unsigned int event,
			    struct msgb *msg, void *_lchan, void *_data)
{
	struct gsm_lchan *lchan = _lchan;
	struct scall_signal_data sigdata;
	int rc;

	if (hooknum != GSM_HOOK_RR_PAGING)
		return -EINVAL;

	DEBUGP(DSMS, "paging_cb_silent: ");

	sigdata.lchan = lchan;
	sigdata.data = _data;

	switch (event) {
	case GSM_PAGING_SUCCEEDED:
		DEBUGPC(DSMS, "success, using Timeslot %u on ARFCN %u\n",
			lchan->ts->nr, lchan->ts->trx->arfcn);
		lchan->silent_call = 1;
		/* increment lchan reference count */
		dispatch_signal(SS_SCALL, S_SCALL_SUCCESS, &sigdata);
		use_lchan(lchan);
		break;
	case GSM_PAGING_EXPIRED:
		DEBUGP(DSMS, "expired\n");
		dispatch_signal(SS_SCALL, S_SCALL_EXPIRED, &sigdata);
		break;
	default:
		rc = -EINVAL;
		break;
	}

	return rc;
}
Exemple #2
0
int kexit(long exit_code)
{
    struct process *init = find_init();
    struct process *curr = NULL;
    int i = 0;
    if(!init) {
        printk("kexit:: warning could not find init task\n");
        return 0;
    }
    for(i = 0; i < Nr_PRIORITY; ++i) {
        curr = process_tab[i];
        do {
            if(curr) {
                if(curr->p_parent == current_process->p_pid) {
                    curr->p_parent = 1;
                    if(curr->p_state == P_ZOMBIE) {
                        dispatch_signal(SIGCHLD, init, curr);
                    }
                }
                curr = curr->p_next;
            } else {
                break;
            }
        } while(curr != process_tab[i]);
    }
    // TODO:= Sessions are not currently implemented.
    if(current_process->p_leader) {
        terminate_session(); 
    }
    current_process->p_exit_code = exit_code;
    signal_parent(current_process->p_parent);
    schedule();
    return -1;
}// kexit
Exemple #3
0
int kkill(pid_t pid, int signal)
{
    struct process *curr = NULL;
    int i = 0;
    int rtvl = 0, error = 0;
    for(i = 0; i < Nr_PRIORITY; ++i) {
        curr = process_tab[i];
        // Iterate for all processes in the system.
        // Handle cases if pid == 0, pid > 0, pid == -1, 
        // and all other cases (last else statement).
        do {
            if(curr) {
                if(pid == 0 && 
                   curr->p_pgrp == current_process->p_pid) {
                    if((error=dispatch_signal(signal,1,curr))) {
                        rtvl = error;
                    }
                } else if(pid > 0 &&
                          curr->p_pid == pid) {
                        if((error=dispatch_signal(signal,0,curr))) {
                            rtvl = error;
                        }
                } else if(pid == -1) {
                        if((error=dispatch_signal(signal,0,curr))) {
                            rtvl = error;
                        }
                } else {
                    if(curr->p_pgrp == -pid) {
                        if((error=dispatch_signal(signal,0,curr))) {
                            rtvl = error;
                        }
                    }
                }
                curr = curr->p_next;
            } else {
                break;
            }
        } while(curr != process_tab[i]);
    }
    return rtvl;
}// kkill
Exemple #4
0
/**********************************************************************
 *		int_handler
 *
 * Handler for SIGINT.
 */
static void int_handler( int signal, siginfo_t *info, ucontext_t *ucontext )
{
    if (!dispatch_signal(SIGINT))
    {
        EXCEPTION_RECORD rec;
        CONTEXT context;

        save_context( &context, ucontext );
        rec.ExceptionCode    = CONTROL_C_EXIT;
        rec.ExceptionFlags   = EXCEPTION_CONTINUABLE;
        rec.ExceptionRecord  = NULL;
        rec.ExceptionAddress = (LPVOID)context.pc;
        rec.NumberParameters = 0;
        __regs_RtlRaiseException( &rec, &context );
        restore_context( &context, ucontext );
    }
}
void NetworkQueue::execute_script ( const QString & filename )
{
  if( m_script_file->isOpen() )
    throw IllegalCall( FromHere(), "Another script is already in execution." );

  m_script_file->setFileName( filename );

  if( !m_script_file->exists() )
    throw FileSystemError( FromHere(), "The file [" + filename.toStdString() +
                           "] does not exist." );

  BasicCommands::dispatcher = this;
  BasicCommands::tree_root = ThreadManager::instance().tree().root();
  BasicCommands::current_component = ThreadManager::instance().tree().root();

  if( !m_script_file->open( QIODevice::ReadOnly ) )
    NLog::global()->add_error( m_script_file->errorString() );
  else
  {
    NLog::global()->add_message("Running script: " + filename);
    m_script_stream->setDevice( m_script_file );
    if(!filename.endsWith(".py")) // non-python, assume CFscript
    {
      send_next_command();
    }
    else // python
    {
      const URI script_engine_path("//Tools/Python/ScriptEngine", common::URI::Scheme::CPATH);
      
      SignalOptions options;
      options.add("script", m_script_stream->readAll().toStdString());
      SignalFrame frame = options.create_frame("execute_script", script_engine_path, script_engine_path);
      
      dispatch_signal("execute_script", script_engine_path, frame);
    }
  }
}
void SignalDispatcher::dispatch_empty_signal( const std::string & target,
                                              const URI & receiver)
{
  XML::SignalFrame frame( target, URI(), receiver );
  dispatch_signal( target, receiver, frame );
}