//--------------------------------------------------------------------------------------------------
static void GenerateAppLimitsConfig
(
    std::ofstream& cfgStream,
    const legato::App& app
)
//--------------------------------------------------------------------------------------------------
{
    if (app.IsSandboxed() == false)
    {
        cfgStream << "  \"sandboxed\" !f" << std::endl;
    }

    if (app.StartMode() == legato::App::MANUAL)
    {
        cfgStream << "  \"startManual\" !t" << std::endl;
    }

    cfgStream << "  \"maxThreads\" [" << app.MaxThreads().Get() << "]" << std::endl;

    cfgStream << "  \"maxMQueueBytes\" [" << app.MaxMQueueBytes().Get() << "]"
              << std::endl;

    cfgStream << "  \"maxQueuedSignals\" [" << app.MaxQueuedSignals().Get() << "]"
              << std::endl;

    cfgStream << "  \"maxMemoryBytes\" [" << app.MaxMemoryBytes().Get() << "]" << std::endl;

    cfgStream << "  \"cpuShare\" [" << app.CpuShare().Get() << "]" << std::endl;

    if (app.MaxFileSystemBytes().IsSet())
    {
        // This is not supported for unsandboxed apps.
        if (app.IsSandboxed() == false)
        {
            std::cerr << "**** Warning: File system size limit being ignored for unsandboxed"
                      << " application '" << app.Name() << "'." << std::endl;
        }
        else
        {
            cfgStream << "  \"maxFileSystemBytes\" [" << app.MaxFileSystemBytes().Get() << "]"
                      << std::endl;
        }
    }

    if (app.WatchdogTimeout().IsSet())
    {
        cfgStream << "  \"watchdogTimeout\" [" << app.WatchdogTimeout().Get() << "]" << std::endl;
    }

    if (app.WatchdogAction().IsSet())
    {
        cfgStream << "  \"watchdogAction\" \"" << app.WatchdogAction().Get() << "\"" << std::endl;
    }
}