mirror of
git://sourceware.org/git/glibc.git
synced 2025-02-23 13:09:58 +08:00
code, make sure the nis_freeresult call doesn't crash and that the result is reported correctly. * nis/nis_table.c (nis_list): Handle FOLLOW_PATH | ALL_RESULTS when callback is NULL. * nis/Versions (libnss_nisplus): Add _nss_nisplus_initgroups_dyn@@GLIBC_PRIVATE. * nis/Makefile (libnss_nisplus-routines): Add nisplus-initgroups. * nis/nss_nisplus/nisplus-grp.c (tablename_val, tablename_len, _nss_create_tablename): Rename to... (grp_tablename_val, grp_tablename_len, _nss_grp_create_tablename): ... these. No longer static. (internal_setgrent): Adjust users. (_nss_nisplus_getgrnam_r, _nss_nisplus_getgrgid_r): Likewise. Don't use locking around _nss_grp_create_tablename call. * nis/nss_nisplus/nisplus-initgroups.c: New file.
69 lines
1.2 KiB
C
69 lines
1.2 KiB
C
#include <stdio.h>
|
|
|
|
#include <tls.h>
|
|
|
|
#ifdef USE_TLS
|
|
#include "tls-macros.h"
|
|
|
|
|
|
/* One define int variable, two externs. */
|
|
COMMON_INT_DEF(foo);
|
|
VAR_INT_DEF(bar);
|
|
VAR_INT_DECL(baz);
|
|
#endif
|
|
|
|
extern int in_dso (void);
|
|
|
|
int
|
|
in_dso (void)
|
|
{
|
|
int result = 0;
|
|
#ifdef USE_TLS
|
|
int *ap, *bp, *cp;
|
|
|
|
/* Get variables using initial exec model. */
|
|
fputs ("get sum of foo and bar (IE)", stdout);
|
|
asm ("" ::: "memory");
|
|
ap = TLS_IE (foo);
|
|
bp = TLS_IE (bar);
|
|
printf (" = %d\n", *ap + *bp);
|
|
result |= *ap + *bp != 3;
|
|
if (*ap != 1)
|
|
{
|
|
printf ("foo = %d\n", *ap);
|
|
result = 1;
|
|
}
|
|
if (*bp != 2)
|
|
{
|
|
printf ("bar = %d\n", *bp);
|
|
result = 1;
|
|
}
|
|
|
|
|
|
/* Get variables using generic dynamic model. */
|
|
fputs ("get sum of foo and bar and baz (GD)", stdout);
|
|
ap = TLS_GD (foo);
|
|
bp = TLS_GD (bar);
|
|
cp = TLS_GD (baz);
|
|
printf (" = %d\n", *ap + *bp + *cp);
|
|
result |= *ap + *bp + *cp != 6;
|
|
if (*ap != 1)
|
|
{
|
|
printf ("foo = %d\n", *ap);
|
|
result = 1;
|
|
}
|
|
if (*bp != 2)
|
|
{
|
|
printf ("bar = %d\n", *bp);
|
|
result = 1;
|
|
}
|
|
if (*cp != 3)
|
|
{
|
|
printf ("baz = %d\n", *cp);
|
|
result = 1;
|
|
}
|
|
#endif
|
|
|
|
return result;
|
|
}
|