thr_main_np.c revision 256281
1264790Sbapt/* 2264790Sbapt * Copyright (c) 2001 Alfred Perlstein 3264790Sbapt * Author: Alfred Perlstein <alfred@FreeBSD.org> 4264790Sbapt * All rights reserved. 5264790Sbapt * 6264790Sbapt * Redistribution and use in source and binary forms, with or without 7264790Sbapt * modification, are permitted provided that the following conditions 8264790Sbapt * are met: 9264790Sbapt * 1. Redistributions of source code must retain the above copyright 10264790Sbapt * notice, this list of conditions and the following disclaimer. 11264790Sbapt * 2. Redistributions in binary form must reproduce the above copyright 12264790Sbapt * notice, this list of conditions and the following disclaimer in the 13264790Sbapt * documentation and/or other materials provided with the distribution. 14264790Sbapt * 15264790Sbapt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16264790Sbapt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17264790Sbapt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18264790Sbapt * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19264790Sbapt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20264790Sbapt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21264790Sbapt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22264790Sbapt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23264790Sbapt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24264790Sbapt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25264790Sbapt * SUCH DAMAGE. 26264790Sbapt * 27264790Sbapt * $FreeBSD: stable/10/lib/libkse/thread/thr_main_np.c 174689 2007-12-16 23:29:57Z deischen $ 28264790Sbapt */ 29264790Sbapt 30264790Sbapt#include "namespace.h" 31264790Sbapt#include <pthread.h> 32#include <pthread_np.h> 33#include "un-namespace.h" 34#include "thr_private.h" 35 36__weak_reference(_pthread_main_np, pthread_main_np); 37 38/* 39 * Provide the equivelant to Solaris thr_main() function 40 */ 41int 42_pthread_main_np() 43{ 44 45 if (!_thr_initial) 46 return (-1); 47 else 48 return (_pthread_equal(_pthread_self(), _thr_initial) ? 1 : 0); 49} 50