Add lots of extra ugly, bulky, duplicated IPC locking functions.

Plan to get rid of duplicate code once pipelining is done.