On 2025/3/18 21:06, Johannes Berg wrote: > On Thu, 2025-03-06 at 23:07 +0800, Tiwei Bie wrote: >> Introduce a new set of utility functions that can be used to create >> pthread-based helpers. Helper threads created in this way will ensure >> thread safety for errno while sharing the same memory space. > > Using pthreads seemed odd, but Benjamin argues that it's the only way to > get libc to really sort it all out, unless we never use libc syscall > functions, which is probably kind of unreasonable? Or maybe we could?
Thanks, Benjamin! :) Yeah, it's also the only way I've figured out so far, unless we don't use libc. > > > Either way though, > >> +#include <pthread.h> > >> + err = pthread_create(&td->handle, NULL, routine, arg); > > if we're going to use pthread API, then we need to link against it? I had the same first thought, but scripts/link-vmlinux.sh already handles it: https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/link-vmlinux.sh?h=v6.14-rc7#n85 Regards, Tiwei