Deleted Added
full compact
kern_sharedpage.c (38799) kern_sharedpage.c (40435)
1/*
2 * Copyright (c) 1993, David Greenman
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*
2 * Copyright (c) 1993, David Greenman
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $Id: kern_exec.c,v 1.85 1998/08/24 08:39:38 dfr Exp $
26 * $Id: kern_exec.c,v 1.86 1998/09/04 08:06:55 dfr Exp $
27 */
28
29#include <sys/param.h>
30#include <sys/systm.h>
31#include <sys/sysproto.h>
32#include <sys/signalvar.h>
33#include <sys/kernel.h>
34#include <sys/mount.h>
35#include <sys/filedesc.h>
36#include <sys/fcntl.h>
37#include <sys/acct.h>
38#include <sys/exec.h>
39#include <sys/imgact.h>
40#include <sys/imgact_elf.h>
41#include <sys/wait.h>
42#include <sys/proc.h>
43#include <sys/pioctl.h>
27 */
28
29#include <sys/param.h>
30#include <sys/systm.h>
31#include <sys/sysproto.h>
32#include <sys/signalvar.h>
33#include <sys/kernel.h>
34#include <sys/mount.h>
35#include <sys/filedesc.h>
36#include <sys/fcntl.h>
37#include <sys/acct.h>
38#include <sys/exec.h>
39#include <sys/imgact.h>
40#include <sys/imgact_elf.h>
41#include <sys/wait.h>
42#include <sys/proc.h>
43#include <sys/pioctl.h>
44#include <sys/malloc.h>
44#include <sys/namei.h>
45#include <sys/sysent.h>
46#include <sys/shm.h>
47#include <sys/sysctl.h>
48#include <sys/vnode.h>
49#include <sys/buf.h>
50
51#include <vm/vm.h>

--- 14 unchanged lines hidden (view full) ---

66static long *exec_copyout_strings __P((struct image_params *));
67
68static struct ps_strings *ps_strings = PS_STRINGS;
69SYSCTL_INTPTR(_kern, KERN_PS_STRINGS, ps_strings, 0, &ps_strings, 0, "");
70
71static caddr_t usrstack = (caddr_t)USRSTACK;
72SYSCTL_INTPTR(_kern, KERN_USRSTACK, usrstack, 0, &usrstack, 0, "");
73/*
45#include <sys/namei.h>
46#include <sys/sysent.h>
47#include <sys/shm.h>
48#include <sys/sysctl.h>
49#include <sys/vnode.h>
50#include <sys/buf.h>
51
52#include <vm/vm.h>

--- 14 unchanged lines hidden (view full) ---

67static long *exec_copyout_strings __P((struct image_params *));
68
69static struct ps_strings *ps_strings = PS_STRINGS;
70SYSCTL_INTPTR(_kern, KERN_PS_STRINGS, ps_strings, 0, &ps_strings, 0, "");
71
72static caddr_t usrstack = (caddr_t)USRSTACK;
73SYSCTL_INTPTR(_kern, KERN_USRSTACK, usrstack, 0, &usrstack, 0, "");
74/*
74 * execsw_set is constructed for us by the linker. Each of the items
75 * is a pointer to a `const struct execsw', hence the double pointer here.
75 * Each of the items is a pointer to a `const struct execsw', hence the
76 * double pointer here.
76 */
77 */
77static const struct execsw **execsw =
78 (const struct execsw **)&execsw_set.ls_items[0];
78static const struct execsw **execsw;
79
80#ifndef _SYS_SYSPROTO_H_
81struct execve_args {
82 char *fname;
83 char **argv;
84 char **envv;
85};
86#endif

--- 603 unchanged lines hidden (view full) ---

690 * general case).
691 */
692 error = VOP_OPEN(vp, FREAD, p->p_ucred, p);
693 if (error)
694 return (error);
695
696 return (0);
697}
79
80#ifndef _SYS_SYSPROTO_H_
81struct execve_args {
82 char *fname;
83 char **argv;
84 char **envv;
85};
86#endif

--- 603 unchanged lines hidden (view full) ---

690 * general case).
691 */
692 error = VOP_OPEN(vp, FREAD, p->p_ucred, p);
693 if (error)
694 return (error);
695
696 return (0);
697}
698
699/*
700 * Exec handler registration
701 */
702int
703exec_register(execsw_arg)
704 const struct execsw *execsw_arg;
705{
706 const struct execsw **es, **xs, **newexecsw;
707 int count = 2; /* New slot and trailing NULL */
708
709 if (execsw)
710 for (es = execsw; *es; es++)
711 count++;
712 newexecsw = malloc(count * sizeof(*es), M_TEMP, M_WAITOK);
713 if (newexecsw == NULL)
714 return ENOMEM;
715 xs = newexecsw;
716 if (execsw)
717 for (es = execsw; *es; es++)
718 *xs++ = *es;
719 *xs++ = execsw_arg;
720 *xs = NULL;
721 if (execsw)
722 free(execsw, M_TEMP);
723 execsw = newexecsw;
724 return 0;
725}
726
727int
728exec_unregister(execsw_arg)
729 const struct execsw *execsw_arg;
730{
731 const struct execsw **es, **xs, **newexecsw;
732 int count = 1;
733
734 if (execsw == NULL)
735 panic("unregister with no handlers left?\n");
736
737 for (es = execsw; *es; es++) {
738 if (*es == execsw_arg)
739 break;
740 }
741 if (*es == NULL)
742 return ENOENT;
743 for (es = execsw; *es; es++)
744 if (*es != execsw_arg)
745 count++;
746 newexecsw = malloc(count * sizeof(*es), M_TEMP, M_WAITOK);
747 if (newexecsw == NULL)
748 return ENOMEM;
749 xs = newexecsw;
750 for (es = execsw; *es; es++)
751 if (*es != execsw_arg)
752 *xs++ = *es;
753 *xs = NULL;
754 if (execsw)
755 free(execsw, M_TEMP);
756 execsw = newexecsw;
757 return 0;
758}