[LTP] [PATCH] fcntl37: test posix lock across execve
Cyril Hrubis
chrubis@suse.cz
Mon Mar 26 16:42:03 CEST 2018
Hi!
> > + pthread_t th;
> > + SAFE_PTHREAD_CREATE(&th, NULL, thread_fn, (void *)&fd);
> ^
> Here as well, we
> have to cast the fd
> to intptr_t first.
Scratch that, you are passing the fd by pointer not by value, which is
questionable practice for a value on the function stack.
What is usually done when you need to pass integers to threads as
paramters is to cast the integer to a type with the same width as a
pointer then casting it to a void*, which is (void*)(intptr_t)fd in this
case.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list