xref: /netbsd-src/tests/libexec/ld.elf_so/h_df_1_noopen.c (revision e04e416493fe7632ef30bdab0c054ab6c0fe3b17)
1f1d73a2cSskrll /*-
2f1d73a2cSskrll  * Copyright (c) 2010 The NetBSD Foundation, Inc.
3f1d73a2cSskrll  * All rights reserved.
4f1d73a2cSskrll  *
5f1d73a2cSskrll  * This code is derived from software contributed to The NetBSD Foundation
6267d9934Sskrll  * by Nick Hudson.
7f1d73a2cSskrll  *
8f1d73a2cSskrll  * Redistribution and use in source and binary forms, with or without
9f1d73a2cSskrll  * modification, are permitted provided that the following conditions
10f1d73a2cSskrll  * are met:
11f1d73a2cSskrll  * 1. Redistributions of source code must retain the above copyright
12f1d73a2cSskrll  *    notice, this list of conditions and the following disclaimer.
13f1d73a2cSskrll  * 2. Redistributions in binary form must reproduce the above copyright
14f1d73a2cSskrll  *    notice, this list of conditions and the following disclaimer in the
15f1d73a2cSskrll  *    documentation and/or other materials provided with the distribution.
16f1d73a2cSskrll  *
17f1d73a2cSskrll  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18f1d73a2cSskrll  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19f1d73a2cSskrll  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20f1d73a2cSskrll  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21f1d73a2cSskrll  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22f1d73a2cSskrll  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23f1d73a2cSskrll  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24f1d73a2cSskrll  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25f1d73a2cSskrll  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26f1d73a2cSskrll  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27f1d73a2cSskrll  * POSSIBILITY OF SUCH DAMAGE.
28f1d73a2cSskrll  */
29f1d73a2cSskrll 
30f1d73a2cSskrll #include <stdio.h>
31f1d73a2cSskrll #include <dlfcn.h>
32f1d73a2cSskrll #include <err.h>
33f1d73a2cSskrll #include <unistd.h>
34f1d73a2cSskrll 
35f1d73a2cSskrll int
main(void)36f1d73a2cSskrll main(void)
37f1d73a2cSskrll {
38f1d73a2cSskrll 	void *handle;
39f1d73a2cSskrll 
40f1d73a2cSskrll 	handle = dlopen("libpthread.so", RTLD_NOLOAD);
41f1d73a2cSskrll 	if (handle == NULL)
42*e04e4164Sjoerg 		errx(1, "%s", dlerror());
43f1d73a2cSskrll 
44f1d73a2cSskrll 	printf("libpthread loaded successfully\n");
45f1d73a2cSskrll 	return 0;
46f1d73a2cSskrll }
47