diff options
Diffstat (limited to 'proc_proxy')
-rw-r--r-- | proc_proxy/ChangeLog | 40 | ||||
-rw-r--r-- | proc_proxy/Makefile | 36 | ||||
-rw-r--r-- | proc_proxy/README | 26 | ||||
-rw-r--r-- | proc_proxy/proc_proxy.c | 276 | ||||
-rw-r--r-- | proc_proxy/proc_proxy.h | 67 | ||||
-rw-r--r-- | proc_proxy/process_ops.c | 453 | ||||
-rw-r--r-- | proc_proxy/test.c | 7 |
7 files changed, 0 insertions, 905 deletions
diff --git a/proc_proxy/ChangeLog b/proc_proxy/ChangeLog deleted file mode 100644 index c647bd15..00000000 --- a/proc_proxy/ChangeLog +++ /dev/null @@ -1,40 +0,0 @@ -2008-08-29 Zheng Da <zhengda1936@gmail.com> - - * README: Update. - -2008-08-29 Zheng Da <zhengda1936@gmail.com> - - * Makefile: Add process_ops.c - - * proc_proxy.c (master_port, args_doc, doc, options): New variables. - (reqport_find): Remove debugging print. - (comm_argv, comm_argc): New variables. - (add_comm_arg, add_comm_line, parse_opt): New functions. - (argp): New variable. - (main): Parse the options with argp. - - * proc_proxy.h (DEBUG): Removed macro. - - * process_ops.c (S_proc_getprivports): Return the master device port. - -2008-08-18 Zheng Da <zhengda1936@gmail.com> - - * README: New file. - -2008-08-17 Zheng Da <zhengda1936@gmail.com> - - * process.defs: Remove file. - - * process_ops.c: Replace the server prefix with the default one "S_". - -2008-08-17 Zheng Da <zhengda1936@gmail.com> - - * process.defs: New file. - - * Makefile: New file. - - * process_ops.c: New file. - - * proc_proxy.c: New file. - - * proc_proxy.h: New file. diff --git a/proc_proxy/Makefile b/proc_proxy/Makefile deleted file mode 100644 index 60ce1758..00000000 --- a/proc_proxy/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 2008 Free Software Foundation, Inc. -# This file is part of the GNU Hurd. -# -# The GNU Hurd 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, or (at your option) -# any later version. -# -# The GNU Hurd 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 the GNU Hurd; see the file COPYING. If not, write to -# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - -dir := proc_proxy -makemode := server - -SRCS = proc_proxy.c process_ops.c -LCLHDRS = proc_proxy.h -DIST_FILES = process.defs -HURDLIBS = threads ports -target = proc_proxy -MIGSTUBS = processServer.o -OBJS = $(SRCS:.c=.o) $(MIGSTUBS) - -MIGSFLAGS="-DPROCESS_INTRAN=vpstruct_t reqport_find (process_t)" \ - "-DPROCESS_DESTRUCTOR=process_drop (vpstruct_t)" \ - "-DPROCESS_IMPORTS=import \"proc_proxy.h\";" - -include ../Makeconf - -my_processUser.c: processUser.c - cat $< | sed -e '/__mig_get_reply_port *( *)/s/__mig_get_reply_port/my_get_reply_port/' > $@; diff --git a/proc_proxy/README b/proc_proxy/README deleted file mode 100644 index 83e11691..00000000 --- a/proc_proxy/README +++ /dev/null @@ -1,26 +0,0 @@ -[Introduction] - -proc_proxy is a proxy for the proc server. It intercepts the PROCESS requests that should be sent from a user to his proc server, so it provides a possibility for us to tamper the reply or even create the reply at our will. - -The current implementation of proc_proxy is able to help the pfinet translator open the virtual interface created by eth-multiplexer. - - -[Usage] - -Usage: proc_proxy [OPTION...] command line -Hurd proc proxy - - -M, --master-device=FILE Get the pseudo master device from a translator - -?, --help Give this help list - --usage Give a short usage message - -Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options. - - -[Internal] - -proc_proxy implements the server-side functions in process.defs. In the beginning, proc_proxy forks a new process, set its child's process server to itself, and run the command in the child process. Therefore, proc_proxy can get all PROCESS reqeusts from its child. - -proc_proxy works in the same way as the proc server to distinguish different processes with their ports. proc_proxy creates a port for each process. When a request comes, reqport_find() is called on the port to find the corresponding process. The port created for a new task is in server-side proc_task2proc. When a proc_task2proc request for a new task comes, a new port is created for the task and the send right of the port is returned. - -In order to help pfinet open the virtual interface created by eth-multiplexer, proc_proxy returns the port to eth-multiplexer as a master device port to pfinet. diff --git a/proc_proxy/proc_proxy.c b/proc_proxy/proc_proxy.c deleted file mode 100644 index c7878328..00000000 --- a/proc_proxy/proc_proxy.c +++ /dev/null @@ -1,276 +0,0 @@ -/* Copyright (C) 2008 Free Software Foundation, Inc. - Written by Zheng Da. - - This file is part of the GNU Hurd. - - The GNU Hurd 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, or (at your option) - any later version. - - The GNU Hurd 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 the GNU Hurd; see the file COPYING. If not, write to - the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include <stdio.h> -#include <argp.h> -#include <error.h> -#include <syslog.h> -#include <errno.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <stddef.h> - -#include <hurd.h> -#include <mach.h> - -#include "proc_proxy.h" - -struct port_bucket *proc_bucket; -struct port_class *proc_class; - -mach_port_t master_port; - -static struct hurd_ihash proc_ht -= HURD_IHASH_INITIALIZER (offsetof (struct vproc, p_task_hashloc)); - -static char *args_doc = "command line"; -static char *doc = "Hurd proc proxy"; -static struct argp_option options[] = -{ - {"master-device", 'M', "FILE", 0, "Get the pseudo master device from a translator"}, - { 0 } -}; - -vpstruct_t -reqport_find (mach_port_t reqport) -{ - vpstruct_t p; - p = ports_lookup_port (proc_bucket, reqport, proc_class); - return p; -} - -void -task_clean_routine (void *port) -{ - vpstruct_t proc = port; - hurd_ihash_locp_remove (&proc_ht, proc->p_task_hashloc); - mach_port_deallocate (mach_task_self (), proc->proc); - mach_port_deallocate (mach_task_self (), proc->task_id); -} - -vpstruct_t -create_task (task_t task) -{ - vpstruct_t proc; - error_t err = ports_create_port (proc_class, proc_bucket, - sizeof (*proc), &proc); - if (err) - error (3, err, "ports_create_port"); - - proc->task_id = task; - - hurd_ihash_add (&proc_ht, proc->task_id, proc); - return proc; -} - -vpstruct_t -find_task (task_t task) -{ - return hurd_ihash_find (&proc_ht, task) ? : create_task (task); -} - -int -request_server (mach_msg_header_t *inp, mach_msg_header_t *outp) -{ - extern boolean_t process_server (mach_msg_header_t *, mach_msg_header_t *); - return process_server (inp, outp); -} - -void -print_cmd (int argc, char *argv[]) -{ - int i; - for (i = 0; i < argc; i++) - { - debug ("%s ", argv[i]); - } - debug ("\n"); -} - -static char **comm_argv; -static int comm_argc; - -static int add_comm_arg (char *arg) -{ - static int comm_capacity = 0; - if (comm_capacity <= comm_argc) - { - comm_capacity += 8; - comm_argv = (char **) realloc (comm_argv, - comm_capacity * sizeof (char *)); - if (comm_argv == NULL) - error (1, errno, "realloc"); - } - - comm_argv[comm_argc] = arg; - comm_argc++; - - return 0; -} - -static void add_comm_line (char *line) -{ - char *p = line; - char *start; - - /* Skip the space */ - for (; *p != 0 && isspace (*p); p++); - start = p; - - while (1) - { - /* Find the end of an option */ - for (; *p != 0 && !isspace (*p); p++); - if (*p) - { - *p = 0; - p++; - } - add_comm_arg (start); - - /* Find the beginning of an option */ - for (; *p != 0 && isspace (*p); p++); - if (*p == 0) - break; - start = p; - } -} - -static error_t -parse_opt (int key, char *arg, struct argp_state *state) -{ - switch (key) - { - case 'M': - master_port = file_name_lookup (arg, 0, 0); - if (master_port == MACH_PORT_NULL) - error (1, errno, "file_name_lookup"); - break; - case ARGP_KEY_ARG: - add_comm_line (arg); - break; - default: - return ARGP_ERR_UNKNOWN; - } - return 0; -} - -int -main (int argc, char *argv[]) -{ - error_t err; - vpstruct_t child_proc; - mach_port_t receive_port; - mach_port_t proc_port; - int pipe_fd1s[2]; - int pipe_fd2s[2]; - pid_t child_pid; - task_t child_task; - struct argp argp = - { options, parse_opt, args_doc, doc}; - - argp_parse (&argp, argc, argv, 0, 0, 0); - add_comm_arg (NULL); - - if (pipe (pipe_fd1s) < 0) - error (2, errno, "pipe"); - if (pipe (pipe_fd2s) < 0) - error (2, errno, "pipe"); - - err = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_DEAD_NAME, - &proc_port); - if (err != KERN_SUCCESS) - error (2, err, "mach_port_allocate"); - - child_pid = fork (); - if (child_pid < 0) - error (2, errno, "fork"); - else if (child_pid == 0) - { - /* generate a new process group for child process, - * it's needed to set the child process group to foreground */ - setpgid (getpid (), getpid ()); - - close (pipe_fd1s[1]); - close (pipe_fd2s[0]); - - debug ("child process starts\n"); - read (pipe_fd1s[0], &proc_port, sizeof (proc_port)); - print_cmd (comm_argc, comm_argv); - write (pipe_fd2s[1], &proc_port, sizeof (proc_port)); - - setproc (proc_port); - debug ("child: current proc is %d\n", getproc ()); - if (execvp (comm_argv[0], comm_argv) < 0) - error (2, errno, "execvp"); - } - - debug ("create a child process %d\n", child_pid); - - /* Set the child process group as the foreground group. */ - tcsetpgrp (fileno (stdout), child_pid); - - close (pipe_fd1s[0]); - close (pipe_fd2s[1]); - - proc_bucket = ports_create_bucket (); - proc_class = ports_create_class (task_clean_routine, 0); - - /* Make the send right to the proc porxy in the child process. */ - child_task = pid2task (child_pid); - err = mach_port_destroy (child_task, proc_port); - if (err != KERN_SUCCESS) - error (2, err, "mach_port_destroy"); - child_proc = create_task (child_task); - receive_port = ports_get_right (child_proc); - err = mach_port_insert_right (child_task, proc_port, receive_port, - MACH_MSG_TYPE_MAKE_SEND); - if (err != KERN_SUCCESS) - error (2, err, "mach_port_insert_right"); - - /* Tell the child the send right. */ - write (pipe_fd1s[1], &proc_port, sizeof(proc_port)); - /* Synchronize. The child process should run first. */ - read (pipe_fd2s[0], &proc_port, sizeof(proc_port)); - - debug ("the proxy starts\n"); - proc_task2proc (getproc(), child_task, &child_proc->proc); - - while (1) - { - int status; - int ret; - - ports_manage_port_operations_one_thread (proc_bucket, - request_server, 500); - ret = waitpid (child_pid, &status, WNOHANG); - if (ret < 0) - error (1, errno, "waitpid"); - - /* if the child process exits */ - if (ret == 1 && WIFEXITED (status)) - break; - - } - debug ("proc proxy exits\n"); - - return 0; -} - diff --git a/proc_proxy/proc_proxy.h b/proc_proxy/proc_proxy.h deleted file mode 100644 index 17494415..00000000 --- a/proc_proxy/proc_proxy.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright (C) 2008 Free Software Foundation, Inc. - Written by Zheng Da. - - This file is part of the GNU Hurd. - - The GNU Hurd 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, or (at your option) - any later version. - - The GNU Hurd 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 the GNU Hurd; see the file COPYING. If not, write to - the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#ifndef PROC_PROXY_H -#define PROC_PROXY_H - -#include <stdio.h> - -#include <hurd.h> -#include <hurd/ports.h> - -#ifdef DEBUG - -#define debug(format, ...) \ - do \ - { \ - char buf [1024]; \ - snprintf (buf, sizeof (buf), "%s: %s", __func__, format); \ - fprintf (stderr, buf, ## __VA_ARGS__); \ - } \ - while (0) - -#else - -#define debug(format, ...) do {} while (0) - -#endif - -struct vproc -{ - struct port_info p_pi; - task_t task_id; - /* The actual port to the proc server for the process. */ - process_t proc; - hurd_ihash_locp_t p_task_hashloc; -}; - -typedef struct vproc *vpstruct_t; - -static inline void -process_drop (vpstruct_t p) -{ - if (p) - ports_port_deref (p); -} - -vpstruct_t reqport_find (mach_port_t port); -vpstruct_t find_task (task_t task); -mach_port_t my_get_reply_port (void); - -#endif diff --git a/proc_proxy/process_ops.c b/proc_proxy/process_ops.c deleted file mode 100644 index ed6b2f76..00000000 --- a/proc_proxy/process_ops.c +++ /dev/null @@ -1,453 +0,0 @@ -/* Copyright (C) 2008 Free Software Foundation, Inc. - Written by Zheng Da. - - This file is part of the GNU Hurd. - - The GNU Hurd 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, or (at your option) - any later version. - - The GNU Hurd 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 the GNU Hurd; see the file COPYING. If not, write to - the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include <error.h> - -#include "process_S.h" - -kern_return_t -S_proc_getprivports (vpstruct_t process, mach_port_t *host_priv, - mach_port_t *device_master) -{ - extern mach_port_t master_port; - kern_return_t ret = 0; - debug ("task id: %d\n", process->task_id); - if (host_priv) - { - mach_port_t orig_device_master; - ret = proc_getprivports (process->proc, host_priv, - &orig_device_master); - if (ret) - { - error (0, ret, "proc_getprivports"); - return ret; - } - mach_port_deallocate (mach_task_self (), orig_device_master); - } - - if (device_master) - *device_master = master_port; - return ret; -} - -kern_return_t -S_proc_getallpids (vpstruct_t process, pidarray_t *pidarray, - mach_msg_type_number_t *pidarrayCnt) -{ - debug ("task id: %d\n", process->task_id); - return proc_getallpids (getproc (), pidarray, pidarrayCnt); -} - -kern_return_t -S_proc_setexecdata (vpstruct_t process, portarray_t ports, - mach_msg_type_number_t portsCnt, intarray_t ints, - mach_msg_type_number_t intsCnt) -{ - debug ("task id: %d\n", process->task_id); - return proc_setexecdata (process->proc, ports, MACH_MSG_TYPE_COPY_SEND, - portsCnt, ints, intsCnt); -} - -kern_return_t -S_proc_getexecdata (vpstruct_t process, portarray_t *ports, - mach_msg_type_name_t *portsPoly, - mach_msg_type_number_t *portsCnt, - intarray_t *ints, mach_msg_type_number_t *intsCnt) -{ - kern_return_t ret; - debug ("task id: %d\n", process->task_id); - ret = proc_getexecdata (process->proc, ports, portsCnt, ints, intsCnt); - if (ret == 0) - *portsPoly = MACH_MSG_TYPE_MOVE_SEND; - return ret; -} - -kern_return_t -S_proc_execdata_notify (vpstruct_t process, mach_port_t notify) -{ - debug ("task id: %d\n", process->task_id); - return proc_execdata_notify (process->proc, notify, MACH_MSG_TYPE_MOVE_SEND); -} - -kern_return_t -S_proc_uname (vpstruct_t process, utsname_t *uname) -{ - debug ("task id: %d\n", process->task_id); - return proc_uname (process->proc, uname); -} - -kern_return_t -S_proc_register_version (vpstruct_t process, mach_port_t credential, - string_t name, string_t release, string_t version) -{ - debug ("task id: %d\n", process->task_id); - return proc_register_version (process->proc, credential, - name, release, version); -} - -kern_return_t -S_proc_reauthenticate (vpstruct_t process, mach_port_t rendezvous2) -{ - debug ("task id: %d\n", process->task_id); - return proc_reauthenticate (process->proc, rendezvous2, - MACH_MSG_TYPE_MOVE_SEND); -} - -kern_return_t -S_proc_child (vpstruct_t process, mach_port_t child) -{ - debug ("task id: %d, child task: %d\n", process->task_id, child); - return proc_child (process->proc, child); -} - -kern_return_t -S_proc_setmsgport (vpstruct_t process, mach_port_t reply_port, - mach_msg_type_name_t reply_portPoly, mach_port_t newmsgport, - mach_port_t *oldmsgport, mach_msg_type_name_t *oldmsgportPoly) -{ - kern_return_t ret=0; - debug ("task id: %d\n", process->task_id); - ret = proc_setmsgport (process->proc, newmsgport, oldmsgport); - if (ret == 0){ - *oldmsgportPoly = MACH_MSG_TYPE_MOVE_SEND; - } - return ret; -} - -kern_return_t -S_proc_getmsgport (vpstruct_t process, mach_port_t reply_port, - mach_msg_type_name_t reply_portPoly, pid_t pid, - mach_port_t *msgport) -{ - debug ("task id: %d\n", process->task_id); - return proc_getmsgport (getproc(), pid, msgport); -} - -kern_return_t -S_proc_reassign (vpstruct_t process, mach_port_t newtask) -{ - debug ("task id: %d\n", process->task_id); - return proc_reassign (process->proc, newtask); -} - -kern_return_t -S_proc_setowner (vpstruct_t process, uid_t owner, int clear) -{ - debug ("task id: %d\n", process->task_id); - return proc_setowner (process->proc, owner, clear); -} - -kern_return_t -S_proc_getpids (vpstruct_t process, pid_t *pid, - pid_t *ppid, int *orphaned) -{ - debug ("task id: %d\n", process->task_id); - return proc_getpids (process->proc, pid, ppid, orphaned); -} - -kern_return_t -S_proc_set_arg_locations (vpstruct_t process, vm_address_t argv, - vm_address_t envp) -{ - kern_return_t ret; - debug ("task id: %d\n", process->task_id); - ret = proc_set_arg_locations(process->proc , argv , envp); - if (ret) - error (4, ret, "proc_set_arg_locations"); - return ret; -} - -kern_return_t -S_proc_get_arg_locations (vpstruct_t process, vm_address_t *argv, - vm_address_t *envp) -{ - debug ("task id: %d\n", process->task_id); - return proc_get_arg_locations (process->proc, argv, envp); -} - -kern_return_t -S_proc_wait (vpstruct_t process, mach_port_t reply_port, - mach_msg_type_name_t reply_portPoly, pid_t pid, int options, - int *status, int *sigcode, rusage_t *rusage, pid_t *pid_status) -{ - debug ("task id: %d\n", process->task_id); - return proc_wait (process->proc, pid, options, status, sigcode, - rusage, pid_status); -} - -kern_return_t -S_proc_dostop (vpstruct_t process, mach_port_t contthread) -{ - kern_return_t ret; - - debug ("task id: %d\n", process->task_id); - ret = proc_dostop(process->proc, contthread); - if (ret) - error (4, ret, "proc_dostop"); - return ret; -} - -kern_return_t -S_proc_handle_exceptions (vpstruct_t process, mach_port_t msgport, - mach_port_t forwardport, int flavor, - thread_state_t new_state, - mach_msg_type_number_t new_stateCnt) -{ - debug ("task id: %d\n", process->task_id); - return proc_handle_exceptions (process->proc, msgport, forwardport, - MACH_MSG_TYPE_MOVE_SEND, flavor, - new_state, new_stateCnt); -} - -kern_return_t -S_proc_mark_stop (vpstruct_t process, int signo, int sigcode) -{ - debug ("task id: %d\n", process->task_id); - return proc_mark_stop (process->proc, signo, sigcode); -} - -kern_return_t -S_proc_mark_cont (vpstruct_t process) -{ - debug ("task id: %d\n", process->task_id); - return proc_mark_cont (process->proc); -} - -kern_return_t -S_proc_mark_exit (vpstruct_t process, int status, int sigcode) -{ - debug ("task id: %d\n", process->task_id); - return proc_mark_exit (process->proc, status, sigcode); -} - -kern_return_t -S_proc_mark_traced (vpstruct_t process) -{ - debug ("task id: %d\n", process->task_id); - return proc_mark_traced (process->proc); -} - -kern_return_t -S_proc_mark_exec (vpstruct_t process) -{ - debug ("task id: %d\n", process->task_id); - return proc_mark_exec (process->proc); -} - -kern_return_t -S_proc_mod_stopchild (vpstruct_t process, int doit) -{ - debug ("task id: %d\n", process->task_id); - return proc_mod_stopchild (process->proc , doit); -} - -kern_return_t -S_proc_pid2task (vpstruct_t process, pid_t pid, mach_port_t *task) -{ - kern_return_t ret; - ret = proc_pid2task (getproc (), pid, task); - debug ("pid: %d, task: %d\n", pid, *task); - return ret; -} - -kern_return_t -S_proc_task2pid (vpstruct_t process, mach_port_t task, pid_t *pid) -{ - debug ("task id: %d\n", task); - return proc_task2pid (getproc (), task, pid); -} - -kern_return_t -S_proc_task2proc (vpstruct_t callerp, mach_port_t task, - mach_port_t *proc) -{ - kern_return_t err; - process_t actual_proc; - - debug ("task id: %d\n", task); - vpstruct_t process = find_task (task); - *proc = ports_get_right (process); - - /* Get the actuall port to the proc server. */ - err = proc_task2proc (getproc (), task, &actual_proc); - if (err) - error (3, err, "proc_task2proc"); - process->proc = actual_proc; - - /* TODO Do I always need to deallocate task? */ - mach_port_deallocate (mach_task_self (), task); - return 0; -} - -kern_return_t -S_proc_proc2task (vpstruct_t process, mach_port_t *task) -{ - debug ("task id: %d\n", process->task_id); - *task = process->task_id; - return 0; -} - -kern_return_t -S_proc_pid2proc (vpstruct_t process, pid_t pid, mach_port_t *proc) -{ - debug ("pid id: %d\n", pid); - return proc_pid2proc (getproc (), pid, proc); -} - -kern_return_t -S_proc_getprocinfo (vpstruct_t process, pid_t which, int *flags, - procinfo_t *procinfo, mach_msg_type_number_t *procinfoCnt, - data_t *threadwaits, mach_msg_type_number_t *threadwaitsCnt) -{ - debug ("pid id: %d\n", which); - return proc_getprocinfo (getproc (), which, flags, procinfo, - procinfoCnt, threadwaits, threadwaitsCnt); -} - -kern_return_t -S_proc_getprocargs (vpstruct_t process, pid_t which, - data_t *procargs, mach_msg_type_number_t *procargsCnt) -{ - debug ("pid id: %d\n", which); - return proc_getprocargs (getproc (), which, procargs, procargsCnt); -} - -kern_return_t -S_proc_getprocenv (vpstruct_t process, pid_t which, - data_t *procenv, mach_msg_type_number_t *procenvCnt) -{ - debug ("pid id: %d\n", which); - return proc_getprocenv (getproc (), which, procenv, procenvCnt); -} - -kern_return_t -S_proc_make_login_coll (vpstruct_t process) -{ - debug ("task id: %d\n", process->task_id); - return proc_make_login_coll (process->proc); -} - -kern_return_t -S_proc_getloginid (vpstruct_t process, pid_t pid, pid_t *login_id) -{ - debug ("pid id: %d\n", pid); - return proc_getloginid (getproc (), pid, login_id); -} - -kern_return_t -S_proc_getloginpids (vpstruct_t process, pid_t id, - pidarray_t *pids, mach_msg_type_number_t *pidsCnt) -{ - debug ("pid id: %d\n", id); - return proc_getloginpids (getproc (), id, pids, pidsCnt); -} - -kern_return_t -S_proc_setlogin (vpstruct_t process, string_t logname) -{ - debug ("task id: %d\n", process->task_id); - return proc_setlogin (process->proc, logname); -} - -kern_return_t -S_proc_getlogin (vpstruct_t process, string_t logname) -{ - debug ("task id: %d\n", process->task_id); - return proc_getlogin (process->proc, logname); -} - -kern_return_t -S_proc_setsid (vpstruct_t process) -{ - debug ("task id: %d\n", process->task_id); - return proc_setsid (process->proc); -} - -kern_return_t -S_proc_getsid (vpstruct_t process, pid_t pid, pid_t *sid) -{ - debug ("pid id: %d\n", pid); - return proc_getsid (getproc (), pid, sid); -} - -kern_return_t -S_proc_getsessionpgids (vpstruct_t process, pid_t sid, - pidarray_t *pgidset, mach_msg_type_number_t *pgidsetCnt) -{ - debug ("pid id: %d\n", sid); - return proc_getsessionpgids (getproc (), sid, pgidset, pgidsetCnt); -} - -kern_return_t -S_proc_getsessionpids (vpstruct_t process, pid_t sid, - pidarray_t *pidset, mach_msg_type_number_t *pidsetCnt) -{ - debug ("pid id: %d\n", sid); - return proc_getsessionpids (getproc (), sid, pidset, pidsetCnt); -} - -kern_return_t -S_proc_getsidport (vpstruct_t process, mach_port_t *sessport, - mach_msg_type_name_t *sessportPoly) -{ - kern_return_t ret; - debug ("task id: %d\n", process->task_id); - ret = proc_getsidport (process->proc, sessport); - if (ret == 0) - *sessportPoly = MACH_MSG_TYPE_MOVE_SEND; - return ret; -} - -kern_return_t -S_proc_setpgrp (vpstruct_t process, pid_t pid, pid_t pgrp) -{ - debug ("pid id: %d\n", pid); - return proc_setpgrp (getproc (), pid, pgrp); -} - -kern_return_t -S_proc_getpgrp (vpstruct_t process, pid_t pid, pid_t *pgrp) -{ - kern_return_t ret; - debug ("pid id: %d\n", pid); - ret = proc_getpgrp(getproc(), pid, pgrp); - if (ret) - error (0, ret, "proc_proxy: proc_getpgrp"); - return ret; -} - -kern_return_t -S_proc_getpgrppids (vpstruct_t process, pid_t pgrp, - pidarray_t *pidset, mach_msg_type_number_t *pidsetCnt) -{ - debug ("pgrp id: %d\n", pgrp); - return proc_getpgrppids (getproc (), pgrp, pidset, pidsetCnt); -} - -kern_return_t -S_proc_get_tty (vpstruct_t calling_process, pid_t target_process, - mach_port_t *tty, mach_msg_type_name_t *ttyPoly) -{ - kern_return_t ret; - debug (""); - ret = proc_get_tty (getproc (), target_process, tty); - if (ret == 0) - *ttyPoly = MACH_MSG_TYPE_MOVE_SEND; - return ret; -} diff --git a/proc_proxy/test.c b/proc_proxy/test.c deleted file mode 100644 index fa3591c0..00000000 --- a/proc_proxy/test.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdio.h> - -int main (int argc, char *argv[]) -{ - printf ("hello world: %s\n", argv[1]); - return 0; -} |