PERFORCE change 125277 for review
Roman Divacky
rdivacky at FreeBSD.org
Sat Aug 18 01:46:15 PDT 2007
> 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));
the p->p_comm can be changed under your hands. you need to lock "p" and obtain
local copy and copyout the local copy.
> +struct sysshm {
> + pid_t pid;
> + char progtitle[20];
> + char proctitle[2048];
> +};
please use some defines here... I think you want to use MAXCOMLEN+1
More information about the p4-projects
mailing list