/* Server presentation on nova interface. -*-C-*- Copyright 2002 Johan Rydberg, jrydberg@rtmk.org. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ import ; import ; #if _GENERATE_SERVER import "proc.h"; import "kern-subr.h"; import "io-syscall.h"; #endif typedef proc_t { #ifdef _GENERATE_SERVER transin-fn: struct proc *proc_lookup; #else c-type: rtmk_port_t; #endif }; presentation nova implements nova { /* Process PROC exists with result code RC. It is up to the process to kill its own task. */ int proc_exit (proc_t proc, void *rc); /* Get PID of PROC. PID is returned in *PIDP. */ int proc_getpid (proc_t proc, pid_t *pidp); /* Change working directory of process to DIR. */ int proc_chdir (proc_t proc, char *dir, int dir_len (length-of dir)); /* Spawn new processes. TASK is task of new process, THREAD is main thread of new process. We return send rights to new process structure in *CHILDP. */ int proc_spawn (proc_t proc, rtmk_port_t task, rtmk_port_t thread, rtmk_port_t *childp, pid_t *pidp); /* Wait for child to exit. If PID-P is true, we wait for process PID to finish, otherwise any will do. OPTIONS can be WNOHANG. Returns PID of child in *PIDP, and exit status in *STATUSP. */ int proc_wait (proc_t proc, int pid_p, pid_t pid, int options, int *statusp, pid_t *pidp); int proc_exec (proc_t proc, char *filename, int filename_len (length-of filename), char *argz, int argz_len (length-of argz), char *envz, int envz_len (length-of envz)); /* Get name and information about current kernel. */ int proc_uname (proc_t proc, void *buf, inout int *len (length-of buf, force-encode)); /* Open file FILENAME. MODE is used for creating file. File descriptor number is returned in *FDP. */ int io_open (proc_t proc, char *filename, int filename_len (length-of filename), int flags, int mode, int *fdp); /* Write data to file FD, from buffer BUF. Return actual written bytes in *ACTUAL. */ int io_write (proc_t proc, int fd, void *buf, int length (length-of buf), int *actual); /* Read data from file FD. Return number of bytes read in *ACTUAL. Put data in BUF. */ int io_read (proc_t proc, int fd, void *buf, int *length (length-of buf, force-encode), int *actual); /* Duplicate file descriptor FD. If ANY_P is true we can select any new file descriptor. If not, *FDP is the file descriptor we want. New file descriptor is returned in *FDP. */ int io_dup (proc_t proc, int fd, int any_p, int *fdp); /* Get information about FILENAME. Put it in BUF. */ int io_stat (proc_t proc, char *filename, int filename_len (length-of filename), void *buf, int *buf_len (length-of buf, force-encode)); /* Map file FD. Object for reading returned in ROBJ. Object for writing is returned in WOBJ. */ int io_map (proc_t proc, int fd, rtmk_port_t *robj, rtmk_port_t *wobj); int io_seek (proc_t proc, int fd, int off, int whence); int io_readdir (proc_t proc, int fd, void *buf, int *buf_len (length-of buf, force-encode), int *eofp); };