cpglock: More cleanup

Replace GPL v2 copyrighted functions from sock.c with newly written
variants so the library bits can be licensed under the LGPL.

Signed-off-by: Ryan McCabe <rmccabe@redhat.com>