11.1Schristos/* $NetBSD: h_pthread_dlopen.c,v 1.1 2013/03/21 16:50:22 christos Exp $ */ 21.1Schristos/*- 31.1Schristos * Copyright (c) 2013 The NetBSD Foundation, Inc. 41.1Schristos * All rights reserved. 51.1Schristos * 61.1Schristos * This code is derived from software contributed to The NetBSD Foundation 71.1Schristos * by Emmanuel Dreyfus. 81.1Schristos * 91.1Schristos * Redistribution and use in source and binary forms, with or without 101.1Schristos * modification, are permitted provided that the following conditions 111.1Schristos * are met: 121.1Schristos * 131.1Schristos * 1. Redistributions of source code must retain the above copyright 141.1Schristos * notice, this list of conditions and the following disclaimer. 151.1Schristos * 2. Redistributions in binary form must reproduce the above copyright 161.1Schristos * notice, this list of conditions and the following disclaimer in 171.1Schristos * the documentation and/or other materials provided with the 181.1Schristos * distribution. 191.1Schristos * 201.1Schristos * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 211.1Schristos * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 221.1Schristos * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 231.1Schristos * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 241.1Schristos * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 251.1Schristos * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, 261.1Schristos * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 271.1Schristos * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 281.1Schristos * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 291.1Schristos * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 301.1Schristos * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 311.1Schristos * SUCH DAMAGE. 321.1Schristos */ 331.1Schristos 341.1Schristos#include <sys/cdefs.h> 351.1Schristos__RCSID("$NetBSD: h_pthread_dlopen.c,v 1.1 2013/03/21 16:50:22 christos Exp $"); 361.1Schristos 371.1Schristos#if 0 381.1Schristos#include <atf-c.h> 391.1Schristos#else 401.1Schristos#include <assert.h> 411.1Schristos#define ATF_REQUIRE(a) assert(a) 421.1Schristos#endif 431.1Schristos#include <unistd.h> 441.1Schristos#include <pthread.h> 451.1Schristos 461.1Schristosint testf_dso_null(void); 471.1Schristosint testf_dso_mutex_lock(pthread_mutex_t *); 481.1Schristosint testf_dso_mutex_unlock(pthread_mutex_t *); 491.1Schristosint testf_dso_pthread_create(pthread_t *, const pthread_attr_t *, 501.1Schristos void *(*)(void *), void *); 511.1Schristos 521.1Schristosint 531.1Schristostestf_dso_null(void) 541.1Schristos{ 551.1Schristos return 0xcafe; 561.1Schristos} 571.1Schristos 581.1Schristosint 591.1Schristostestf_dso_mutex_lock(pthread_mutex_t *mtx) 601.1Schristos{ 611.1Schristos ATF_REQUIRE(mtx != NULL); 621.1Schristos ATF_REQUIRE(pthread_mutex_lock(mtx) == 0); 631.1Schristos 641.1Schristos return 0xcafe; 651.1Schristos} 661.1Schristos 671.1Schristosint 681.1Schristostestf_dso_mutex_unlock(pthread_mutex_t *mtx) 691.1Schristos{ 701.1Schristos ATF_REQUIRE(mtx != NULL); 711.1Schristos ATF_REQUIRE(pthread_mutex_unlock(mtx) == 0); 721.1Schristos 731.1Schristos return 0xcafe; 741.1Schristos} 751.1Schristos 761.1Schristosint 771.1Schristostestf_dso_pthread_create(pthread_t *thread, const pthread_attr_t *attr, 781.1Schristos void *(*routine)(void *), void *arg) 791.1Schristos{ 801.1Schristos int ret; 811.1Schristos 821.1Schristos ret = pthread_create(thread, attr, routine, arg); 831.1Schristos ATF_REQUIRE(ret == 0); 841.1Schristos 851.1Schristos return 0; 861.1Schristos} 87