Skip to content

A much faster popen() and system() implementation for Linux

Notifications You must be signed in to change notification settings

famzah/popen-noshell

Repository files navigation

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. You can also take a look at the aspawn project which demonstrates even better performance and is more flexible than posix_spawn().

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.

About

A much faster popen() and system() implementation for Linux

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published