From owner-p4-projects@FreeBSD.ORG Thu Jul 6 16:21:21 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5A79116A558; Thu, 6 Jul 2006 16:21:21 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1C54D16A50E for ; Thu, 6 Jul 2006 16:21:21 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id D818843D45 for ; Thu, 6 Jul 2006 16:21:20 +0000 (GMT) (envelope-from rdivacky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k66GLK4X097789 for ; Thu, 6 Jul 2006 16:21:20 GMT (envelope-from rdivacky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k66GLK9m097786 for perforce@freebsd.org; Thu, 6 Jul 2006 16:21:20 GMT (envelope-from rdivacky@FreeBSD.org) Date: Thu, 6 Jul 2006 16:21:20 GMT Message-Id: <200607061621.k66GLK9m097786@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to rdivacky@FreeBSD.org using -f From: Roman Divacky To: Perforce Change Reviews Cc: Subject: PERFORCE change 100772 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jul 2006 16:21:21 -0000 http://perforce.freebsd.org/chv.cgi?CH=100772 Change 100772 by rdivacky@rdivacky_witten on 2006/07/06 16:20:54 First attempt to fix the TID handling. Restructure the proc_init() thing to set pid in exec case and remove proces from emuldata list in proc_exit(). Affected files ... .. //depot/projects/soc2006/rdivacky_linuxolator/i386/linux/linux_machdep.c#9 edit Differences ... ==== //depot/projects/soc2006/rdivacky_linuxolator/i386/linux/linux_machdep.c#9 (text+ko) ==== @@ -1026,11 +1026,28 @@ struct proc *p; /* XXX: locking? */ - MALLOC(em, struct linux_emuldata *, sizeof *em, M_LINUX, M_WAITOK | M_ZERO); + if (child != 0) { + /* non-exec call */ + MALLOC(em, struct linux_emuldata *, sizeof *em, M_LINUX, M_WAITOK | M_ZERO); + em->pid = child; + SLIST_INSERT_HEAD(&emuldata_head, em, emuldatas); + } else { + found = 0; + /* lookup the old one */ + SLIST_FOREACH(em, &emuldata_head, emuldatas) + if (em->pid == td->td_proc->p_pid) { + found = 1; + break; + } + if (found == 0) { + /* this should not happen */ +#ifdef DEBUG + printf("emuldata not found in exec case.\n"); +#endif + return (0); + } + } - /* exec call */ - if (child != 0) - em->pid = child; em->child_clear_tid = NULL; em->child_set_tid = NULL; @@ -1045,22 +1062,11 @@ if (found) { em->clear_tid = p_em->clear_tid; em->set_tid = p_em->set_tid; - } - - /* we have to free the old emuldata */ - if (child == 0) { - found = 0; - /* lookup the old one */ - SLIST_FOREACH(p_em, &emuldata_head, emuldatas) - if (em->pid == td->td_proc->p_pid) { - found = 1; - break; - } - if (found) - FREE(em, M_LINUX); + } else { + em->clear_tid = NULL; + em->set_tid = NULL; } - SLIST_INSERT_HEAD(&emuldata_head, em, emuldatas); /* XXX: sched_lock locking? */ @@ -1095,6 +1101,8 @@ /* TODO: futexes stuff */ } + SLIST_REMOVE(&emuldata_head, em, linux_emuldata, emuldatas); + /* clean the stuff up */ FREE(em, M_LINUX);