Fix missing __lock / __unlock.

This was noticed as srandom / random use those.

Fixes issue #2916.
Merge pull request #2919 from waywardmonkeys/fix-random-libc-locking

Fix missing __lock / __unlock.