1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00
cde/src/cmd/ksh93/edit
Martijn Dekker 843b546c1a rm redundant getpid(2) syscalls (re: 9de65210)
Now that we have ${.sh.pid} a.k.a. shgd->current_pid, which is
updated using getpid() whenever forking a new process, there is no
need for anything else to ever call getpid(); we can use the stored
value instead. There were a lot of these syscalls kicking around,
some of them in performance-sensitive places.

The following lists only changes *other* than changing getpid() to
shgd->currentpid.

src/cmd/ksh93/include/defs.h:
- Comments: clarify what shgd->{pid,ppid,current_pid} are for.

src/cmd/ksh93/sh/main.c,
src/cmd/ksh93/sh/init.c:
- On reinit for a new script, update shgd->{pid,ppid,current_pid}
  in the sh_reinit() function itself instead of calling sh_reinit()
  from sh_main() and then updating those immediately after that
  call. It just makes more sense this way. Nothing else ever calls
  sh_reinit() so there are no side effects.

src/cmd/ksh93/sh/xec.c: _sh_fork():
- Update shgd->current_pid in the child early, so that the rest of
  the function can use it instead of calling getpid() again.
- Remove reassignment of SH_PIDNOD->nvalue.lp value pointer to
  shgd->current_pid (which makes ${.sh.pid} work in the shell).
  It's constant and was already set on init.
2020-09-23 04:19:02 +02:00
..
completion.c SHOPT_MULTIBYTE-related cleanup (re: 8477d2ce) 2020-08-30 04:50:57 +01:00
edit.c A few job control (-m, -o monitor) fixes (rhbz#960034) 2020-09-18 04:42:27 +02:00
emacs.c emacs, vi: Support repeat parameters to VT220 keys (re: f2a3f4e3) 2020-09-17 19:14:39 +02:00
hexpand.c Fix 80 typos in comments 2020-06-12 01:45:12 +02:00
history.c rm redundant getpid(2) syscalls (re: 9de65210) 2020-09-23 04:19:02 +02:00
vi.c emacs, vi: Support repeat parameters to VT220 keys (re: f2a3f4e3) 2020-09-17 19:14:39 +02:00