Added private_data structure in process

Conflicts:
	executer/user/mcexec.c
	kernel/include/process.h
	kernel/process.c
This commit is contained in:
Aram Santogidis
2017-07-25 15:45:25 +09:00
committed by Balazs Gerofi
parent e36abe57e7
commit 8a1d756cb1
5 changed files with 31 additions and 2 deletions

View File

@ -39,7 +39,7 @@ SYSCALL_HANDLED(15, rt_sigreturn)
SYSCALL_HANDLED(16, ioctl)
SYSCALL_DELEGATED(17, pread64)
SYSCALL_DELEGATED(18, pwrite64)
SYSCALL_DELEGATED(20, writev)
SYSCALL_HANDLED(20, writev)
SYSCALL_DELEGATED(21, access)
SYSCALL_DELEGATED(23, select)
SYSCALL_HANDLED(24, sched_yield)

View File

@ -3320,7 +3320,6 @@ int main_loop(struct thread_data_s *my_thread)
memset(&w, '\0', sizeof w);
w.cpu = cpu;
w.pid = getpid();
while (((ret = ioctl(fd, MCEXEC_UP_WAIT_SYSCALL, (unsigned long)&w)) == 0) || (ret == -1 && errno == EINTR)) {
if (ret) {
@ -4201,6 +4200,7 @@ return_execve2:
}
do_syscall_return(fd, cpu, ret, 0, 0, 0, 0);
break;
case 801: {// swapout
#ifdef ENABLE_QLMPI
int rc;
@ -4390,6 +4390,11 @@ return_linux_spawn:
break;
}
case __NR_writev:
ret = do_generic_syscall(&w);
do_syscall_return(fd, cpu, ret, 0, 0, 0, 0);
break;
default:
if (archdep_syscall(&w, &ret)) {
ret = do_generic_syscall(&w);

View File

@ -573,6 +573,8 @@ struct process {
#endif // PROFILE_ENABLE
int nr_processes; /* For partitioned execution */
int process_rank; /* Rank in partition */
void *fd_priv_table[265];
};
/*

View File

@ -138,6 +138,11 @@ init_process(struct process *proc, struct process *parent)
INIT_LIST_HEAD(&proc->ptraced_siblings_list);
mcs_rwlock_init(&proc->update_lock);
#endif /* POSTK_DEBUG_ARCH_DEP_63 */
}
// Double check the inheritance from parent
memset(proc->fd_priv_table, 0, 256 * sizeof(void *));
INIT_LIST_HEAD(&proc->threads_list);
INIT_LIST_HEAD(&proc->children_list);
INIT_LIST_HEAD(&proc->ptraced_children_list);

View File

@ -67,6 +67,8 @@
#include <lwk/stddef.h>
#include <futex.h>
//#include <hfi1/hfi.h>
#define SYSCALL_BY_IKC
//#define DEBUG_PRINT_SC
@ -480,6 +482,7 @@ long do_syscall(struct syscall_request *req, int cpu, int pid)
if (req->number == __NR_open && rc > 0) {
if (res.private_data && !strncmp(req->args[0], "/dev/hfi", 8)) {
thread->proc->fd_priv_table[rc] = res.private_data;
kprintf("%s: PID: %d, open fd: %d, filename: %s, private_data: 0x%lx\n",
__FUNCTION__, thread->proc->pid, rc, req->args[0], res.private_data);
}
@ -3086,6 +3089,20 @@ do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
return 0;
}
SYSCALL_DECLARE(writev)
{
struct process *proc = cpu_local_var(current)->proc;
int fd = ihk_mc_syscall_arg0(ctx);
int iovcnt = ihk_mc_syscall_arg2(ctx);
if (fd < 256) {
//struct hfi1_filedata *hf = (struct hfi1_filedata *)proc->fd_priv_table[fd];
kprintf("%s: fd[%d], 0x%lx, iovcnt[%d]\n", __FUNCTION__, fd, proc->fd_priv_table[fd], iovcnt);
} else {
kprintf("%s: fd[%d] > 256\n", __FUNCTION__, fd);
}
return syscall_generic_forwarding(__NR_writev, ctx);
}
SYSCALL_DECLARE(read)
{
int fd = ihk_mc_syscall_arg0(ctx);