Exemple #1
0
static void set_dcb_priority(struct iscsi_conn *conn, const char *devname)
{
	int pri_mask = 0;

	pri_mask = get_dcb_app_pri_by_stream_port(devname, ISCSI_DEFAULT_PORT);
	if (pri_mask < 0)
		log_debug(2, "Getting priority for %s returned %d",
				devname, pri_mask);
	else if (pri_mask == 0)
		log_debug(2, "No priority for %s", devname);
	else {
		int pri = select_priority(conn, pri_mask);
		int rc;

		log_debug(1, "Setting socket %d priority to %d",
				conn->socket_fd, pri);
		rc = setsockopt(conn->socket_fd, SOL_SOCKET,
				SO_PRIORITY, &pri, sizeof(pri));
		if (rc < 0) {
			log_warning("Setting socket %d priority to %d failed "
					"with errno %d", conn->socket_fd,
					pri, errno);
		}
	}
}
Exemple #2
0
optdlg_mkvmerge_tab::optdlg_mkvmerge_tab(wxWindow *parent,
                                         mmg_options_t &options)
  : optdlg_base_tab(parent, options)
{
  // Setup static variables.

  if (cob_priority_translations.entries.empty()) {
#ifdef SYS_WINDOWS
    cob_priority_translations.add(wxT("highest"), Z("highest"));
    cob_priority_translations.add(wxT("higher"),  Z("higher"));
#endif
    cob_priority_translations.add(wxT("normal"),  Z("normal"));
    cob_priority_translations.add(wxT("lower"),   Z("lower"));
    cob_priority_translations.add(wxT("lowest"),  Z("lowest"));
  }

  // Create the controls.

  wxStaticText *st_mkvmerge = new wxStaticText(this, -1, Z("mkvmerge executable"));
  tc_mkvmerge               = new wxTextCtrl(this, ID_TC_MKVMERGE, m_options.mkvmerge);
  wxButton *b_browse        = new wxButton(this, ID_B_BROWSEMKVMERGE, Z("Browse"));

  wxStaticText *st_priority = new wxStaticText(this, -1, Z("Process priority:"));
  cob_priority              = new wxMTX_COMBOBOX_TYPE(this, ID_COB_PRIORITY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_DROPDOWN | wxCB_READONLY);

  cob_priority->SetToolTip(TIP("Sets the priority that mkvmerge will run with. "
                               "Chosing 'lowest' will cause mkvmerge to select a low I/O priority as well."));

  size_t i;
  for (i = 0; cob_priority_translations.entries.size() > i; ++i)
    cob_priority->Append(cob_priority_translations.entries[i].translated);

  // Set the defaults.

  select_priority(m_options.priority);

  // Create the layout.

  wxBoxSizer *siz_all = new wxBoxSizer(wxVERTICAL);

  siz_all->AddSpacer(5);

  siz_all->Add(new wxStaticText(this, wxID_ANY, Z("mkvmerge options")), 0, wxGROW | wxLEFT | wxRIGHT, 5);
  siz_all->AddSpacer(5);
  siz_all->Add(new wxStaticLine(this),                                  0, wxGROW | wxLEFT | wxRIGHT, 5);
  siz_all->AddSpacer(5);

  wxFlexGridSizer *siz_fg = new wxFlexGridSizer(3);
  siz_fg->AddGrowableCol(1);

  siz_fg->Add(st_mkvmerge, 0, wxALIGN_CENTER_VERTICAL, 0);
  siz_fg->Add(tc_mkvmerge, 1, wxGROW | wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxLEFT, 5);
  siz_fg->Add(b_browse, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 5);

  siz_fg->Add(st_priority, 0, wxALIGN_CENTER_VERTICAL, 0);
  siz_fg->Add(cob_priority, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 5);

  siz_all->Add(siz_fg, 0, wxGROW | wxLEFT | wxRIGHT, 5);
  siz_all->AddSpacer(5);

  SetSizerAndFit(siz_all);
}