Ejemplo n.º 1
0
        /// <summary>
        /// Replaces the current process with another executable
        /// </summary>
        /// <param name="path">The path to the executable</param>
        /// <param name="argv">The arguments</param>
        /// <param name="envp">The environment path</param>
        /// <returns>Errorcode</returns>
        public static int Execve(string path, string[] argv, string[] envp)
        {
            // TODO: envp
            path = VFS.CreateAbsolutePath(path);
            int error = Loader.StartProcess(path, argv, Task.SpawnFlags.SWAP_PID);

            Heap.Free(path);
            if (error < 0)
            {
                return(error);
            }

            // We spawned a task but the current process should actually be replaced
            // So we must kill the current process
            Tasking.RemoveTaskByPID(Tasking.CurrentTask.PID);

            return(0);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Exit syscall
 /// </summary>
 /// <param name="status">The status code</param>
 /// <returns>Nothing</returns>
 public static int Exit(int status)
 {
     Tasking.RemoveTaskByPID(Tasking.CurrentTask.PID);
     return(0);
 }