1. Passing of command line arguments

When a program is spawned using the g_spawn system function, it is possible to pass a string containing command line arguments. As a separator between each argument in the string a G_CLIARGS_SEPARATOR character shall be used. This character is defined as the ASCII "UNIT SEPARATOR" (0x1F).

An argument string could then look like this:

"first argument\0x1Fsecond argument"

The g_spawn call passes this information to the spawner process. During the actual process creation, the spawner process will use the g_cli_args_store system call to save the arguments for the spawned process.

Once the spawned process starts execution, right before jumping into the main function, the parsing routine (which is called during g_main) will use g_cli_args_release to retrieve the argument string from the kernel. Those arguments are then split at the separator character and put in an array that is passed as argv to the users main function.