xref: /onnv-gate/usr/src/lib/libc/port/gen/mkfifo.c (revision 12789:82cffaae72d5)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
56812Sraf  * Common Development and Distribution License (the "License").
66812Sraf  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
216812Sraf 
220Sstevel@tonic-gate /*
23*12789SRoger.Faulkner@Oracle.COM  * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate /*	Copyright (c) 1988 AT&T	*/
270Sstevel@tonic-gate /*	  All Rights Reserved  	*/
280Sstevel@tonic-gate 
290Sstevel@tonic-gate /*
300Sstevel@tonic-gate  * mkfifo(3c) - create a named pipe (FIFO). This code provides
310Sstevel@tonic-gate  * a POSIX mkfifo function.
320Sstevel@tonic-gate  */
330Sstevel@tonic-gate 
346812Sraf #include "lint.h"
350Sstevel@tonic-gate #include <sys/types.h>
360Sstevel@tonic-gate #include <sys/stat.h>
370Sstevel@tonic-gate 
380Sstevel@tonic-gate int
mkfifoat(int fd,const char * path,mode_t mode)39*12789SRoger.Faulkner@Oracle.COM mkfifoat(int fd, const char *path, mode_t mode)
40*12789SRoger.Faulkner@Oracle.COM {
41*12789SRoger.Faulkner@Oracle.COM 	mode &= 0777;		/* only allow file access permissions */
42*12789SRoger.Faulkner@Oracle.COM 	mode |= S_IFIFO;	/* creating a FIFO	*/
43*12789SRoger.Faulkner@Oracle.COM 	return (mknodat(fd, path, mode, 0));
44*12789SRoger.Faulkner@Oracle.COM }
45*12789SRoger.Faulkner@Oracle.COM 
46*12789SRoger.Faulkner@Oracle.COM #pragma weak _mkfifo = mkfifo
47*12789SRoger.Faulkner@Oracle.COM int
mkfifo(const char * path,mode_t mode)480Sstevel@tonic-gate mkfifo(const char *path, mode_t mode)
490Sstevel@tonic-gate {
500Sstevel@tonic-gate 	mode &= 0777;		/* only allow file access permissions */
510Sstevel@tonic-gate 	mode |= S_IFIFO;	/* creating a FIFO	*/
520Sstevel@tonic-gate 	return (mknod(path, mode, 0));
530Sstevel@tonic-gate }
54