The Linux target's sys/lock.h provided no-op inline stubs, which was
safe only under the assumption of single-threaded execution. With the
new FreeRTOS Linux simulator using soft preemption, an outgoing task
can still run concurrently with the incoming task until it reaches a
yield point, making no-op locks unsafe.
Replace the no-op implementation with real pthread mutexes:
- Change _lock_t from `typedef int` to `typedef void *` (pointer to a
heap-allocated pthread_mutex_t).
- Implement all _lock_* functions in a new lock.c, supporting both
normal and recursive mutexes.
- Zero-initialized locks are lazily created on first acquire using
double-checked locking, preserving newlib/esp_libc semantics.
- Add lock.c unconditionally to the linux component sources and link
pthread.
Some files that should have their copyrights checked are still placed on the
copyright ignore list.
- These entries have been tidied up
- Copyrights of those files have been updated.