Beispiel #1
0
UserProcess::UserProcess(ustl::string filename, FileSystemInfo *fs_info, uint32 terminal_number) :
    Thread(fs_info, filename, Thread::USER_THREAD), fd_(VfsSyscall::open(filename, O_RDONLY))
{
  ProcessRegistry::instance()->processStart(); //should also be called if you fork a process

  if (fd_ >= 0)
    loader_ = new Loader(fd_);

  if (!loader_ || !loader_->loadExecutableAndInitProcess())
  {
    debug(USERPROCESS, "Error: loading %s failed!\n", filename.c_str());
    kill();
    return;
  }

  size_t page_for_stack = PageManager::instance()->allocPPN();
  bool vpn_mapped = loader_->arch_memory_.mapPage(USER_BREAK / PAGE_SIZE - 1, page_for_stack, 1);
  assert(vpn_mapped && "Virtual page for stack was already mapped - this should never happen");

  ArchThreads::createUserRegisters(user_registers_, loader_->getEntryFunction(),
                                   (void*) (USER_BREAK - sizeof(pointer)),
                                   getKernelStackStartPointer());

  ArchThreads::setAddressSpace(this, loader_->arch_memory_);

  debug(USERPROCESS, "ctor: Done loading %s\n", filename.c_str());

  if (main_console->getTerminal(terminal_number))
    setTerminal(main_console->getTerminal(terminal_number));

  switch_to_userspace_ = 1;
}
Beispiel #2
0
bool Settings::loadFile(QString filePath) {
  QSettings settings(filePath, QSettings::IniFormat);
  settings.beginGroup("System");
  fallbackIconThemeName_ = settings.value("FallbackIconThemeName").toString();
  if(fallbackIconThemeName_.isEmpty()) {
    // FIXME: we should choose one from installed icon themes or get
    // the value from XSETTINGS instead of hard code a fallback value.
    fallbackIconThemeName_ = "elementary"; // fallback icon theme name
  }
  suCommand_ = settings.value("SuCommand", "lxqt-sudo %s").toString();
  setTerminal(settings.value("Terminal", "xterm").toString());
  setArchiver(settings.value("Archiver", "file-roller").toString());
  setSiUnit(settings.value("SIUnit", false).toBool());

  setOnlyUserTemplates(settings.value("OnlyUserTemplates", false).toBool());
  setTemplateTypeOnce(settings.value("TemplateTypeOnce", false).toBool());
  setTemplateRunApp(settings.value("TemplateRunApp", false).toBool());

  settings.endGroup();

  settings.beginGroup("Behavior");
  bookmarkOpenMethod_ = bookmarkOpenMethodFromString(settings.value("BookmarkOpenMethod").toString());
  // settings for use with libfm
  useTrash_ = settings.value("UseTrash", true).toBool();
  singleClick_ = settings.value("SingleClick", false).toBool();
  autoSelectionDelay_ = settings.value("AutoSelectionDelay", 600).toInt();
  confirmDelete_ = settings.value("ConfirmDelete", true).toBool();
  setNoUsbTrash(settings.value("NoUsbTrash", false).toBool());
  confirmTrash_ = settings.value("ConfirmTrash", false).toBool();
  setQuickExec(settings.value("QuickExec", false).toBool());
  // bool thumbnailLocal_;
  // bool thumbnailMax;
  settings.endGroup();

  settings.beginGroup("Desktop");
  wallpaperMode_ = wallpaperModeFromString(settings.value("WallpaperMode").toString());
  wallpaper_ = settings.value("Wallpaper").toString();
  desktopBgColor_.setNamedColor(settings.value("BgColor", "#000000").toString());
  desktopFgColor_.setNamedColor(settings.value("FgColor", "#ffffff").toString());
  desktopShadowColor_.setNamedColor(settings.value("ShadowColor", "#000000").toString());
  if(settings.contains("Font"))
    desktopFont_.fromString(settings.value("Font").toString());
  else
    desktopFont_ = QApplication::font();
  desktopIconSize_ = settings.value("DesktopIconSize", 48).toInt();
  showWmMenu_ = settings.value("ShowWmMenu", false).toBool();
  desktopShowHidden_ = settings.value("ShowHidden", false).toBool();

  desktopSortOrder_ = sortOrderFromString(settings.value("SortOrder").toString());
  desktopSortColumn_ = sortColumnFromString(settings.value("SortColumn").toString());
  desktopSortFolderFirst_ = settings.value("SortFolderFirst", true).toBool();

  desktopCellMargins_ = (settings.value("DesktopCellMargins", QSize(3, 1)).toSize()
                         .expandedTo(QSize(0, 0))).boundedTo(QSize(48, 48));
  settings.endGroup();

  settings.beginGroup("Volume");
  mountOnStartup_ = settings.value("MountOnStartup", true).toBool();
  mountRemovable_ = settings.value("MountRemovable", true).toBool();
  autoRun_ = settings.value("AutoRun", true).toBool();
  closeOnUnmount_ = settings.value("CloseOnUnmount", true).toBool();
  settings.endGroup();

  settings.beginGroup("Thumbnail");
  showThumbnails_ = settings.value("ShowThumbnails", true).toBool();
  setMaxThumbnailFileSize(settings.value("MaxThumbnailFileSize", 4096).toInt());
  setThumbnailLocalFilesOnly(settings.value("ThumbnailLocalFilesOnly", true).toBool());
  settings.endGroup();

  settings.beginGroup("FolderView");
  viewMode_ = viewModeFromString(settings.value("Mode", Fm::FolderView::IconMode).toString());
  showHidden_ = settings.value("ShowHidden", false).toBool();
  sortOrder_ = sortOrderFromString(settings.value("SortOrder").toString());
  sortColumn_ = sortColumnFromString(settings.value("SortColumn").toString());
  sortFolderFirst_ = settings.value("SortFolderFirst", true).toBool();
  showFilter_ = settings.value("ShowFilter", false).toBool();

  setBackupAsHidden(settings.value("BackupAsHidden", false).toBool());
  showFullNames_ = settings.value("ShowFullNames", false).toBool();
  shadowHidden_ = settings.value("ShadowHidden", false).toBool();

  // override config in libfm's FmConfig
  bigIconSize_ = settings.value("BigIconSize", 48).toInt();
  smallIconSize_ = settings.value("SmallIconSize", 24).toInt();
  sidePaneIconSize_ = settings.value("SidePaneIconSize", 24).toInt();
  thumbnailIconSize_ = settings.value("ThumbnailIconSize", 128).toInt();

  folderViewCellMargins_ = (settings.value("FolderViewCellMargins", QSize(3, 3)).toSize()
                            .expandedTo(QSize(0, 0))).boundedTo(QSize(48, 48));
  settings.endGroup();

  settings.beginGroup("Places");
  placesHome_ = settings.value("PlacesHome", true).toBool();
  placesDesktop_ = settings.value("PlacesDesktop", true).toBool();
  placesApplications_ = settings.value("PlacesApplications", true).toBool();
  placesTrash_ = settings.value("PlacesTrash", true).toBool();
  placesRoot_ = settings.value("PlacesRoot", true).toBool();
  placesComputer_ = settings.value("PlacesComputer", true).toBool();
  placesNetwork_ = settings.value("PlacesNetwork", true).toBool();
  settings.endGroup();

  settings.beginGroup("Window");
  fixedWindowWidth_ = settings.value("FixedWidth", 640).toInt();
  fixedWindowHeight_ = settings.value("FixedHeight", 480).toInt();
  lastWindowWidth_ = settings.value("LastWindowWidth", 640).toInt();
  lastWindowHeight_ = settings.value("LastWindowHeight", 480).toInt();
  lastWindowMaximized_ = settings.value("LastWindowMaximized", false).toBool();
  rememberWindowSize_ = settings.value("RememberWindowSize", true).toBool();
  alwaysShowTabs_ = settings.value("AlwaysShowTabs", true).toBool();
  showTabClose_ = settings.value("ShowTabClose", true).toBool();
  splitterPos_ = settings.value("SplitterPos", 150).toInt();
  sidePaneMode_ = sidePaneModeFromString(settings.value("SidePaneMode").toString());
  showMenuBar_ = settings.value("ShowMenuBar", true).toBool();
  fullWidthTabBar_ = settings.value("FullWidthTabBar", true).toBool();
  settings.endGroup();

  return true;
}
Beispiel #3
0
int SshProcess::exec(const char *password, int check)
{
    if(check)
        setTerminal(true);

    KStringList args;
    args += "-l";
    args += m_User;
    args += "-o";
    args += "StrictHostKeyChecking=no";
    args += m_Host;
    args += m_Stub;

    if(StubProcess::exec("ssh", args) < 0)
    {
        return check ? SshNotFound : -1;
    }

    int ret = ConverseSsh(password, check);
    if(ret < 0)
    {
        if(!check)
            kdError(900) << k_lineinfo << "Conversation with ssh failed\n";
        return ret;
    }
    if(check == 2)
    {
        if(ret == 1)
        {
            kill(m_Pid, SIGTERM);
            waitForChild();
        }
        return ret;
    }

    if(m_bErase && password)
    {
        char *ptr = const_cast< char * >(password);
        const uint plen = strlen(password);
        for(unsigned i = 0; i < plen; i++)
            ptr[i] = '\000';
    }

    ret = ConverseStub(check);
    if(ret < 0)
    {
        if(!check)
            kdError(900) << k_lineinfo << "Converstation with kdesu_stub failed\n";
        return ret;
    }
    else if(ret == 1)
    {
        kill(m_Pid, SIGTERM);
        waitForChild();
        ret = SshIncorrectPassword;
    }

    if(check == 1)
    {
        waitForChild();
        return 0;
    }

    setExitString("Waiting for forwarded connections to terminate");
    ret = waitForChild();
    return ret;
}
Beispiel #4
0
 forall_listiterators(node, it, m_originalTerminals) {
     setTerminal(copiedNodes[*it], true);
 }