Date: Sat, 18 Aug 2007 10:46:08 +0200 From: Roman Divacky <rdivacky@FreeBSD.org> To: Jesper Brix Rosenkilde <jbr@FreeBSD.org> Cc: Perforce Change Reviews <perforce@FreeBSD.org> Subject: Re: PERFORCE change 125277 for review Message-ID: <20070818084608.GA70909@freebsd.org> In-Reply-To: <200708172057.l7HKvMhw000824@repoman.freebsd.org> References: <200708172057.l7HKvMhw000824@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070818084608.GA70909>