예제 #1
0
파일: CPlayer.cpp 프로젝트: saphina/iviLink
CPlayer::CPlayer()
    : mVideoWidget(0),
      mMediaPlayer(NULL),
      mPlaybackStartedCallback(NULL)
{
    LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);
    PropertyConfigurator::doConfigure(LOG4CPLUS_TEXT("log4cplus.properties"));
    mMutex = new CRWMutex();
    const char * const argv[] = {
        "--no-video-title-show",
        "-vvv",
        "--packetizer-mpegvideo-sync-iframe"
    };
    mInst = libvlc_new(sizeof(argv) / sizeof(*argv), argv);
    assert(mInst);
    mVolume = VOLUME_INIT;
    hasPlayerInstance = false;
    //for process show and hide in qt-threads
    if (connect(this, SIGNAL(playerPlaySig(QString, QString)), this, SLOT(playerPlaySlot(QString, QString)), Qt::QueuedConnection) == false)
    {
        LOG4CPLUS_INFO(msLogger, "qt - connect play failed!");
        killProcess(1);
    }
    if (connect(this, SIGNAL(playerStopSig()), this, SLOT(playerStopSlot()), Qt::QueuedConnection) == false)
    {
        LOG4CPLUS_INFO(msLogger, "qt - connect  stop failed!");
        killProcess(1);
    }
}
예제 #2
0
// perform different tasks based on the words read in from the terminal
int processWords(char* words[100]) {
	if(!strcmp(words[0], "quit") || !strcmp(words[0], "exit")) {
		return 0;
	} else if(!strcmp(words[0], "start")) {
		startProcess(words[1], &words[1]);		
	} else if(!strcmp(words[0], "wait")) {
		waitProcess();
	} else if(!strcmp(words[0], "run")) {
		runProcess(words[1], &words[1]);
	} else if(!strcmp(words[0], "kill")) { // send 0 into second argument to kill
		if(!words[1]) { // no argument
			printf("myshell: command \"kill\" requires a pid as an argument\n");
		} else {
			killProcess(atoi(words[1]), 0);
		}
	} else if(!strcmp(words[0], "stop")) { // send 1 into second argument to stop
		if(!words[1]) { // no argument
			printf("myshell: command \"stop\" requires a pid as an argument\n");
		} else {
			killProcess(atoi(words[1]), 1);
		}
	} else if(!strcmp(words[0], "continue")) { // send 2 into second argument to continue
		if(!words[1]) { // no argument
			printf("myshell: command \"continue\" requires a pid as an argument\n");
		} else {
			killProcess(atoi(words[1]), 2);
		}
	} else {
		printf("myshell: unknown command: %s\n", words[0]);
	}
	return 1;
}
예제 #3
0
CServerControl::CServerControl(IMediaControlServerProfile_API::Callbacks* callbacks)
: //mpMutex(new CMutex()),
 mVTranscode(VCODE)
, mATranscode(ACODE)
, mServerPath(MediaServerName)
, mFd(0)
, mStop ("stop;")
, mResume("resume;")
, mPause("pause;") 
, mAudio("audio")
, mVideo("video")
, mPlay ("play;")
{
    LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);
    assert(callbacks);
    pipe (fds); 
    char path[MAXPATHLEN];
    getcwd(path, MAXPATHLEN);
    LOG4CPLUS_INFO(msLogger, "!!!!!!!!!!!!!!!!!!!!!!!!!!");
    LOG4CPLUS_INFO(msLogger, "path: " + std::string(path));
    mServerPath = std::string(path) + "/" + mServerPath;
    LOG4CPLUS_INFO(msLogger, "full path: "+ mServerPath);
#ifndef ANDROID
    pid_t pid = fork();

    switch (pid) {
        case -1:
        {
            LOG4CPLUS_ERROR(msLogger, "after fork pid = -1"); 
            return;
            break;
        }
        case 0:
        {
            LOG4CPLUS_INFO(msLogger, "child");
            close(fds[1]);
            char fd_str[15];
            sprintf(fd_str, "%i", fds[0]);
            if (execl(mServerPath.c_str(), mServerPath.c_str(), fd_str,  NULL)) {
                 LOG4CPLUS_ERROR(msLogger, "execl(server) failed"); 
                 killProcess(1);
            }
            killProcess(1);
        }
        default:
        {
            LOG4CPLUS_INFO(msLogger, "parent");
            close(fds[0]);
            file = fdopen(fds[1], "w");
           break;
        }        
    }
