lockfile(mypath,
wantnewlockfile=0,
unlinkfile=0,
waiting_msg=None,
flags=0)
If wantnewlockfile is True then this creates a lockfile in the parent
directory as the file: '.' + basename + '.portage_lockfile'.

_close_fds()

This is intended to be called after a fork, in order to close file
descriptors for locks held by the parent process. This can be called
safely after a fork without exec, unlike the _setup_pipes close_fds
behavior.

Does the NFS, hardlink shuffle to ensure locking on the disk. We
create a PRIVATE hardlink to the real lockfile, that is just a
placeholder on the disk. If our file can 2 references, then we have the
lock. :) Otherwise we lather, rise, and repeat.