Пример #1
0
void voodoo_pci_device::device_start()
{
    voodoo_device::static_set_cpu_tag(m_voodoo, m_cpu_tag);
    voodoo_device::static_set_fbmem(m_voodoo, m_fbmem);
    voodoo_device::static_set_tmumem(m_voodoo, m_tmumem0, m_tmumem1);
    switch (m_type) {
    //void set_ids(UINT32 main_id, UINT8 revision, UINT32 pclass, UINT32 subsystem_id);
    case TYPE_VOODOO_1:
        set_ids(0x121a0001, 0x02, 0x000000, 0x000000);
        break;
    case TYPE_VOODOO_2:
        set_ids(0x121a0002, 0x02, 0x040000, 0x000000);
        break;
    case TYPE_VOODOO_BANSHEE:
        set_ids(0x121a0003, 0x02, 0x000003, 0x000000);
        break;
    //case TYPE_VOODOO_3
    default:
        set_ids(0x121a0005, 0x02, 0x000003, 0x000000);
        break;
    }
    pci_device::device_start();
    if (m_type<=TYPE_VOODOO_2) {
        add_map(16*1024*1024, M_MEM | M_PREF, FUNC(voodoo_pci_device::voodoo_reg_map));
    } else {
        add_map(32*1024*1024, M_MEM, FUNC(voodoo_pci_device::banshee_reg_map));
        add_map(32*1024*1024, M_MEM, FUNC(voodoo_pci_device::lfb_map));
        add_map(256, M_IO, FUNC(voodoo_pci_device::io_map));
    }
}
void cScreenGirlDetails::process()
{
	if (!ids_set) set_ids();	// we need to make sure the ID variables are set
	if (check_keys()) return;	// handle arrow keys
	init();						// set up the window if needed
	check_events();				// check to see if there's a button event needing handling
}
Пример #3
0
t_input		*shift_or_input(t_execution *exec, t_input *input)
{
  t_input	*tmp;

  tmp = input;
  if (!exec->r_value)
    {
      while (tmp->flag == 3 || tmp->flag == 2)
	{
	  tmp = tmp->next;
	  input_free(tmp);
	}
    }
  if (!tmp->flag)
    {
      tab_free(tmp->text);
      free(tmp);
      return (NULL);
    }
  else
    {
      tmp = tmp->next;
      input_free(tmp);
      exec->input = tmp;
    }
  set_ids((input = tmp));
  return (input);
}
Пример #4
0
void cArenaTry::process()
{
	if (!ids_set) set_ids();							// we need to make sure the ID variables are set
	init();
	if (g_InterfaceEvents.GetNumEvents() == 0) return;	// no events means we can go home

	/*
	*	otherwise, compare event IDs
	*
	*	if it's the back button, pop the window off the stack
	*	and we're done
	*/
	if (g_InterfaceEvents.CheckButton(back_id))
	{
		g_InitWin = true;
		g_WinManager.Pop();
		return;
	}
	else if (g_InterfaceEvents.CheckButton(walk_id))
	{
		do_walk();
		if (!g_Cheats) g_TryOuts = true;
		g_InitWin = true;
	}
}
Пример #5
0
void
file_close(ARCHD *arcn, int fd)
{
    int res = 0;

    if (fd < 0)
        return;
    if (close(fd) < 0)
        syswarn(0, errno, "Unable to close file descriptor on %s",
                arcn->name);

    /*
     * set owner/groups first as this may strip off mode bits we want
     * then set file permission modes. Then set file access and
     * modification times.
     */
    if (pids)
        res = set_ids(arcn->name, arcn->sb.st_uid, arcn->sb.st_gid);

    /*
     * IMPORTANT SECURITY NOTE:
     * if not preserving mode or we cannot set uid/gid, then PROHIBIT
     * set uid/gid bits
     */
    if (!pmode || res)
        arcn->sb.st_mode &= ~(SETBITS);
    if (pmode)
        set_pmode(arcn->name, arcn->sb.st_mode);
    if (patime || pmtime)
        set_ftime(arcn->name, arcn->sb.st_mtime, arcn->sb.st_atime, 0);
}
Пример #6
0
pci9050_device::pci9050_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
	: pci_device(mconfig, PCI9050, tag, owner, clock)
	, m_user_input_handler(*this), m_user_output_handler(*this)
{
	set_ids(0x10b59050, 0x01, 0x06800000, 0x10b59050);
	for(int i=0; i<4; i++) {
		m_devices[i] = nullptr;
		m_names[i] = nullptr;
	}
}
Пример #7
0
void cScreenBrothelManagement::process()
{
	g_CurrentScreen = SCREEN_BROTHEL;

	if (!id_set)
		set_ids();

	if (check_keys())
		return;

	init();

	check_events();
}
Пример #8
0
void cScreenGetInput::process()
{
	g_CurrentScreen = SCREEN_BROTHEL;

	if (!ids_set)
		set_ids();

	if (check_keys())
		return;

	init();

	check_events();
}
Пример #9
0
void voodoo_pci_device::device_start()
{
	voodoo_device::static_set_cpu_tag(*m_voodoo, m_cpu_tag);
	voodoo_device::static_set_fbmem(*m_voodoo, m_fbmem);
	voodoo_device::static_set_tmumem(*m_voodoo, m_tmumem0, m_tmumem1);
	switch (m_type) {
		//void set_ids(uint32_t main_id, uint8_t revision, uint32_t pclass, uint32_t subsystem_id);
		case TYPE_VOODOO_1:
			set_ids(0x121a0001, 0x02, 0x030000, 0x000000);
			break;
		case TYPE_VOODOO_2:
			set_ids(0x121a0002, 0x02, 0x038000, 0x000000);
			break;
		case TYPE_VOODOO_BANSHEE:
			set_ids(0x121a0003, 0x02, 0x030000, 0x000000);
			break;
		//case TYPE_VOODOO_3
		default:
			set_ids(0x121a0005, 0x02, 0x030000, 0x000000);
			break;
	}
	pci_device::device_start();
	if (m_type<=TYPE_VOODOO_2) {
		add_map(16*1024*1024, M_MEM | M_PREF, FUNC(voodoo_pci_device::voodoo_reg_map));
		bank_infos[0].adr = 0xff000000;
	} else {
		add_map(32*1024*1024, M_MEM, FUNC(voodoo_pci_device::banshee_reg_map));
		add_map(32*1024*1024, M_MEM, FUNC(voodoo_pci_device::lfb_map));
		add_map(256, M_IO, FUNC(voodoo_pci_device::io_map));
		bank_infos[0].adr = 0xf8000000;
		bank_infos[1].adr = 0xf8000008;
		bank_infos[2].adr = 0xfffffff0;
	}

	save_item(NAME(m_pcictrl_reg));
}
Пример #10
0
/*
 * Transforms the input data to a matrix
 */