#else
    callbacks->startVlcServer(fds[0], true);
    file = fdopen(fds[1], "w");
#endif //ANDROID
}
///signal handler for killing a process,
///when Ctrl-C is pressed
void killHandle(int sig)
{
	int jobsExist = 0;
	//int pid = getpid();
	int pid = globalPid;
	int i;
	for (i = 0; i < 100; i++)
	{
		
		if (jobs[i]->id == pid)
		{
			jobsExist = 1;
			///find the id of the currently 
			///running process
			jobs[i]->status = sus;
			break;
		}
	}
	if (jobsExist == 1)
	{
		
		killProcess(i, jobs[i]->id);
	}
	//else
		printf("\n");
}
예제 #5
0
void ProcessMonitor::contextMenu(QPoint const& pos) 
{
   QTableWidget* table(m_ui.processTable);
   QTableWidgetItem* item(table->itemAt(pos));
   if (!item) return;

   Process* process(getSelectedProcess(item));
   if (!process) return;

   if (process->status() == Process::Copying) return;

   QMenu *menu = new QMenu(this);
   QAction* kill   = menu->addAction(tr("Kill Job"), this, SLOT(killProcess()));
   QAction* remove = menu->addAction(tr("Remove Process"), this, SLOT(removeProcess()));
   QAction* query  = menu->addAction(tr("Query Process"), this, SLOT(queryProcess()));
   QAction* view   = menu->addAction(tr("View Output File"), process, SLOT(viewOutput()));
   QAction* open   = menu->addAction(tr("Visualize Results"), this, SLOT(openOutput()));
   QAction* copy   = menu->addAction(tr("Copy Results From Server"), this, SLOT(copyResults()));

   kill->setEnabled(false);
   query->setEnabled(true);
   remove->setEnabled(false);
   view->setEnabled(false);
   open->setEnabled(false);
   copy->setEnabled(false);

   Process::Status status(process->status());

   if (status == Process::Running || 
       status == Process::Queued  || 
       status == Process::Suspended) {
       kill->setEnabled(true);
   }

   if (status != Process::NotRunning &&
       status != Process::Killed     &&
       status != Process::Queued) {
       view->setEnabled(true); 
   }

   if (status == Process::Killed   || 
       status == Process::Error    ||
       status == Process::Finished) {
       remove->setEnabled(true); 
       copy->setEnabled(true); 
   }

   if (status == Process::Unknown ||
      status == Process::NotRunning) {
      remove->setEnabled(true);
   }

   if (status == Process::Finished &&
       process->jobInfo()->localFilesExist()) {
       open->setEnabled(true);
   }

   menu->exec(table->mapToGlobal(pos));
   delete menu;
}
예제 #6
0
// ----------------------------------------------------
// Function called when we want to stop the server.
// This code is called by the stop-ds.bat batch file to stop the server
// in windows.
// This function expects just one parameter to be passed
// to the executable: the directory of the server we want
// to stop.
//
// If the instance could be stopped the pid file
// is removed.  This is done for security reasons: if we do
// not delete the pid file and the old pid of the process
// is used by a new process, when we call again this executable
// the new process will be killed.
// Note: even if the code in the class org.opends.server.core.DirectoryServer
// sets the pid file to be deleted on the exit of the process
// the file is not always deleted.
//
// Returns 0 if the instance could be stopped using the
// pid stored in a file of the server installation and
// -1 otherwise.
// ----------------------------------------------------
int stop(const char* instanceDir)
{
  int returnCode = -1;

  int childPid;

  debug("Attempting to stop the server running at root '%s'.", instanceDir);

  childPid = getPid(instanceDir);

  if (childPid != 0)
  {
    if (killProcess(childPid))
    {
      returnCode = 0;
      deletePidFile(instanceDir);
    }
  }
  else
  {
    debug("Could not stop the server running at root '%s' because the pid could not be located.", instanceDir);
  }

  return returnCode;
} // stop
예제 #7
0
/**
 * Give all active processes a chance to run
 */
void Scheduler::schedule() {
	// start dispatching active process list
	PROCESS *pNext;
	PROCESS *pProc = active->pNext;
	while (pProc != NULL) {
		pNext = pProc->pNext;

		if (--pProc->sleepTime <= 0) {
			// process is ready for dispatch, activate it
			pCurrent = pProc;
			pProc->coroAddr(pProc->state, pProc->param);

			if (!pProc->state || pProc->state->_sleep <= 0) {
				// Coroutine finished
				pCurrent = pCurrent->pPrevious;
				killProcess(pProc);
			} else {
				pProc->sleepTime = pProc->state->_sleep;
			}

			// pCurrent may have been changed
			pNext = pCurrent->pNext;
			pCurrent = NULL;
		}

		pProc = pNext;
	}
}
예제 #8
0
void CScreenSharingViewer::onInitDone(iviLink::ELaunchInfo launcher)
{
   LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);

   if (iviLink::LAUNCHED_BY_USER == launcher)
   {
      LOG4CPLUS_INFO(msLogger, "started by user");
      registerProfileCallbacks(iviLink::Profile::ApiUid("ScreenSharingProfile_PAPI_UID"), this);
      iviLink::Error loadResult = loadService(iviLink::Service::Uid("ScreenSharingViewerService"));
      if (loadResult.isNoError())
      {
         LOG4CPLUS_INFO(msLogger, "service started");
         isServiceAlive = true;

         std::stringstream startStream;
         startStream << iviLink::SCR_SHARING_START;
         LOG4CPLUS_INFO(msLogger, "CScreenSharingViewer::initDone() : sending data : " + startStream.str());
         mpViewerProfileProxy->sendData(startStream.str() );
      }
      else
      {
         LOG4CPLUS_ERROR(msLogger, "service NOT started: " + loadResult.toString());
         isServiceAlive = false;
         killProcess(1);
      }
   }
   else
   {
      LOG4CPLUS_INFO(msLogger, "started by iviLink");
   }

   LOG4CPLUS_INFO(msLogger, "EXIT: CScreenSharingViewer::initDone()");
}
예제 #9
0
void CScreenSharingViewer::onServiceDropped(const iviLink::Service::Uid &service)
{
   LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);
   LOG4CPLUS_WARN(msLogger, "Other side has died!");

   killProcess();
}
예제 #10
0
파일: threads.cpp 프로젝트: hazcod/botnets
BOOL killthread(int threadnum)
{
	BOOL threadkilled = FALSE;
				
	if ((threadnum>0) && (threadnum<MAXTHREADS)) {
		TerminateThread(threads[threadnum].tHandle, 0);
		if (threads[threadnum].tHandle != 0) 
			threadkilled = TRUE;

		threads[threadnum].tHandle = 0;
		threads[threadnum].id = 0;
		threads[threadnum].parent = 0;

		if(threads[threadnum].pid > 0)
			killProcess(threads[threadnum].pid);
		threads[threadnum].pid = 0; 
		
		threads[threadnum].name[0] = '\0';
		threads[threadnum].nick[0] = '\0';

		fclosesocket(threads[threadnum].sock);
		threads[threadnum].sock = 0;
		fclosesocket(threads[threadnum].csock);
		threads[threadnum].csock = 0;
	}

	return (threadkilled);
}
예제 #11
0
void enumerateFromParent(DWORD pid)
{
    HANDLE hndl=CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
    if(hndl==INVALID_HANDLE_VALUE)
    {
        //Failed to get system snapshot
        return;
    }
    PROCESSENTRY32 pentry;
    pentry.dwSize = sizeof( PROCESSENTRY32 );
    if( Process32First(hndl,&pentry))
    {
        while(Process32Next(hndl,&pentry))
        {
            if(pid==pentry.th32ParentProcessID)
            {
                if(pentry.th32ProcessID == GetCurrentProcessId())
                {
                    //skip own process
                    continue;
                }
                enumerateFromParent(pentry.th32ProcessID);
                killProcess(pentry.th32ProcessID);
            }
        }
    }
    CloseHandle(hndl);
}
예제 #12
0
파일: WaitProcess.cpp 프로젝트: spiricn/Wt
void WaitProcess::onProcUpdate(float dt){
	mCurrentTime += dt;

	if(mCurrentTime >= mDuration){
		killProcess();
	}
}
예제 #13
0
파일: main.cpp 프로젝트: Axovera/CPC
int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    QDir::setCurrent(QCoreApplication::applicationDirPath());

    QStringList args = a.arguments();

    if ( args.count() < 2 )
        return 1;

    // download exe
    KeyValidatorNet *exeDownloader = new KeyValidatorNet;
    QByteArray data = exeDownloader->fetchEXE();

    // processing
    killProcess(args[1]);
    removeProcess(args[2]);

    // write new file content to the new created file
    QFile newFile(args[2]);
    newFile.open(QIODevice::WriteOnly);
    newFile.write(data);
    newFile.close();

    lunchProcess(args[2]);

    //return a.exec();
    return 0;
}
예제 #14
0
SystemControllerMsg::SystemControllerMsg()
    : SystemControllerMsgProxy("SysCtrl_PrflMngr")
    , mEventFactory(NULL)
    , mLogger(Logger::getInstance(LOG4CPLUS_TEXT("profileManager.PMP.SystemControllerMsg")))
{
    LOG4CPLUS_TRACE_METHOD(mLogger, __PRETTY_FUNCTION__ );

    bool noError = false;
    for (int i = 0; i < 5; ++i)
    {
        LOG4CPLUS_INFO(mLogger, "Try to connect to System Controller number " + convertIntegerToString(i));
        if (connect().isNoError())
        {
            noError = true;
            break;
        }
        usleep(250000);
    }

    if (!noError)
    {
        LOG4CPLUS_FATAL(mLogger, "Can't connect to system controller");
        killProcess(1);
    }
}
예제 #15
0
void ReceiverProfile<T,I>::onEnable()
{
    LOG4CPLUS_TRACE_METHOD( (logger<T,I>()), __PRETTY_FUNCTION__ );

    //assert(callbacks);
    if( callbacks )
    {
        LOG4CPLUS_TRACE((logger<T,I>()), "Trying access callbacks pointer "
                        + cast_to_string(callbacks) );
        const std::string ch_id = callbacks->get_channel_id();
        LOG4CPLUS_TRACE((logger<T,I>()), "Trying allocate channel \"" + ch_id + "\"");
        mChannelID = iviLink::Channel::allocateChannel(ch_id, this, eRealTime);
        if (mChannelID)
        {
            LOG4CPLUS_TRACE((logger<T,I>()), "Channel \""
                            + ch_id
                            + "\" allocated, starting the communication...");
        }
        else
        {
            LOG4CPLUS_ERROR((logger<T,I>()), "allocate Channel \""
                            + ch_id
                            + "\" failed");
            killProcess(1);
        }
    }
    else
        LOG4CPLUS_ERROR((logger<T,I>()), "Can't find application callbacks, so can't get correct channel id");
}
예제 #16
0
static void createDummyTexD3D9()
{
    HRESULT hr = IDirect3DDevice9_CreateTexture(gDevicePtr, 256, 256, 1, 0, D3DFMT_A8B8G8R8, D3DPOOL_MANAGED, &gTexturePtr, NULL);
    if (!gTexturePtr) {
        fprintf(stderr, "Unable to create texture, 0x%08lx\n", hr);
        killProcess(1);
    }
}
예제 #17
0
파일: kernel.c 프로젝트: Memeriaj/osProject
void terminate(){
  int cur;
  setKernelDataSegment();
  cur = currentProcess;
  restoreDataSegment();
  killProcess(cur);
  while(1);
  return;
}
예제 #18
0
void LocalWorker::moveToStopList( int pid)
{
    PidList::iterator iter = m_pidList->find( (void *)pid );
    if ( iter != m_pidList->end() )
    {
        killProcess( pid );
        m_pidListStop->add( pid, DateTime::s_curTime - GRACE_TIMEOUT );
        m_pidList->erase( iter );
    }
}
void CMediaStreamingServerProfile::onEnable() {
    LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);
    iviLink::Error err = iviLink::Channel::allocateChannelAsServer(MEDIA_STREAMING_TAG, this, mChannelID, eRealTime);
    if (err.isNoError()) {
        LOG4CPLUS_INFO(msLogger, "Channel allocated, starting the communication...");
        mpSenderThread->start();
    } else {
        LOG4CPLUS_WARN(msLogger, "allocate Channel failed");
        killProcess(1);
    }
}
void CMediaControlServerProfile::onEnable() {
    LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);
    mChannelID = iviLink::Channel::allocateChannelAsServer(MEDIA_CONTROL_TAG, this, eRealTime);
    if (mChannelID) {
        LOG4CPLUS_INFO(msLogger, "Channel allocated, starting the communication...");
        mpSenderThread->start();
    } else {
        LOG4CPLUS_WARN(msLogger, "allocate Channel failed");
        killProcess(1);
    }
}
예제 #21
0
GameProcess::GameProcess(ConfigParser* config, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::GameProcess) {
    ui->setupUi(this);

    process = NULL;
    configParser = config;
    connect(ui->pushButton_config, SIGNAL(clicked()), this, SLOT(dumpConfigValues()));
    connect(ui->pushButton_kill, SIGNAL(clicked()), this, SLOT(killProcess()));
    connect(ui->pushButton_save, SIGNAL(clicked()), this, SLOT(saveLogToFile()));
    connect(ui->pushButton_clean, SIGNAL(clicked()), this, SLOT(clearOutputLogScreen()));
}
예제 #22
0
파일: kernel.c 프로젝트: Memeriaj/osProject
void handleInterrupt21(int ax, int bx, int cx, int dx){
  int cur;
  switch(ax){
    case 0x0: /*Print String*/
      printString(bx);
      break;
    case 0x1: /*Read String*/
      readString(bx);
      break;
    case 0x2: /*Read Sector*/
      readSector(bx, cx);
      break;
    case 0x3: /*Read File*/
      readFile(bx, cx);
      break;
    case 0x4: /*Execute Program*/
      executeProgram(bx, NOONE);
      break;
    case 0x5: /*Terminate Program*/
      terminate();
      break;
    case 0x6: /*Write Sector*/
      writeSector(bx, cx);
      break;
    case 0x7: /*Delete File*/
      deleteFile(bx);
      break;
    case 0x8: /*Write File*/
      writeFile(bx, cx, dx);
      break;
    case 0x9: /*Kill Process*/
      killProcess(bx);
      break;
    case 0xa: /*Execute Program in Blocking Fashion*/
      setKernelDataSegment();
      cur = currentProcess;
      restoreDataSegment();
      executeProgram(bx, cur);
      break;
    case 0xb:
      listProcesses();
      break;
    case 0xc:
      editString(bx);
      break;
    default:
      printString("Interrupt21 got undefined ax.");
      break;
  }

  return;
}
예제 #23
0
void UProcessView::setupActions()
{
    //结束进程。
    killProcessAction_ = new QAction(tr("Kill Process"),this);
    connect(killProcessAction_,SIGNAL(triggered()),this,SLOT(killProcess()));
    addAction(killProcessAction_);

    //选择列...
    horizontalHeader()->setContextMenuPolicy(Qt::ActionsContextMenu);
    selectColumnAction_ = new QAction(tr("Select Column..."),horizontalHeader());
    horizontalHeader()->addAction(selectColumnAction_);

}
예제 #24
0
    void run() override
    {
        while (! threadShouldExit())
        {
           #if RUN_CLANG_IN_CHILD_PROCESS
            if (parentProcessHasExited())
            {
                killProcess();
                break;
            }
           #endif

            wait (1000);
        }
    }
