Use of the Env
system program is an outdated way of setting startup parameters and environment variables of programs. Instead, you must set the startup parameters and environment variables of programs via the init.yaml.in
or init.yaml
file.
If the value of a startup parameter or environment variable of a program is defined through the Env
program and via the init.yaml.in
or init.yaml
file, the value defined through the Env
program will be applied.
Example of setting startup parameters of a program
Source code of the Env
program is presented below. When the process named NetVfs
starts, the program passes the following two program startup parameters to this process: -l devfs /dev devfs 0
and -l romfs /etc romfs ro
:
env.c
#include <env/env.h>
#include <stdlib.h>
int main(int argc, char** argv)
{
const char* NetVfsArgs[] = {
"-l", "devfs /dev devfs 0",
"-l", "romfs /etc romfs ro"
};
ENV_REGISTER_ARGS("NetVfs", NetVfsArgs);
envServerRun();
return EXIT_SUCCESS;
}
Example of setting environment variables of a program
Source code of the Env
program is presented below. When the process named Vfs3
starts, the program passes the following two program environment variables to this process: ROOTFS=ramdisk0,0 / ext2 0
and UNMAP_ROMFS=1
:
env.c
#include <env/env.h>
#include <stdlib.h>
int main(int argc, char** argv)
{
const char* Vfs3Envs[] = {
"ROOTFS=ramdisk0,0 / ext2 0",
"UNMAP_ROMFS=1"
};
ENV_REGISTER_VARS("Vfs3", Vfs3Envs);
envServerRun();
return EXIT_SUCCESS;
}
Page top