2 Copyright (C) 2003 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
25 #define TEST_FUNCTION do_test ()
32 void *handle
= dlopen ("glreflib1.so", RTLD_NOW
);
34 error (EXIT_FAILURE
, 0, "cannot load: glreflib1.so: %s", dlerror ());
36 #define TRY(req, arg) \
37 if (dlinfo (handle, req, arg) != 0) \
39 printf ("dlinfo failed for %s: %s\n", #req, dlerror ()); \
45 TRY (RTLD_DI_LINKMAP
, &l
)
49 printf ("bogus link_map? %p != %p\n", l
, handle
);
54 char origin
[8192]; /* >= PATH_MAX, in theory */
55 TRY (RTLD_DI_ORIGIN
, origin
)
57 printf ("origin: %s\n", origin
);
61 TRY (RTLD_DI_SERINFOSIZE
, &counts
)
63 Dl_serinfo
*buf
= alloca (counts
.dls_size
);
64 buf
->dls_cnt
= counts
.dls_cnt
;
65 buf
->dls_size
= counts
.dls_size
;
66 printf ("%u library directories\n", buf
->dls_cnt
);
67 TRY (RTLD_DI_SERINFO
, buf
)
69 if (counts
.dls_cnt
!= buf
->dls_cnt
)
71 printf ("??? became %u library directories\n", buf
->dls_cnt
);
74 for (unsigned int i
= 0; i
< buf
->dls_cnt
; ++i
)
75 printf ("\t%#02x\t%s\n",
76 buf
->dls_serpath
[i
].dls_flags
,
77 buf
->dls_serpath
[i
].dls_name
);
81 unsigned long int lmid
= 0xdeadbeefUL
;
82 if (dlinfo (handle
, RTLD_DI_LMID
, &lmid
) != 0)
83 printf ("dlinfo refuses RTLD_DI_LMID: %s\n", dlerror ());
86 printf ("dlinfo RTLD_DI_LMID worked? %#lx\n", lmid
);
87 status
= lmid
== 0xdeadbeefUL
;
96 #include "../test-skeleton.c"