thr_creat.c revision 119723
117680Spst/*
239300Sfenner * Copyright (C) 2000 Jason Evans <jasone@freebsd.org>.
317680Spst * All rights reserved.
417680Spst *
517680Spst * Redistribution and use in source and binary forms, with or without
617680Spst * modification, are permitted provided that the following conditions
717680Spst * are met:
817680Spst * 1. Redistributions of source code must retain the above copyright
917680Spst *    notice(s), this list of conditions and the following disclaimer as
1017680Spst *    the first lines of this file unmodified other than the possible
1117680Spst *    addition of one or more copyright notices.
1217680Spst * 2. Redistributions in binary form must reproduce the above copyright
1317680Spst *    notice(s), this list of conditions and the following disclaimer in
1417680Spst *    the documentation and/or other materials provided with the
1517680Spst *    distribution.
1617680Spst *
1717680Spst * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
1817680Spst * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1917680Spst * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2053146Sbrian * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
2175118Sfenner * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2275118Sfenner * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2375118Sfenner * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
2453146Sbrian * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
2517680Spst * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
2617680Spst * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
2775118Sfenner * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2875118Sfenner *
2975118Sfenner * $FreeBSD: head/lib/libkse/thread/thr_creat.c 119723 2003-09-03 17:56:26Z deischen $
3075118Sfenner */
3175118Sfenner
3275118Sfenner#include <fcntl.h>
3375118Sfenner#include <pthread.h>
3417680Spst#include "thr_private.h"
35127675Sbms
36146778Ssamextern int __creat(const char *, mode_t);
3717680Spst
3817680Spst__weak_reference(___creat, creat);
3956896Sfenner
4056896Sfennerint
4156896Sfenner___creat(const char *path, mode_t mode)
4256896Sfenner{
43127675Sbms	struct pthread *curthread = _get_curthread();
4417680Spst	int ret;
4575118Sfenner
4675118Sfenner	_thr_enter_cancellation_point(curthread);
4775118Sfenner	ret = __creat(path, mode);
4817680Spst	_thr_leave_cancellation_point(curthread);
4917680Spst
5017680Spst	return ret;
5117680Spst}
52146778Ssam