2 #include "system/wait.h"
3 #include "system/threads.h"
6 int main(int argc
, const char *argv
[])
14 const char *nss_winbind
= (argc
>= 2 ? argv
[1] : "bin/plugins/libnss_winbind.so.2");
15 void *nss_winbind_handle
= NULL
;
19 } nss_winbind_endpwent
= { .symbol
= NULL
, };
22 * load and invoke something simple like
23 * _nss_winbind_endpwent in order to
24 * get the libnss_winbind internal going
26 nss_winbind_handle
= dlopen(nss_winbind
, RTLD_NOW
);
27 printf("%d: nss_winbind[%s] nss_winbind_handle[%p]\n",
28 getpid(), nss_winbind
, nss_winbind_handle
);
29 assert(nss_winbind_handle
!= NULL
);
31 nss_winbind_endpwent
.symbol
= dlsym(nss_winbind_handle
,
32 "_nss_winbind_endpwent");
33 printf("%d: nss_winbind_handle[%p] _nss_winbind_endpwent[%p]\n",
34 getpid(), nss_winbind_handle
, nss_winbind_endpwent
.symbol
);
35 assert(nss_winbind_endpwent
.symbol
!= NULL
);
36 (void)nss_winbind_endpwent
.fn();
41 pthread_key_create(&k1
, NULL
);
42 pthread_setspecific(k1
, val
);
43 printf("%d: k1=%d\n", getpid(), k1
);
49 return WEXITSTATUS(wstatus
);
52 pthread_key_create(&k2
, NULL
);
53 pthread_setspecific(k2
, val
);
55 printf("%d: Hello after fork, k1=%d, k2=%d\n", getpid(), k1
, k2
);
62 return WEXITSTATUS(wstatus
);
65 pthread_key_create(&k3
, NULL
);
66 pthread_setspecific(k3
, val
);
68 printf("%d: Hello after fork2, k1=%d, k2=%d, k3=%d\n", getpid(), k1
, k2
, k3
);
70 if (k1
== k2
|| k2
== k3
) {
71 printf("%d: FAIL inconsistent keys\n", getpid());
75 printf("%d: OK consistent keys\n", getpid());