mkfifo.c revision 12789:82cffaae72d5
155714Skris/* 255714Skris * CDDL HEADER START 355714Skris * 455714Skris * The contents of this file are subject to the terms of the 555714Skris * Common Development and Distribution License (the "License"). 655714Skris * You may not use this file except in compliance with the License. 755714Skris * 855714Skris * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 955714Skris * or http://www.opensolaris.org/os/licensing. 1055714Skris * See the License for the specific language governing permissions 1155714Skris * and limitations under the License. 1255714Skris * 1355714Skris * When distributing Covered Code, include this CDDL HEADER in each 1455714Skris * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1555714Skris * If applicable, add the following below this CDDL HEADER, with the 1655714Skris * fields enclosed by brackets "[]" replaced with your own identifying 1755714Skris * information: Portions Copyright [yyyy] [name of copyright owner] 1855714Skris * 1955714Skris * CDDL HEADER END 2055714Skris */ 2155714Skris 2255714Skris/* 2355714Skris * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. 2455714Skris */ 2555714Skris 2655714Skris/* Copyright (c) 1988 AT&T */ 2755714Skris/* All Rights Reserved */ 2855714Skris 2955714Skris/* 3055714Skris * mkfifo(3c) - create a named pipe (FIFO). This code provides 3155714Skris * a POSIX mkfifo function. 3255714Skris */ 3355714Skris 3455714Skris#include "lint.h" 3555714Skris#include <sys/types.h> 3655714Skris#include <sys/stat.h> 3755714Skris 3855714Skrisint 3955714Skrismkfifoat(int fd, const char *path, mode_t mode) 4055714Skris{ 4155714Skris mode &= 0777; /* only allow file access permissions */ 4255714Skris mode |= S_IFIFO; /* creating a FIFO */ 4355714Skris return (mknodat(fd, path, mode, 0)); 4455714Skris} 4555714Skris 4655714Skris#pragma weak _mkfifo = mkfifo 4755714Skrisint 4855714Skrismkfifo(const char *path, mode_t mode) 4955714Skris{ 5055714Skris mode &= 0777; /* only allow file access permissions */ 5155714Skris mode |= S_IFIFO; /* creating a FIFO */ 5255714Skris return (mknod(path, mode, 0)); 5355714Skris} 5455714Skris