libc: Move out locking from vsyslog() core.