示例#1
0
/* if the first arg was an fd, find out which one it was. */
unsigned int check_if_fd(unsigned int child)
{
	unsigned int highest;
	unsigned callno = shm->syscallno[child];

	/* shortcut, if it's out of range, it's not going to be valid. */
	if (shm->a1[child] > 1024)
		return FALSE;

	highest = highest_logfile();
	if (shm->a1[child] < highest)
		return FALSE;

	if (biarch == FALSE) {
		if (syscalls[callno].entry->arg1type == ARG_FD)
			return TRUE;
		return FALSE;
	}

	/* biarch case */
	if (shm->do32bit[child] == TRUE) {
		if (syscalls_32bit[callno].entry->arg1type == ARG_FD)
			return TRUE;
	} else {
		if (syscalls_64bit[callno].entry->arg1type == ARG_FD)
			return TRUE;
	}

	return FALSE;
}
示例#2
0
/* if the first arg was an fd, find out which one it was. */
unsigned int check_if_fd(unsigned int child)
{
	unsigned int fd = shm->syscall[child].a1;
	unsigned int highest;
	unsigned callno;
	bool do32;

	/* shortcut, if it's out of range, it's not going to be valid. */
	if (fd > 1024)
		return FALSE;

	highest = highest_logfile();
	if (fd < highest)
		return FALSE;

	lock(&shm->syscall_lock);
	callno = shm->syscall[child].nr;
	do32 = shm->syscall[child].do32bit;
	unlock(&shm->syscall_lock);

	if (biarch == FALSE) {
		if (syscalls[callno].entry->arg1type == ARG_FD)
			return TRUE;
		return FALSE;
	}

	/* biarch case */
	if (do32 == TRUE) {
		if (syscalls_32bit[callno].entry->arg1type == ARG_FD)
			return TRUE;
	} else {
		if (callno > max_nr_64bit_syscalls) {
			output(0, "Weird, child:%d callno:%d (64bit max:%d)\n", child, callno, max_nr_64bit_syscalls);
			return FALSE;
		}
		if (syscalls_64bit[callno].entry->arg1type == ARG_FD)
			return TRUE;
	}

	return FALSE;
}