$ cat proclimitdemo.pro SOURCES += proclimitdemo.cpp $ cat proclimitdemo.cpp#include <QtGui/QApplication>#include <QProcess>#include <QString>#include <QDebug>int main(int argc, char *argv[]) { QApplication a(argc, argv); QProcess *pr[400]; for(int i = 0; i<200; i++) { qDebug() << i; pr[i]=new QProcess(); pr[i]->start("sleep", QStringList() << "10"); }; };
...write(2, "167 \n", 5167 ) = 5pipe2([10, 1009], O_CLOEXEC) = 0pipe2([1013, 1015], O_CLOEXEC) = 0pipe2([1018, 1019], O_CLOEXEC) = 0pipe2([1020, 1021], O_CLOEXEC) = 0pipe2([1022, 1023], O_CLOEXEC) = 0clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7841ad8) = 2443fcntl64(1022, F_GETFL) = 0 (flags O_RDONLY)fcntl64(1022, F_SETFL, O_RDONLY|O_NONBLOCK) = 0close(1021) = 0close(10) = 0fcntl64(1009, F_GETFL) = 0x1 (flags O_WRONLY)fcntl64(1009, F_SETFL, O_WRONLY|O_NONBLOCK) = 0close(1015) = 0fcntl64(1013, F_GETFL) = 0 (flags O_RDONLY)fcntl64(1013, F_SETFL, O_RDONLY|O_NONBLOCK) = 0close(1019) = 0fcntl64(1018, F_GETFL) = 0 (flags O_RDONLY)fcntl64(1018, F_SETFL, O_RDONLY|O_NONBLOCK) = 0write(2, "168 \n", 5168 ) = 5pipe2([10, 1015], O_CLOEXEC) = 0=====================>pipe2(0x98bd788, O_CLOEXEC) = -1 EMFILE (Too many open files)write(2, "QProcessPrivate::createPipe: Can"..., 79QProcessPrivate::createPipe: Cannot create pipe 0x98bd788: Too many open files) = 79write(2, "QSocketNotifier: Invalid socket "..., 42QSocketNotifier: Invalid socket specified) = 42write(2, "QSocketNotifier: Internal error\n", 32QSocketNotifier: Internal error) = 32...
...165 166 ==1839== Warning: invalid file descriptor 1019 in syscall pipe2()QProcessPrivate::createPipe: Cannot create pipe 0x55ad498: Too many open files==1839== Warning: invalid file descriptor 1019 in syscall pipe2()QProcessPrivate::createPipe: Cannot create pipe 0x55ad4a0: Too many open files==1839== Warning: invalid file descriptor 1020 in syscall close()167 ...
LANG=C emerge --infoPortage 2.2_rc67 (default/linux/x86/10.0, gcc-4.4.3, glibc-2.11-r1, 2.6.33-gentoo i686)=================================================================System uname: Linux-2.6.33-gentoo-i686-Intel-R-_Core-TM-2_Duo_CPU_E7600_@_3.06GHz-with-gentoo-2.0.1Timestamp of tree: Tue, 30 Mar 2010 19:45:03 +0000ccache version 2.4 [enabled]app-shells/bash: 4.1_p2-r1dev-java/java-config: 2.1.10dev-lang/python: 2.6.5-r1, 3.1.2-r1dev-util/ccache: 2.4-r8dev-util/cmake: 2.8.1sys-apps/baselayout: 2.0.1sys-apps/openrc: 0.6.1-r1sys-apps/sandbox: 2.2sys-devel/autoconf: 2.13, 2.65sys-devel/automake: 1.8.5-r4, 1.9.6-r3, 1.10.3, 1.11.1sys-devel/binutils: 2.20.1sys-devel/gcc: 4.4.3sys-devel/gcc-config: 1.4.1sys-devel/libtool: 2.2.6bvirtual/os-headers: 2.6.33ACCEPT_KEYWORDS="x86 ~x86"ACCEPT_LICENSE="*"CBUILD="i686-pc-linux-gnu"CFLAGS="-O2 -march=native -mtune=native -pipe -fomit-frame-pointer"CHOST="i686-pc-linux-gnu"CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config"CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"CXXFLAGS="-O2 -march=native -mtune=native -pipe -fomit-frame-pointer"DISTDIR="/var/portage/distfiles"FEATURES="assume-digests buildpkg candy ccache distlocks fixpackages news parallel-fetch preserve-libs protect-owned sfperms strict unmerge-logs unmerge-orphans userfetch"GENTOO_MIRRORS="http://gentoo.nix-files.org.ru"LANG="C"LC_ALL=""LDFLAGS="-Wl,-O1"LINGUAS="ru"MAKEOPTS="-j5"PKGDIR="/var/portage/packages"PORTAGE_CONFIGROOT="/"PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"PORTAGE_TMPDIR="/var/portage/.tmp"PORTDIR="/var/portage"PORTDIR_OVERLAY="/usr/local/portage/my"SYNC="rsync://gentoo.nix-files.org.ru/gentoo-portage"USE="7zip X a52 aac aalib acl acpi aim alsa amr amrnb amrwb apache2 bash-completion blender-game bluetooth bzip2 cairo cli clock-screen clucene consolekit cracklib crypt ctype cups curl cxx dbus djvu dri dvd dvdread embedded embedded-fuseiso encode ffmpeg filter flac foomaticdb fts3 gd gdbm gecko gif glitz gnutls gpm hal hash hddtemp iconv icotools icq icu imagemagick irc jabber jpeg jpeg2k kde kde4 kdm key-screen kqemu kvm lcms ldap libcaca libwww lm_sensors lzma mbox md5sum melt mmx mng modules mouse mp2 mp3 mp4 mppe-mppc mrnb mudflap mysql ncurses nls nptl nptlonly nsplugin nvidia ogg opencore-amr opengl openmp oscar pae pam passwordsave pch pcre pdf perl png postgres ppds pppd python qemu qt3 qt3support qt4 qtscript quicktime rcc rdesktop readline redland reflection samba sasl scanner sdl search-screen secure-delete semantic-desktop session spl sql sqlite sqlite3 sse sse2 ssl ssse3 startup-notification svg sysfs tcpd theora threads tiff unicode usb vcd vnc vorbis vram webkit wifi win32codecs winetools winetriks x264 x86 xattr xcb xcomposite xinerama xml xorg xscreensaver xv xvid zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="evdev keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="ru" QEMU_SOFTMMU_TARGETS="arm i386 x86_64" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="vesa intel radeon" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
C++ (Qt)std::cout << "_SC_OPEN_MAX == " << sysconf(_SC_OPEN_MAX) << std::endl;