Make sh(1) gprof(1)-able. _exit(2) is directly used because sh uses vfork(2). Thanks to Christos Zoulas. Index: trap.c =================================================================== RCS file: /cvsroot/src/bin/sh/trap.c,v retrieving revision 1.37 diff -u -p -r1.37 trap.c --- trap.c 22 Aug 2015 12:12:47 -0000 1.37 +++ trap.c 15 Dec 2015 20:04:05 -0000 @@ -479,6 +479,8 @@ l1: handler = &loc2; /* probably unn #if JOBS setjobctl(0); #endif -l2: _exit(status); +l2: + _mcleanup(); + _exit(status); /* NOTREACHED */ } Index: trap.h =================================================================== RCS file: /cvsroot/src/bin/sh/trap.h,v retrieving revision 1.22 diff -u -p -r1.22 trap.h --- trap.h 22 Aug 2015 12:12:47 -0000 1.22 +++ trap.h 15 Dec 2015 20:04:05 -0000 @@ -44,3 +44,5 @@ void dotrap(void); void setinteractive(int); void exitshell(int) __dead; int lastsig(void); + +extern void _mcleanup(void);