Esempio n. 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
int main(int argc, char *argv[])
{
#if defined (Q_OS_MAC)
    /*
     Avoid 'Too many open files' on Mac

     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.
     */
    // see also https://qt.gitorious.org/qt-creator/qt-creator/commit/7f1f9e1
    // increase maximum numbers of file descriptors
	struct rlimit rl;
	getrlimit(RLIMIT_NOFILE, &rl);
 	rl.rlim_cur = qMin((rlim_t)OPEN_MAX, rl.rlim_max);
	setrlimit(RLIMIT_NOFILE, &rl);
#endif

    bool isBackground;
    QString projectName,mainProcessServerName;
    QStringList writers;
    AppManager::parseCmdLineArgs(argc,argv,&isBackground,projectName,writers,mainProcessServerName);
#ifdef Q_OS_UNIX
    projectName = AppManager::qt_tildeExpansion(projectName);
#endif
    
    ///auto-background without a project name is not valid.
    if (projectName.isEmpty()) {
        AppManager::printUsage();
        return 1;
    }
    AppManager manager;
    if (!manager.load(argc,argv,projectName,writers,mainProcessServerName)) {
        AppManager::printUsage();
        return 1;
    } else {
        return 0;
    }
    return 0;
}
Esempio n. 3
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