dthain / basekernel

A simple OS kernel for research, teaching, and fun.
GNU General Public License v2.0
806 stars 110 forks source link

process_wrun syscall #197

Closed jmazanec15 closed 5 years ago

jmazanec15 commented 6 years ago

Added a system call, process_wrun, that allows a parent to run a child process in a window specified by the parent. The handle looks like this:

int process_wrun(const char *cmd, const char **argv, int argc, int window_description[4], int wd);

It is similar to process_run, except that a parent passes the window_description array, which holds the x position, y position, width and height of the new window to be made. It also passes the file descriptor of the window, wd, that the parent wants to create the new window out of.

In the implementation, the syscall first creates the new window. Then, similar to process_run, it creates the new process and the new process inherits all of the descriptors from the parent. Following this, the new window is duplicated over the child's standard window, fd=3 and then the original descriptor of the new window for the child and parent is closed. This way, the parent can control the standard window the child gets and no other children will inherit the child's standard window.

This system call will be used in the window manager program to contain processes running at the same time in their own separate windows.

jmazanec15 commented 6 years ago

Right now, there is a problem with argument passing in the call to process_wrun. I have merged the changes in argv-repair, but I get the following error running runwintst.exe: image The arguments are supposed to be printed after the "elf:" in the error message but it seems like they are null.

dthain commented 6 years ago

Please have the parent process open the window (so it can own it) and then process_wrun dups the file descriptor into the child's table.

jmazanec15 commented 6 years ago

Just updated wrun syscall to take in the wd it wants the child process to have as its standard window. runwintst.c was also changed and shows the behavior of how a user process would use wrun.

dthain commented 5 years ago

@jmazanec15 you gave a nice demo of this today, but perhaps the code wasn't pushed?

jmazanec15 commented 5 years ago

I may have made these changes in the window manager PR. I will merge that one and close this one.