qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Allow default network type to be determined fro


From: Rob Landley
Subject: Re: [Qemu-devel] [PATCH] Allow default network type to be determined from an environmental variable
Date: Mon, 11 Feb 2008 18:17:30 -0600
User-agent: KMail/1.9.6 (enterprise 0.20070907.709405)

On Saturday 19 January 2008 15:10:09 Paul Brook wrote:
> > In the absence of a global configuration file, a reasonably sane way to
> > support this configuration system wide is to use an environmental
> > variable.  QEMU already uses a number of global variables for
> > configuring audio options.
>
> I'd really prefer we didn't do this, and preferably obsoleted/removed the
> existing environment variables.  IMHO using environment variables is a
> really bad idea and should be avoided wherever possible.
>
> Environment variables are about the worst user interface I can think of.
> For a start they're a global resource, which is limited on some systems.

On Windows, you mean?

They're a per-process resource on Linux.  Inherited from the parent process, 
sure, but you inherit _copies_ of them, and changes you make to those copies 
don't propagate to parent processes.  (A given process's environment 
variables aren't even necessarily passed on to its child processes.  You 
supply the envionment variables to the syscall and wrappers like execle() let 
you specify.  The "env" command exists to do this for you.)

Essentially the environment variables passed into a process are a second set 
of command line arguments (literally: argument 3 to main() is your list of 
environment variables, an array of pointers to "name=value" strings, with a 
null pointer terminating the array.  Generally your setup code copies this 
pointer to _environ but you can grab it manually if you like.)  There's no 
limit on the size here any more than there is on command line arguments.  
(Your _shell_ may limit command line arguments, but you can pipe stuff to 
xargs to get around that.)

> It's also extremely hard to determine what environment a user is running.

Type "set" with no arguments.  (I admit bash 3.x throws insane amounts of crap 
into this by default, but any program that's exposed to the FSF for an 
extended period of time bloats beyond recognition.)

The sane way to do this is prefix all the environment variables QEMU uses with 
QEMU_ so you can go

  set | grep QEMU

And see just what you're interested in.

Would that make this approach more palatable?

Rob
-- 
"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]