Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/docs/nofork_noexec.txt
- Timestamp:
- Feb 25, 2011, 9:26:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi-busybox/docs/nofork_noexec.txt
r1765 r2725 3 3 Unix shells traditionally execute some commands internally in the attempt 4 4 to dramatically speed up execution. It will be slow as hell if for every 5 "echo blah" shell will fork and exec /bin/echo. Forthis end, shells5 "echo blah" shell will fork and exec /bin/echo. To this end, shells 6 6 have to _reimplement_ these commands internally. 7 7 … … 12 12 13 13 Applet will be subject to NOFORK/NOEXEC tricks if it is marked as such 14 in applets.h. CONFIG_FEATURE_PREFER_APPLETS is a config option which14 in applets.h. FEATURE_PREFER_APPLETS is a config option which 15 15 globally enables usage of NOFORK/NOEXEC tricks. 16 If it is enabled, FEATURE_SH_STANDALONE can be enabled too, 17 and then shells will use NOFORK/NOEXEC tricks for ordinary commands. 18 NB: shell builtins use these tricks regardless of FEATURE_SH_STANDALONE 19 or FEATURE_PREFER_APPLETS. 16 20 17 If you want to call a program and wait for it, use spawn_and_wait(argv). 18 It will check whether argv[0] is an applet name and will optionally 19 do NOFORK/NOEXEC thing. 21 In C, if you want to call a program and wait for it, use 22 spawn_and_wait(argv), BB_EXECVP(prog,argv) or BB_EXECLP(prog,argv0,...). 23 They check whether program name is an applet name and optionally 24 do NOFORK/NOEXEC thing depending on configuration. 20 25 21 NOEXEC 26 27 NOEXEC 22 28 23 29 NOEXEC applet should work correctly if another applet forks and then … … 33 39 34 40 NOEXEC applets save only one half of fork+exec overhead. 35 NOEXEC trick is disabled for NOMMU compile.41 NOEXEC trick is disabled for NOMMU build. 36 42 37 NOFORK 43 44 NOFORK 38 45 39 46 NOFORK applet should work correctly if another applet simply runs … … 56 63 allocation. All other allocations should use malloc[_or_warn](). 57 64 After first allocation, you cannot use any xfuncs. 65 Otherwise, failing xfunc will return to caller applet 66 without freeing malloced data! 58 67 * All allocated data, opened files, signal handlers, termios settings, 59 68 O_NONBLOCK flags etc should be freed/closed/restored prior to return.
Note:
See TracChangeset
for help on using the changeset viewer.