Beispiel #1
0
NATRON_NAMESPACE_USING

int
main(int argc,
     char *argv[])
{
    CLArgs::printBackGroundWelcomeMessage();

    CLArgs args(argc,argv,false);
    if (args.getError() > 0) {
        return 1;
    }

    if (args.isBackgroundMode()) {
        
        AppManager manager;

        // coverity[tainted_data]
        if (!manager.load(argc,argv,args) ) {
            return 1;
        } else {
            return 0;
        }
    } else {
        
        GuiApplicationManager manager;
        
        // coverity[tainted_data]
        return manager.load(argc,argv,args);
        
        //exec() is called within the GuiApplicationManager
    }
} // main
Beispiel #2
0
NATRON_NAMESPACE_USING

int
main(int argc,
     char *argv[])
{
#if defined(Q_OS_UNIX) && defined(RLIMIT_NOFILE)
    /*
     Avoid 'Too many open files' on Unix.

     Increase the number of file descriptors that the process can open to the maximum allowed.
     - By default, Mac OS X only allows 256 file descriptors, which can easily be reached.
     - On Linux, the default limit is usually 1024.

     Note that due to a bug in stdio on OS X, the limit on the number of files opened using fopen()
     cannot be changed after the first call to stdio (e.g. printf() or fopen()).
     Consequently, this has to be the first thing to do in main().
     */
    struct rlimit rl;
    if (getrlimit(RLIMIT_NOFILE, &rl) == 0) {
        if (rl.rlim_max > rl.rlim_cur) {
            rl.rlim_cur = rl.rlim_max;
            if (setrlimit(RLIMIT_NOFILE, &rl) != 0) {
#             if defined(__APPLE__) && defined(OPEN_MAX)
                // On Mac OS X, setrlimit(RLIMIT_NOFILE, &rl) fails to set
                // rlim_cur above OPEN_MAX even if rlim_max > OPEN_MAX.
                if (rl.rlim_cur > OPEN_MAX) {
                    rl.rlim_cur = OPEN_MAX;
                    setrlimit(RLIMIT_NOFILE, &rl);
                }
#             endif
            }
        }
    }
#endif
    
    CLArgs::printBackGroundWelcomeMessage();
    CLArgs args(argc, argv, false);

    if (args.getError() > 0) {
        return 1;
    }

    if ( args.isBackgroundMode() ) {
        AppManager manager;

        // coverity[tainted_data]
        if ( !manager.load(argc, argv, args) ) {
            return 1;
        } else {
            return 0;
        }
    } else {
        GuiApplicationManager manager;

        // coverity[tainted_data]
        return manager.load(argc, argv, args);

        //exec() is called within the GuiApplicationManager
    }
} // main