Quoting Michael H. Warfield (m...@wittsend.com): looks good, one comment (a "you were right" :)
... > + /* Start of environment variable setup for hooks */ > + if (setenv("LXC_NAME", name, 1)) { > + SYSERROR("failed to set environment variable for container > name"); > + } > + if (setenv("LXC_CONFIG_FILE", conf->rcfile, 1)) { > + SYSERROR("failed to set environment variable for config path"); > + } > + if (setenv("LXC_ROOTFS_MOUNT", conf->rootfs.mount, 1)) { > + SYSERROR("failed to set environment variable for rootfs mount"); > + } > + if (setenv("LXC_ROOTFS_PATH", conf->rootfs.path, 1)) { > + SYSERROR("failed to set environment variable for rootfs mount"); > + } > + if (conf->console.path && setenv("LXC_CONSOLE", conf->console.path, 1)) > { > + SYSERROR("failed to set environment variable for console path"); > + } > + if (conf->console.log_path && setenv("LXC_CONSOLE_LOGPATH", > conf->console.log_path, 1)) { > + SYSERROR("failed to set environment variable for console log"); > + } > + /* Not quite sure right now what these next two actually do but > + * leaving them in, just not documenting them, for the moment just > + * in case they are a work in progress somewhere else. */ > + if (conf->logfile && setenv("LXC_LOGPATH", conf->logfile, 1)) { > + SYSERROR("failed to set environment variable for console log"); > + } Sorry - definately the scripts don't need to know LXC_LOGPATH. That's only to keep track (in memory) of the logfile that was stored in the rcfile in case it was override with -o in lxc_start. So actually you're right, I think we should get rid of that variable, just use it (or not) when we see it. I was thinking we might want to store it in some cases for the api - but then if we're using lxc-start we're not using the api, and we only override at lxc-start. So no sense storing this. > + { > + char loglevel[16]; > + snprintf( loglevel, 14, "%d", conf->loglevel ); > + if (setenv("LXC_LOGLEVEL", loglevel, 1)) { > + SYSERROR("failed to set environment variable for log > level mount"); > + } > + } > + /* End of environment variable setup for hooks */ > + > if (run_lxc_hooks(name, "pre-start", conf)) { > ERROR("failed to run pre-start hooks for container '%s'.", > name); > goto out_aborting; > @@ -575,6 +609,21 @@ static int do_start(void *data) > goto out_warn_father; > } > > + /* The clearenv() and putenv() calls have been moved here > + * to allow us to use enviroment variables passed to the various > + * hooks, such as the start hook above. Not all of the > + * variables like CONFIG_PATH or ROOTFS are valid in this > + * context but others are. */ > + if (clearenv()) { > + SYSERROR("failed to clear environment"); > + /* don't error out though */ > + } > + > + if (putenv("container=lxc")) { > + SYSERROR("failed to set environment variable"); > + return -1; > + } > + > close(handler->sigfd); > > /* after this call, we are in error because this > ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnmore_122712 _______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel