From patchwork Thu Jul 15 20:28:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Weil X-Patchwork-Id: 59044 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 99C1AB707C for ; Fri, 16 Jul 2010 06:31:20 +1000 (EST) Received: from localhost ([127.0.0.1]:34916 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OZV5R-0007OZ-NS for incoming@patchwork.ozlabs.org; Thu, 15 Jul 2010 16:31:17 -0400 Received: from [140.186.70.92] (port=40514 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OZV34-0005yO-W7 for qemu-devel@nongnu.org; Thu, 15 Jul 2010 16:28:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OZV32-0007Zs-Qh for qemu-devel@nongnu.org; Thu, 15 Jul 2010 16:28:50 -0400 Received: from moutng.kundenserver.de ([212.227.17.10]:49466) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZV32-0007YM-Fk for qemu-devel@nongnu.org; Thu, 15 Jul 2010 16:28:48 -0400 Received: from flocke.weilnetz.de (p54ADF11B.dip.t-dialin.net [84.173.241.27]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0LdIov-1Ozj2k3o81-00irnh; Thu, 15 Jul 2010 22:28:40 +0200 Received: from stefan by flocke.weilnetz.de with local (Exim 4.72) (envelope-from ) id 1OZV2s-0001uO-LQ; Thu, 15 Jul 2010 22:28:38 +0200 From: Stefan Weil To: QEMU Developers Date: Thu, 15 Jul 2010 22:28:37 +0200 Message-Id: <1279225717-7309-1-git-send-email-weil@mail.berlios.de> X-Mailer: git-send-email 1.7.1 X-Provags-ID: V02:K0:IHzq99V81EQ+6PteZWr0SUWU+MeQNwkU5IxWfZ1f20g eJLDgIyjcZLKut/oMgsHzC09cJBb68YcFjF9Gpa3uBqedn0u9p MMJA9l8OMkIA753Noa4d12DPkBkIG56jDRHWWrfO1v/1Xgm2Fy av56DgGh+iXVMbLrI1Xn9AHN761zJsVH54rLWZvwQBQnxDnprj mbJImazRhVXRkj1KTCViiGp5PLEgklFDmsoyLXDhnlipDcihRk zCwN1DgCYIGdy X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Subject: [Qemu-devel] [PATCH] Add new user mode option -ignore-environment X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org An empty environment is sometimes useful in user mode. The new option provides it for linux-user and bsd-user (darwin-user still has no environment related options). The patch also adds the documentation for other environment related options. Signed-off-by: Stefan Weil --- bsd-user/main.c | 6 ++++++ linux-user/main.c | 6 ++++++ qemu-doc.texi | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 0 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index aff9f13..6b12f8b 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -795,6 +795,12 @@ int main(int argc, char **argv) r = argv[optind++]; if (envlist_setenv(envlist, r) != 0) usage(); + } else if (!strcmp(r, "ignore-environment")) { + envlist_free(envlist); + if ((envlist = envlist_create()) == NULL) { + (void) fprintf(stderr, "Unable to allocate envlist\n"); + exit(1); + } } else if (!strcmp(r, "U")) { r = argv[optind++]; if (envlist_unsetenv(envlist, r) != 0) diff --git a/linux-user/main.c b/linux-user/main.c index 403c8d3..bf60922 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -2759,6 +2759,12 @@ int main(int argc, char **argv, char **envp) r = argv[optind++]; if (envlist_setenv(envlist, r) != 0) usage(); + } else if (!strcmp(r, "ignore-environment")) { + envlist_free(envlist); + if ((envlist = envlist_create()) == NULL) { + (void) fprintf(stderr, "Unable to allocate envlist\n"); + exit(1); + } } else if (!strcmp(r, "U")) { r = argv[optind++]; if (envlist_unsetenv(envlist, r) != 0) diff --git a/qemu-doc.texi b/qemu-doc.texi index e67bf44..ec7820e 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -2136,6 +2136,13 @@ Set the x86 elf interpreter prefix (default=/usr/local/qemu-i386) Set the x86 stack size in bytes (default=524288) @item -cpu model Select CPU model (-cpu ? for list and additional feature selection) +@item -ignore-environment +Start with an empty environment. Without this option, +the inital environment is a copy of the caller's environment. +@item -E @var{var}=@var{value} +Set environment @var{var} to @var{value}. +@item -U @var{var} +Remove @var{var} from the environment. @item -B offset Offset guest address by the specified number of bytes. This is useful when the address region required by guest applications is reserved on the host. @@ -2359,6 +2366,13 @@ Print the help Set the library root path (default=/) @item -s size Set the stack size in bytes (default=524288) +@item -ignore-environment +Start with an empty environment. Without this option, +the inital environment is a copy of the caller's environment. +@item -E @var{var}=@var{value} +Set environment @var{var} to @var{value}. +@item -U @var{var} +Remove @var{var} from the environment. @item -bsd type Set the type of the emulated BSD Operating system. Valid values are FreeBSD, NetBSD and OpenBSD (default).