Skip to content
A much faster popen() and system() implementation for Linux
Branch: master
Clone or download
Latest commit 1f9eaf4 Dec 19, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
misc issue #5: update URL Apr 13, 2015
performance_tests
README GPL -> LGPL license. Sep 30, 2011
README.md Add posix_spawn() note Dec 19, 2018
popen_noshell.c Silence warning Jan 30, 2018
popen_noshell.h
popen_noshell_examples.c Demonstrate all possible options. May 24, 2013
popen_noshell_tests.c
popen_noshell_tests.cpp

README.md

Tests show that fork() calls on Linux get slower as the parent process uses more memory. So do popen() and system().

Update: If you have glibc 2.24 (2016-08-05) or newer, you should use posix_spawn() instead which is a standard glibc function featuring similar performance results.

This project is a much faster and more secure re-implementation of the Libc popen() and system() calls for Linux. The functions of this library can be used in currently existing source code which uses the standard popen() and system() functions. Small code modifications are required.

For more detailed information and benchmarks, please review the following blog pages:

Documentation, examples, unit tests and a performance benchmark tool are included in the source code.

A few caveats, as described in issue #11:

  • If you use any signal handlers in the parent process, you may need to temporarily block them before executing popen_noshell().
  • Multi-threaded applications must be extra careful, especially with setuid() calls and its friends.

Any comments, positive or negative, are welcome. Send them directly to my Gmail address, or use the "Issues" tracker here.

You can’t perform that action at this time.