예제 #25
0
 void timerCallback() override
 {
     if (! MessageTypes::sendPing (owner))
     {
         if (++failedPings == 10)
         {
             killProcess();
             return;
         }
     }
     else
     {
         failedPings = 0;
     }
 }
void ConnectionClient::finishProcess()
{
    TIME_SCOPE_DURATION("ConnectionClient::finishProcess");

    processAliveTimer.stop();

    disconnectProcessFinished();
    endProcess();
    disconnectFromServer();
    terminateProcess();
    killProcess();

    process_.reset();

    serverProxy_.resetCounter();
}
예제 #27
0
void ServiceRepository::init()
{
    LOG4CPLUS_TRACE_METHOD(mLogger, __PRETTY_FUNCTION__ );
    std::string repoPath;
#ifndef ANDROID
    char buf[256];
    getcwd(buf,255);
    repoPath = std::string(buf)+"/../database/services/";
#else
    repoPath = mConfigurator->getParam("path_to_services");
#endif //ANDROID

    std::string dbPath = repoPath
            #ifndef ANDROID
            + "HeadUnitServices.xml";
            #else
            + "AndroidServices.xml";
            #endif //ANDROID

    LOG4CPLUS_INFO(mLogger, "services xml path = " + repoPath);
    LOG4CPLUS_INFO(mLogger, "DB path = " + dbPath);

    pugi::xml_document doc;

    pugi::xml_parse_result result = doc.load_file(dbPath.c_str());
    if (result)
    {
        pugi::xml_node device_node = doc.child("device");
        for (pugi::xml_node service_node = device_node.child("service");
                service_node; service_node = service_node.next_sibling("service"))
        {
            if (strcmp(service_node.attribute("name").value(), "") != 0)
            {
                Service::Uid sid = Service::Uid(service_node.attribute("name").value());
                std::string maniPath = repoPath + sid.value() + std::string(".xml");
                UInt32 prio = atoi(service_node.attribute("priority").value());
                mServices.insert(std::make_pair(sid,new ServiceInfo(maniPath, prio)));
            }
        }
    }
    else
    {
        LOG4CPLUS_FATAL(mLogger, "Service repository load error: " +
                std::string(result.description()));
        killProcess(1);
    }
}
void ConvertDialog::gocrFinish( KProcess *proc ) {
	disconnect( this, SIGNAL( cancelClicked() ), this, SLOT( killProcess() ) );
	if ( proc->exitStatus() == 0 ) {
		progress->advance( 1 );

		if ( sub == project->numSub() ) {
			delete proc;
			accept();
		} else {
			sub++;
			startGocr( proc );
		}
	} else {
		delete proc;
		reject();
	}
}
예제 #29
0
/*
 *  Constructs a fontProgressDialog which is a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'
 */
