ChorusOS 4.0 Porting Guide

Environment Variables

env points to an EnvDesc structure. EnvDesc is declared in ~nucleus/sys/common/src/lib/util/env.h.

typedef struct EnvDesc {     
                int     envSize;    /* current size of environment */     
                int     envMaxSize; /* memory available for environment */     
                char*   envPtr;     /* pointer to the environment */ 
} EnvDesc; 

The system image contains a data file with the initial state of the system environment variables. The env field of the BootConf structure references the contents of this file.

envPtr points to a sequence of environment variable definitions. Each definition is a concatenation of two strings, envVariable and envValue, where envVariable is the null-terminated string name of an environment variable, and envValue is the null-terminated string value of the environment variable.

envSize is the size in bytes of the environment variable definition sequence.

envMaxSize is the environment file size. envSize must not exceed envMaxSize.