thr_system.c revision 119723
1178825Sdfr/* 2233294Sstas * Copyright (C) 2000 Jason Evans <jasone@freebsd.org>. 3233294Sstas * All rights reserved. 4233294Sstas * 5178825Sdfr * Redistribution and use in source and binary forms, with or without 6233294Sstas * modification, are permitted provided that the following conditions 7233294Sstas * are met: 8233294Sstas * 1. Redistributions of source code must retain the above copyright 9178825Sdfr * notice(s), this list of conditions and the following disclaimer as 10233294Sstas * the first lines of this file unmodified other than the possible 11233294Sstas * addition of one or more copyright notices. 12178825Sdfr * 2. Redistributions in binary form must reproduce the above copyright 13233294Sstas * notice(s), this list of conditions and the following disclaimer in 14233294Sstas * the documentation and/or other materials provided with the 15233294Sstas * distribution. 16178825Sdfr * 17233294Sstas * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY 18233294Sstas * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19233294Sstas * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20178825Sdfr * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE 21233294Sstas * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22233294Sstas * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23233294Sstas * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 24233294Sstas * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25233294Sstas * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 26233294Sstas * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 27233294Sstas * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28233294Sstas * 29233294Sstas * $FreeBSD: head/lib/libkse/thread/thr_system.c 119723 2003-09-03 17:56:26Z deischen $ 30233294Sstas */ 31233294Sstas 32178825Sdfr#include <stdlib.h> 33178825Sdfr#include <pthread.h> 34178825Sdfr#include "thr_private.h" 35178825Sdfr 36178825Sdfrextern int __system(const char *); 37178825Sdfr 38178825Sdfr__weak_reference(_system, system); 39178825Sdfr 40178825Sdfrint 41178825Sdfr_system(const char *string) 42178825Sdfr{ 43178825Sdfr struct pthread *curthread = _get_curthread(); 44178825Sdfr int ret; 45178825Sdfr 46178825Sdfr _thr_enter_cancellation_point(curthread); 47178825Sdfr ret = __system(string); 48178825Sdfr _thr_leave_cancellation_point(curthread); 49178825Sdfr 50178825Sdfr return ret; 51178825Sdfr} 52178825Sdfr