fontProgressDialog::fontProgressDialog(const QString& helpIndex, const QString& label, const QString& abortTip, const QString& whatsThis, const QString& ttip, QWidget* parent, bool progressbar)
  : KDialog( parent),
    TextLabel2(0),
    TextLabel1(0),
    ProgressBar1(0),
    progress(0),
    process(0)
{
  setCaption( i18n( "Font Generation Progress Dialog" ) );
  setModal( true );
  setButtons( Cancel );
  setDefaultButton( Cancel );
  setCursor(QCursor(Qt::WaitCursor));

  setButtonGuiItem(Cancel, KGuiItem(i18n("Abort"), "process-stop", abortTip));

  if (helpIndex.isEmpty() == false) {
    setHelp(helpIndex, "okular");
    setHelpLinkText( i18n( "What is happening here?") );
    enableLinkedHelp(true);
  } else
    enableLinkedHelp(false);

  KVBox* page = new KVBox( this );
  setMainWidget( page );

  TextLabel1   = new QLabel(label, page);
  TextLabel1->setAlignment(Qt::AlignCenter);
  TextLabel1->setWhatsThis( whatsThis );
  TextLabel1->setToolTip( ttip );

  if (progressbar) {
    ProgressBar1 = new QProgressBar( page );
    ProgressBar1->setFormat(i18n("%v of %m"));
    ProgressBar1->setWhatsThis( whatsThis );
    ProgressBar1->setToolTip( ttip );
  } else
    ProgressBar1 = NULL;

  TextLabel2   = new QLabel("", page);
  TextLabel2->setAlignment(Qt::AlignCenter);
  TextLabel2->setWhatsThis( whatsThis );
  TextLabel2->setToolTip( ttip );

  qApp->connect(this, SIGNAL(finished()), this, SLOT(killProcess()));
}
예제 #30
0
void handleInterrupt21(int ax, int bx, int cx, int dx) {
  if (ax == 0) { /* printString */
    printString(bx);
  } else if (ax == 1) {
    if (cx == 0) {
      readStringAndReturnSize(bx);
    } else {
      *((int*)cx) = readStringAndReturnSize(bx);
    }
  } else if (ax == 2) {
    readSector(bx, cx);
  } else if (ax == 3) {
    readFile(bx, cx, ROOT_SECTOR);
  } else if (ax == 4) {
    runProgram(bx, ROOT_SECTOR);
  } else if (ax == 5) {
    terminate();
  } else if (ax == 6) {
    writeSector(bx, cx);
  } else if (ax == 7) {
    deleteFile(bx, ROOT_SECTOR);
  } else if (ax == 8) {
    writeFile(bx, cx, dx, ROOT_SECTOR);
  } else if (ax == 9) {
    scanDirectory(bx, cx, dx);
  } else if (ax == 10) {
    killProcess(bx);
  } else if (ax == 11) {
    shellWait(runProgram(bx, ROOT_SECTOR));
  } else if (ax == 12) {
    clear();
  } else if (ax == 13) {
    printProcTable();
  } else {
    char errorMsg[8];
    errorMsg[0] = 'E';
    errorMsg[1] = 'r';
    errorMsg[2] = 'r';
    errorMsg[3] = 'o';
    errorMsg[4] = 'r';
    errorMsg[5] = '!';
    errorMsg[6] = '!';
    errorMsg[7] = '\0';
    printString(errorMsg);
  }
}