From owner-p4-projects@FreeBSD.ORG Sat Jun 17 08:57:35 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 D3C5416A47D; Sat, 17 Jun 2006 08:57:34 +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 B01CC16A47B for ; Sat, 17 Jun 2006 08:57:34 +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 70FE243D45 for ; Sat, 17 Jun 2006 08:57:34 +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 k5H8vYIM017133 for ; Sat, 17 Jun 2006 08:57:34 GMT (envelope-from rdivacky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k5H8vYVk017130 for perforce@freebsd.org; Sat, 17 Jun 2006 08:57:34 GMT (envelope-from rdivacky@FreeBSD.org) Date: Sat, 17 Jun 2006 08:57:34 GMT Message-Id: <200606170857.k5H8vYVk017130@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 99406 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: Sat, 17 Jun 2006 08:57:35 -0000 http://perforce.freebsd.org/chv.cgi?CH=99406 Change 99406 by rdivacky@rdivacky_witten on 2006/06/17 08:56:59 Change the emulpath sysctl to be per-prison. Affected files ... .. //depot/projects/soc2006/rdivacky_linuxolator/amd64/linux32/linux32_sysvec.c#3 edit .. //depot/projects/soc2006/rdivacky_linuxolator/compat/linprocfs/linprocfs.c#2 edit .. //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_mib.c#3 edit .. //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_util.c#3 edit .. //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_util.h#2 edit .. //depot/projects/soc2006/rdivacky_linuxolator/i386/linux/linux_sysvec.c#3 edit Differences ... ==== //depot/projects/soc2006/rdivacky_linuxolator/amd64/linux32/linux32_sysvec.c#3 (text+ko) ==== @@ -1018,7 +1018,7 @@ ELFOSABI_LINUX, EM_386, "Linux", - linux_emul_path, + "/compat/linux/", "/lib/ld-linux.so.1", &elf_linux_sysvec, NULL, @@ -1029,7 +1029,7 @@ ELFOSABI_LINUX, EM_386, "Linux", - linux_emul_path, + "/compat/linux/", "/lib/ld-linux.so.2", &elf_linux_sysvec, NULL, ==== //depot/projects/soc2006/rdivacky_linuxolator/compat/linprocfs/linprocfs.c#2 (text+ko) ==== @@ -281,7 +281,9 @@ char *dlep, *flep, *mntto, *mntfrom, *fstype; size_t lep_len; int error; + char linux_emul_path[LINUX_NAME_MAX]; + linux_get_emul_path(td, linux_emul_path); /* resolve symlinks etc. in the emulation tree prefix */ NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path, td); flep = NULL; ==== //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_mib.c#3 (text+ko) ==== @@ -90,7 +90,7 @@ static int linux_sysctl_linux_emul_path(SYSCTL_HANDLER_ARGS) { - char emul_path[LINUX_NAME_MAX]; + static char emul_path[LINUX_NAME_MAX]; int error; Elf32_Brandinfo **brandinfo; @@ -99,10 +99,39 @@ if (error || req->newptr == NULL) return (error); error = linux_set_emul_path(req->td, emul_path); - for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL; - ++brandinfo) - if (elf32_insert_brand_entry(*brandinfo) < 0) - error = EINVAL; + { + static Elf32_Brandinfo linux_brand = { + ELFOSABI_LINUX, + EM_386, + "Linux", + emul_path, + "/lib/ld-linux.so.1", + &elf_linux_sysvec, + NULL, + BI_CAN_EXEC_DYN, + }; + static Elf32_Brandinfo linux_glibc2brand = { + ELFOSABI_LINUX, + EM_386, + "Linux", + emul_path, + "/lib/ld-linux.so.2", + &elf_linux_sysvec, + NULL, + BI_CAN_EXEC_DYN, + }; + + Elf32_Brandinfo *local_linux_brandlist[] = { + &linux_brand, + &linux_glibc2brand, + NULL + }; + + for (brandinfo = &local_linux_brandlist[0]; *brandinfo != NULL; + ++brandinfo) + if (elf32_insert_brand_entry(*brandinfo) < 0) + error = EINVAL; + } return (error); } ==== //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_util.c#3 (text+ko) ==== @@ -47,6 +47,12 @@ #include #include +#ifdef COMPAT_LINUX32 +#include +#else +#include +#endif +#include /* * Search an alternate path before passing pathname arguments on @@ -64,6 +70,9 @@ char **pbuf; int cflag; { + char linux_emul_path[LINUX_NAME_MAX]; + + linux_get_emul_path(td, linux_emul_path); return (kern_alternate_path(td, linux_emul_path, path, pathseg, pbuf, cflag)); @@ -83,8 +92,6 @@ printf("\n"); } -MALLOC_DECLARE(M_LINUX); - struct device_element { TAILQ_ENTRY(device_element) list; ==== //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_util.h#2 (text+ko) ==== @@ -75,8 +75,6 @@ return p; } -extern const char linux_emul_path[]; - int linux_emul_convpath(struct thread *, char *, enum uio_seg, char **, int); #define LCONVPATH(td, upath, pathp, i) \ ==== //depot/projects/soc2006/rdivacky_linuxolator/i386/linux/linux_sysvec.c#3 (text+ko) ==== @@ -858,7 +858,7 @@ ELFOSABI_LINUX, EM_386, "Linux", - linux_emul_path, + "/compat/linux/", "/lib/ld-linux.so.1", &elf_linux_sysvec, NULL, @@ -869,7 +869,7 @@ ELFOSABI_LINUX, EM_386, "Linux", - linux_emul_path, + "/compat/linux/", "/lib/ld-linux.so.2", &elf_linux_sysvec, NULL,