Dmatrix::Dmatrix(const std::vector < Matrix_cell_t > &data_costs) {
    set_ids(data_costs);
    costs.resize(
            ids.size(),
            std::vector<double>(
                ids.size(),
                (std::numeric_limits<double>::max)()));

    for (const auto &data : data_costs) {
        costs[get_index(data.from_vid)][get_index(data.to_vid)] = data.cost;
    }

    for (size_t i = 0; i < costs.size(); ++i) {
        costs[i][i] = 0;
    }
}
Пример #11
0
t_input		*shift_sc_input(t_execution *exec, t_input *input)
{
  t_input	*tmp;

  tmp = input;
  if (!tmp->flag)
    {
      tab_free(tmp->text);
      free(tmp);
      return (NULL);
    }
  else
    {
      tmp = tmp->next;
      input_free(input);
      exec->input = tmp;
    }
  set_ids((input = tmp));
  return (input);
}
Пример #12
0
void cScreenTown::process()
{
	if (!ids_set)set_ids();								// we need to make sure the ID variables are set
	init();
	if (g_InterfaceEvents.GetNumEvents() == 0) return;	// no events means we can go home
	if (girlimage_id != -1 && !eventrunning)	HideImage(girlimage_id, true);

	/*
	*	otherwise, compare event IDs
	*
	*	if it's the back button, pop the window off the stack
	*	and we're done
	*/
	/* */if (g_InterfaceEvents.CheckButton(back_id))		{ g_InitWin = true;		g_WinManager.Pop();					return; }
	else if (g_InterfaceEvents.CheckButton(slavemarket_id)) { g_InitWin = true;		g_WinManager.push("Slave Market");	return; }
	else if (g_InterfaceEvents.CheckButton(prison_id))		{ g_InitWin = true;		g_WinManager.push("Prison");		return; }
	else if (g_InterfaceEvents.CheckButton(house_id))		{ g_Building = BUILDING_HOUSE;	g_CurrHouse = 0;	g_InitWin = true;	g_WinManager.push("Player House");	return; }
	else if (g_InterfaceEvents.CheckButton(clinic_id))		{ check_clinic(0);		g_InitWin = true;			return; }
	else if (g_InterfaceEvents.CheckButton(studio_id))		{ check_studio(0);		g_InitWin = true;			return; }
	else if (g_InterfaceEvents.CheckButton(arena_id))		{ check_arena(0);		g_InitWin = true;			return; }
	else if (g_InterfaceEvents.CheckButton(centre_id))		{ check_centre(0);		g_InitWin = true;			return; }
	else if (g_InterfaceEvents.CheckButton(farm_id))		{ check_farm(0);		g_InitWin = true;			return; }
	else if (g_InterfaceEvents.CheckButton(mayor_id))		{ g_InitWin = true;		g_WinManager.push("Mayor");	return; }
	else if (g_InterfaceEvents.CheckButton(bank_id))		{ g_InitWin = true;		g_WinManager.push("Bank");	return; }
	else if (g_InterfaceEvents.CheckButton(shop_id))		{ g_InitWin = true;		g_AllTogle = false;	g_WinManager.push("Item Management");	return; }
	else if (g_InterfaceEvents.CheckButton(brothel0_id))	{ check_brothel(0);		g_InitWin = true;	return; }
	else if (g_InterfaceEvents.CheckButton(brothel1_id))	{ check_brothel(1);		g_InitWin = true;	return; }
	else if (g_InterfaceEvents.CheckButton(brothel2_id))	{ check_brothel(2);		g_InitWin = true;	return; }
	else if (g_InterfaceEvents.CheckButton(brothel3_id))	{ check_brothel(3);		g_InitWin = true;	return; }
	else if (g_InterfaceEvents.CheckButton(brothel4_id))	{ check_brothel(4);		g_InitWin = true;	return; }
	else if (g_InterfaceEvents.CheckButton(brothel5_id))	{ check_brothel(5);		g_InitWin = true;	return; }
	else if (g_InterfaceEvents.CheckButton(brothel6_id))	{ check_brothel(6);		g_InitWin = true;	return; }
	else if (g_InterfaceEvents.CheckButton(walk_id))		{ do_walk();			if (!g_Cheats) g_WalkAround = true;	g_InitWin = true; }
	else if (g_InterfaceEvents.CheckButton(setup_id))		{ g_InitWin = true;		g_WinManager.push("Property Management");		return; }	// `J` added

}
Пример #13
0
int
node_creat(ARCHD *arcn)
{
	int res;
	int ign = 0;
	int oerrno;
	int pass = 0;
	mode_t file_mode;
	struct stat sb;
	char target[MAXPATHLEN];
	char *nm = arcn->name;
	int len;

	/*
	 * create node based on type, if that fails try to unlink the node and
	 * try again. finally check the path and try again. As noted in the
	 * file and link creation routines, this method seems to exhibit the
	 * best performance in general use workloads.
	 */
	file_mode = arcn->sb.st_mode & FILEBITS(arcn->type == PAX_DIR);

	for (;;) {
		switch (arcn->type) {
		case PAX_DIR:
			/*
			 * If -h (or -L) was given in tar-mode, follow the
			 * potential symlink chain before trying to create the
			 * directory.
			 */
			if (strcmp(NM_TAR, argv0) == 0 && Lflag) {
				while (lstat(nm, &sb) == 0 &&
				    S_ISLNK(sb.st_mode)) {
					len = readlink(nm, target,
					    sizeof target - 1);
					if (len == -1) {
						syswarn(0, errno,
						   "cannot follow symlink %s "
						   "in chain for %s",
						    nm, arcn->name);
						res = -1;
						goto badlink;
					}
					target[len] = '\0';
					nm = target;
				}
			}
			res = domkdir(nm, file_mode);
badlink:
			if (ign)
				res = 0;
			break;
		case PAX_CHR:
			file_mode |= S_IFCHR;
			res = mknod(nm, file_mode, arcn->sb.st_rdev);
			break;
		case PAX_BLK:
			file_mode |= S_IFBLK;
			res = mknod(nm, file_mode, arcn->sb.st_rdev);
			break;
		case PAX_FIF:
			res = mkfifo(nm, file_mode);
			break;
		case PAX_SCK:
			/*
			 * Skip sockets, operation has no meaning under BSD
			 */
			tty_warn(0,
			    "%s skipped. Sockets cannot be copied or extracted",
			    nm);
			return (-1);
		case PAX_SLK:
			res = symlink(arcn->ln_name, nm);
			break;
		case PAX_CTG:
		case PAX_HLK:
		case PAX_HRG:
		case PAX_REG:
		default:
			/*
			 * we should never get here
			 */
			tty_warn(0, "%s has an unknown file type, skipping",
			    nm);
			return (-1);
		}

		/*
		 * if we were able to create the node break out of the loop,
		 * otherwise try to unlink the node and try again. if that
		 * fails check the full path and try a final time.
		 */
		if (res == 0)
			break;

		/*
		 * we failed to make the node
		 */
		oerrno = errno;
		switch (pass++) {
		case 0:
			if ((ign = unlnk_exist(nm, arcn->type)) < 0)
				return (-1);
			continue;

		case 1:
			if (nodirs ||
			    chk_path(nm, arcn->sb.st_uid,
			    arcn->sb.st_gid) < 0) {
				syswarn(1, oerrno, "Cannot create %s", nm);
				return (-1);
			}
			continue;
		}

		/*
		 * it must be a file that exists but we can't create or
		 * remove, but we must avoid the infinite loop.
		 */
		break;
	}

	/*
	 * we were able to create the node. set uid/gid, modes and times
	 */
	if (pids)
		res = set_ids(nm, arcn->sb.st_uid, arcn->sb.st_gid);
	else
		res = 0;

	/*
	 * IMPORTANT SECURITY NOTE:
	 * if not preserving mode or we cannot set uid/gid, then PROHIBIT any
	 * set uid/gid bits
	 */
	if (!pmode || res)
		arcn->sb.st_mode &= ~SETBITS(arcn->type == PAX_DIR);
	if (pmode)
		set_pmode(arcn->name, arcn->sb.st_mode);

	if (arcn->type == PAX_DIR && strcmp(NM_CPIO, argv0) != 0) {
		/*
		 * Dirs must be processed again at end of extract to set times
		 * and modes to agree with those stored in the archive. However
		 * to allow extract to continue, we may have to also set owner
		 * rights. This allows nodes in the archive that are children
		 * of this directory to be extracted without failure. Both time
		 * and modes will be fixed after the entire archive is read and
		 * before pax exits.
		 */
		if (access(nm, R_OK | W_OK | X_OK) < 0) {
			if (lstat(nm, &sb) < 0) {
				syswarn(0, errno,"Cannot access %s (stat)",
				    arcn->name);
				set_pmode(nm,file_mode | S_IRWXU);
			} else {
				/*
				 * We have to add rights to the dir, so we make
				 * sure to restore the mode. The mode must be
				 * restored AS CREATED and not as stored if
				 * pmode is not set.
				 */
				set_pmode(nm, ((sb.st_mode &
				    FILEBITS(arcn->type == PAX_DIR)) |
				    S_IRWXU));
				if (!pmode)
					arcn->sb.st_mode = sb.st_mode;
			}

			/*
			 * we have to force the mode to what was set here,
			 * since we changed it from the default as created.
			 */
			add_dir(nm, arcn->nlen, &(arcn->sb), 1);
		} else if (pmode || patime || pmtime)
			add_dir(nm, arcn->nlen, &(arcn->sb), 0);
	}

	if (patime || pmtime)
		set_ftime(arcn->name, arcn->sb.st_mtime,
		    arcn->sb.st_atime, 0, (arcn->type == PAX_SLK) ? 1 : 0);

#if HAVE_STRUCT_STAT_ST_FLAGS
	if (pfflags && arcn->type != PAX_SLK)
		set_chflags(arcn->name, arcn->sb.st_flags);
#endif
	return 0;
}
Пример #14
0
void
file_close(ARCHD *arcn, int fd)
{
	char *tmp_name;
	int res;

	if (fd < 0)
		return;

	tmp_name = (arcn->tmp_name != NULL) ? arcn->tmp_name : arcn->name;

	if (close(fd) < 0)
		syswarn(0, errno, "Cannot close file descriptor on %s",
		    tmp_name);

	/*
	 * set owner/groups first as this may strip off mode bits we want
	 * then set file permission modes. Then set file access and
	 * modification times.
	 */
	if (pids)
		res = set_ids(tmp_name, arcn->sb.st_uid, arcn->sb.st_gid);
	else
		res = 0;

	/*
	 * IMPORTANT SECURITY NOTE:
	 * if not preserving mode or we cannot set uid/gid, then PROHIBIT
	 * set uid/gid bits but restore the file modes (since mkstemp doesn't).
	 */
	if (!pmode || res)
		arcn->sb.st_mode &= ~SETBITS(0);
	if (pmode)
		set_pmode(tmp_name, arcn->sb.st_mode);
	else
		set_pmode(tmp_name,
		    apply_umask((arcn->sb.st_mode & FILEBITS(0))));
	if (patime || pmtime)
		set_ftime(tmp_name, arcn->sb.st_mtime,
		    arcn->sb.st_atime, 0, 0);

	/* Did we write directly to the target file? */
	if (arcn->tmp_name == NULL)
		return;

	/*
	 * Finally, now the temp file is fully instantiated rename it to
	 * the desired file name.
	 */
	if (rename(tmp_name, arcn->name) < 0) {
		syswarn(0, errno, "Cannot rename %s to %s",
		    tmp_name, arcn->name);
		(void)unlink(tmp_name);
	}

#if HAVE_STRUCT_STAT_ST_FLAGS
	if (pfflags && arcn->type != PAX_SLK)
		set_chflags(arcn->name, arcn->sb.st_flags);
#endif

	free(arcn->tmp_name);
	arcn->tmp_name = NULL;
	xtmp_name = NULL;
}
Пример #15
0
void extra_create()
{
  set_ids(FAID_IDS);
  set_short(FAID_SHORT);
  set_long(FAID_LONG);
}
Пример #16
0
void cClinicScreen::process()
{
	/*
	*	we need to make sure the ID variables are set
	*/
	if (!ids_set) set_ids();
	init();

	if (g_InitWin)
	{
		EditTextItem(g_Clinic.GetBrothelString(0), clinicdetails_id);
		g_InitWin = false;
	}
	/*
	*	no events means we can go home
	*/
	if (g_InterfaceEvents.GetNumEvents() == 0) return;

	/*
	*	otherwise, compare event IDs
	*
	*	if it's the back button, pop the window off the stack
	*	and we're done
	*/
	if (g_InterfaceEvents.CheckButton(back_id))
	{
		g_InitWin = true;
		g_WinManager.Pop();
		return;
	}
	else if (g_InterfaceEvents.CheckButton(walk_id))
	{
		g_InitWin = true;
		g_WinManager.push("Clinic Try");
		return;
	}
	else if (g_InterfaceEvents.CheckButton(girls_id))
	{
		g_InitWin = true;
		g_WinManager.push("Clinic");
		return;
	}
	else if (g_InterfaceEvents.CheckButton(staff_id))
	{
		g_InitWin = true;
		g_WinManager.push("Gangs");
		return;
	}
	else if (g_InterfaceEvents.CheckButton(turns_id))
	{
		g_InitWin = true;
		g_WinManager.push("TurnSummary");
		return;
	}
	else if (g_InterfaceEvents.CheckButton(setup_id))
	{
		g_Building = BUILDING_CLINIC;
		g_InitWin = true;
		g_WinManager.push("Building Setup");
		return;
	}
	else if (g_InterfaceEvents.CheckButton(dungeon_id))
	{
		g_InitWin = true;
		g_WinManager.push("Dungeon");
		return;
	}
	else if (g_InterfaceEvents.CheckButton(weeks_id))
	{
		g_InitWin = true;
		if (!g_CTRLDown) { g_CTRLDown = false; AutoSaveGame(); }
		NextWeek();
		g_WinManager.push("TurnSummary");
		return;
	}
}
Пример #17
0
int
chk_path( char *name, uid_t st_uid, gid_t st_gid)
{
    char *spt = name;
    struct stat sb;
    int retval = -1;

    /*
     * watch out for paths with nodes stored directly in / (e.g. /bozo)
     */
    if (*spt == '/')
        ++spt;

    for(;;) {
        /*
         * work foward from the first / and check each part of the path
         */
        spt = strchr(spt, '/');
        if (spt == NULL)
            break;
        *spt = '\0';

        /*
         * if it exists we assume it is a directory, it is not within
         * the spec (at least it seems to read that way) to alter the
         * file system for nodes NOT EXPLICITLY stored on the archive.
         * If that assumption is changed, you would test the node here
         * and figure out how to get rid of it (probably like some
         * recursive unlink()) or fix up the directory permissions if
         * required (do an access()).
         */
        if (lstat(name, &sb) == 0) {
            *(spt++) = '/';
            continue;
        }

        /*
         * the path fails at this point, see if we can create the
         * needed directory and continue on
         */
        if (mkdir(name, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
            *spt = '/';
            retval = -1;
            break;
        }

        /*
         * we were able to create the directory. We will tell the
         * caller that we found something to fix, and it is ok to try
         * and create the node again.
         */
        retval = 0;
        if (pids)
            (void)set_ids(name, st_uid, st_gid);

        /*
         * make sure the user doen't have some strange umask that
         * causes this newly created directory to be unusable. We fix
         * the modes and restore them back to the creation default at
         * the end of pax
         */
        if ((access(name, R_OK | W_OK | X_OK) < 0) &&
                (lstat(name, &sb) == 0)) {
            set_pmode(name, ((sb.st_mode & FILEBITS) | S_IRWXU));
            add_dir(name, spt - name, &sb, 1);
        }
        *(spt++) = '/';
        continue;
    }
    return(retval);
}
Пример #18
0
void cScreenMayor::process()
{
	if (!ids_set) set_ids();		// we need to make sure the ID variables are set
	init();							// set up the window if needed
	check_events();					// check to see if there's a button event needing handling
}
Пример #19
0
int
node_creat(ARCHD *arcn)
{
    int res;
    int ign = 0;
    int oerrno;
    int pass = 0;
    mode_t file_mode;
    struct stat sb;

    /*
     * create node based on type, if that fails try to unlink the node and
     * try again. finally check the path and try again. As noted in the
     * file and link creation routines, this method seems to exhibit the
     * best performance in general use workloads.
     */
    file_mode = arcn->sb.st_mode & FILEBITS;

    for (;;) {
        switch(arcn->type) {
        case PAX_DIR:
            res = mkdir(arcn->name, file_mode);
            if (ign)
                res = 0;
            break;
        case PAX_CHR:
            file_mode |= S_IFCHR;
            res = mknod(arcn->name, file_mode, arcn->sb.st_rdev);
            break;
        case PAX_BLK:
            file_mode |= S_IFBLK;
            res = mknod(arcn->name, file_mode, arcn->sb.st_rdev);
            break;
        case PAX_FIF:
            res = mkfifo(arcn->name, file_mode);
            break;
        case PAX_SCK:
            /*
             * Skip sockets, operation has no meaning under BSD
             */
            paxwarn(0,
                    "%s skipped. Sockets cannot be copied or extracted",
                    arcn->name);
            return(-1);
        case PAX_SLK:
            res = symlink(arcn->ln_name, arcn->name);
            break;
        case PAX_CTG:
        case PAX_HLK:
        case PAX_HRG:
        case PAX_REG:
        default:
            /*
             * we should never get here
             */
            paxwarn(0, "%s has an unknown file type, skipping",
                    arcn->name);
            return(-1);
        }

        /*
         * if we were able to create the node break out of the loop,
         * otherwise try to unlink the node and try again. if that
         * fails check the full path and try a final time.
         */
        if (res == 0)
            break;

        /*
         * we failed to make the node
         */
        oerrno = errno;
        if ((ign = unlnk_exist(arcn->name, arcn->type)) < 0)
            return(-1);

        if (++pass <= 1)
            continue;

        if (nodirs || chk_path(arcn->name,arcn->sb.st_uid,arcn->sb.st_gid) < 0) {
            syswarn(1, oerrno, "Could not create: %s", arcn->name);
            return(-1);
        }
    }

    /*
     * we were able to create the node. set uid/gid, modes and times
     */
    if (pids)
        res = ((arcn->type == PAX_SLK) ?
               set_lids(arcn->name, arcn->sb.st_uid, arcn->sb.st_gid) :
               set_ids(arcn->name, arcn->sb.st_uid, arcn->sb.st_gid));
    else
        res = 0;

    /*
     * symlinks are done now.
     */
    if (arcn->type == PAX_SLK)
        return(0);

    /*
     * IMPORTANT SECURITY NOTE:
     * if not preserving mode or we cannot set uid/gid, then PROHIBIT any
     * set uid/gid bits
     */
    if (!pmode || res)
        arcn->sb.st_mode &= ~(SETBITS);
    if (pmode)
        set_pmode(arcn->name, arcn->sb.st_mode);

    if (arcn->type == PAX_DIR && strcmp(NM_CPIO, argv0) != 0) {
        /*
         * Dirs must be processed again at end of extract to set times
         * and modes to agree with those stored in the archive. However
         * to allow extract to continue, we may have to also set owner
         * rights. This allows nodes in the archive that are children
         * of this directory to be extracted without failure. Both time
         * and modes will be fixed after the entire archive is read and
         * before pax exits.
         */
        if (access(arcn->name, R_OK | W_OK | X_OK) < 0) {
            if (lstat(arcn->name, &sb) < 0) {
                syswarn(0, errno,"Could not access %s (stat)",
                        arcn->name);
                set_pmode(arcn->name,file_mode | S_IRWXU);
            } else {
                /*
                 * We have to add rights to the dir, so we make
                 * sure to restore the mode. The mode must be
                 * restored AS CREATED and not as stored if
                 * pmode is not set.
                 */
                set_pmode(arcn->name,
                          ((sb.st_mode & FILEBITS) | S_IRWXU));
                if (!pmode)
                    arcn->sb.st_mode = sb.st_mode;
            }

            /*
             * we have to force the mode to what was set here,
             * since we changed it from the default as created.
             */
            add_dir(arcn->name, arcn->nlen, &(arcn->sb), 1);
        } else if (pmode || patime || pmtime)
            add_dir(arcn->name, arcn->nlen, &(arcn->sb), 0);
    }

    if (patime || pmtime)
        set_ftime(arcn->name, arcn->sb.st_mtime, arcn->sb.st_atime, 0);
    return(0);
}
Пример #20
0
crush11_memory_device::crush11_memory_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
	: pci_device(mconfig, CRUSH11_MEMORY, tag, owner, clock)
{
	set_ids(0x10de01ac, 0, 0, 0);
}
Пример #21
0
int main_searchvariants(int argc, char* argv[],char *server_url)
{
	int cmd;
	int i;
	search_variant_request *request=(search_variant_request*)malloc(1*sizeof(search_variant_request));	
	int size_variants = 0;
	int size_calls = 0;
	request->name = "null";
	request->pageToken ="null";
	char debug = 0;
	
	static struct option long_options[]={
		{"variantSetIds",required_argument,0,'v'},
		{"referenceName",required_argument,0,'r'},
		{"start",required_argument,0,'s'},
		{"end",required_argument,0,'e'},
		{"callSetIds",required_argument,0,'c'},
		{"variantName",required_argument,0,'n'},
		{"debug",no_argument,0,'d'},
		{0,0,0,0}
	};
	//if(argc < 2)
	while((cmd=getopt_long(argc,argv,"v:r:s:e:c:n:d",long_options,NULL))!=-1)
	{
		switch(cmd)
		{
			case 'v':
					if(optarg==NULL||(strcmp(optarg,"")==0))
						{
							error("--variantSetIds string can't be empty.\n");	
						}
					  else
						{
							size_variants = count_ids(optarg);
						 	request->variantSetIds = (char**)malloc(size_variants*sizeof(char*));
							set_ids(optarg,request->variantSetIds,size_variants);
						}
						break;
			case 'r':
					if(optarg==NULL||(strcmp(optarg,"")==0))
						{
							error("--referenceName string can't be empty.\n");				
						}
					  else
						{
							request->referenceName = optarg; 
						  	
						}
						break;
			case 's': request->start = atol(optarg);
					if(request->start < 0)
					{
					  	error("--start integer must be no negative.");
					}
					break;
			case 'e': request->end = atol(optarg); 
					if(request->end < 0)
					{
						perror("--end integer must be no negative.");
					}
					break;
			case 'c': if(optarg==NULL||(strcmp(optarg,"")==0))
						{
							size_calls = 0;
						}
					  else
					  	{
					  		size_calls = count_ids(optarg);
						  	request->callSetIds = (char**)malloc(size_calls*sizeof(char*));
						  	set_ids(optarg,request->callSetIds,size_calls);
					  	}
					break;
			case 'n': request->name = optarg; break;
			case 'd': debug = 1; break;
			case '?': usage();
			default: error("Unknown argument %s\n",optarg);
		}
	}
	
	if(size_variants==0)
	{
		usage();
	}
	
	start_user(server_url);
	char* vcf_file_name;
	//process each variantSet
	for(i=0; i<size_variants; i++)
	{
		
		vcf_file_name = get_variantSetId_vcf_name(request,i);
		create_vcf_file(vcf_file_name);	
		
		while(strcmp(request->pageToken,"NULL")!=0)
		{
			user->post_fields = create_request_string(request,i,size_calls);
			//printf("post field string: %s \n",user->post_fields);
			client_search_request(user,"variants");
			//printf("%s\n",user->response);
			write_vcf_file(user->response,vcf_file_name);
			request->pageToken = get_pageToken();
			//printf("%s \n",request->pageToken);
			if(debug)
			{
				printf("%s\n",user->response);
			}
		}
	}
	end_user();
	return 0;
}
Пример #22
0
sega_lindbergh_baseboard_device::sega_lindbergh_baseboard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
	: pci_device(mconfig, SEGA_LINDBERGH_BASEBOARD, tag, owner, clock)
{
	set_ids(0x105718c1, 0x10, 0x068000, 0x11db067b);
}