PERFORCE change 125277 for review
Jesper Brix Rosenkilde
jbr at FreeBSD.org
Fri Aug 17 13:57:23 PDT 2007
http://perforce.freebsd.org/chv.cgi?CH=125277
Change 125277 by jbr at jbr_bob on 2007/08/17 20:56:31
now with getpid and fork
Affected files ...
.. //depot/projects/soc2007/jbr-syscall/src/sys/kern/kern_exec.c#16 edit
.. //depot/projects/soc2007/jbr-syscall/src/sys/sys/exec.h#4 edit
.. //depot/projects/soc2007/jbr-syscall/src/sys/sys/types.h#2 edit
.. //depot/projects/soc2007/jbr-syscall/src/sys/vm/vm_glue.c#2 edit
.. //depot/projects/soc2007/jbr-syscall/tests/fork.c#1 add
.. //depot/projects/soc2007/jbr-syscall/tests/getpid.c#1 add
Differences ...
==== //depot/projects/soc2007/jbr-syscall/src/sys/kern/kern_exec.c#16 (text+ko) ====
@@ -454,7 +454,6 @@
*/
if (imgp->interpreted) {
exec_unmap_first_page(imgp);
- exec_unmap_sysshm(imgp);
/*
* VV_TEXT needs to be unset for scripts. There is a short
* period before we determine that something is a script where
@@ -911,24 +910,21 @@
struct image_params *imgp;
{
int error;
+ struct proc *p = imgp->proc;
vm_map_t map = &imgp->proc->p_vmspace->vm_map;
vm_offset_t *addr = &imgp->proc->p_usrsysshm;
- int test = 42;
+ struct sysshm outsysshm;
error = vm_map_sysshm(map, addr, 42);
- copyout((caddr_t) &test, (caddr_t) *addr, sizeof(int));
+ outsysshm.pid = p->p_pid;
+ strncpy(outsysshm.progtitle, p->p_comm, MAXCOMLEN);
+ strncpy(outsysshm.proctitle, "\0", 1);
+ copyout((caddr_t) &outsysshm, (caddr_t) *addr, sizeof(struct sysshm));
return(error);
}
-void
-exec_unmap_sysshm(imgp)
- struct image_params *imgp;
-{
-
-}
-
/*
* Destroy old address space, and allocate a new stack
* The new stack is only SGROWSIZ large because it is grown
==== //depot/projects/soc2007/jbr-syscall/src/sys/sys/exec.h#4 (text+ko) ====
@@ -75,7 +75,6 @@
void exec_unmap_first_page(struct image_params *);
int exec_map_sysshm(struct image_params *);
-void exec_unmap_sysshm(struct image_params *);
int exec_register(const struct execsw *);
int exec_unregister(const struct execsw *);
==== //depot/projects/soc2007/jbr-syscall/src/sys/sys/types.h#2 (text+ko) ====
@@ -372,6 +372,12 @@
__END_DECLS
#endif /* !_KERNEL */
+struct sysshm {
+ pid_t pid;
+ char progtitle[20];
+ char proctitle[2048];
+};
+
#endif /* __BSD_VISIBLE */
#endif /* !_SYS_TYPES_H_ */
==== //depot/projects/soc2007/jbr-syscall/src/sys/vm/vm_glue.c#2 (text+ko) ====
@@ -511,6 +511,7 @@
int flags;
{
struct proc *p1 = td->td_proc;
+ struct sysshm sysshm;
if ((flags & RFPROC) == 0) {
/*
@@ -542,6 +543,16 @@
shmfork(p1, p2);
}
+
+ p2->p_usrsysshm = p1->p_usrsysshm -
+ (vm_offset_t) p1->p_vmspace->vm_daddr +
+ (vm_offset_t) p2->p_vmspace->vm_daddr;
+
+ copyin((caddr_t) p1->p_usrsysshm, (caddr_t) &sysshm,
+ sizeof(struct sysshm));
+ sysshm.pid = p2->p_pid;
+ copyout((caddr_t) &sysshm, (caddr_t) p2->p_usrsysshm,
+ sizeof(struct sysshm));
/*
* cpu_fork will copy and update the pcb, set up the kernel stack,
* and make the child ready to run.
More information about the p4-projects
mailing list