Commit db942e03 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

In one of the the first threads we launch, test that errno is thread local

and working, and panic with a somewhat usable message if not.

PS: And boy, are you screwed if my test sneaks though a kernel bug...



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4569 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent c0833695
......@@ -404,9 +404,21 @@ wrk_herdtimer_thread(void *priv)
volatile unsigned u;
double t_idle;
struct varnish_stats vsm, *vs;
int errno_is_multi_threaded;
THR_SetName("wrk_herdtimer");
/*
* This is one of the first threads created, test to see that
* errno is really per thread. If this fails, your C-compiler
* needs some magic argument (-mt, -pthread, -pthreads etc etc).
*/
errno = 0;
AN(unlink("/")); /* This had better fail */
errno_is_multi_threaded = errno;
assert(errno_is_multi_threaded != 0);
assert(errno == EISDIR);
memset(&vsm, 0, sizeof vsm);
vs = &vsm;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment