Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2503456
  • 博文数量: 540
  • 博客积分: 11289
  • 博客等级: 上将
  • 技术积分: 6160
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-11 20:27
个人简介

潜龙勿用,见龙在田

文章分类

全部博文(540)

文章存档

2018年(2)

2013年(5)

2012年(24)

2011年(104)

2010年(60)

2009年(217)

2008年(128)

分类: LINUX

2010-12-03 17:11:01

Name

mkfifo - make a FIFO special file (a named pipe)

Synopsis

#include <>#include <>
int mkfifo(const char *pathname, mode_t mode);

Description


mkfifo() makes a FIFO special file with name pathname. mode specifies the FIFO's permissions. It is modified by the process's umask in the usual way: the permissions of the created file are (mode & ~umask).

A FIFO special file is similar to a pipe, except that it is created in a different way. Instead of being an anonymous communications channel, a FIFO special file is entered into the file system by calling mkfifo().

Once you have created a FIFO special file in this way, any process can open it for reading or writing, in the same way as an ordinary file. However, it has to be open at both ends simultaneously before you can proceed to do any input or output operations on it. Opening a FIFO for reading normally blocks until some other process opens the same FIFO for writing, and vice versa. See (7) for non-blocking handling of FIFO special files.

Return Value

On success mkfifo() returns 0. In the case of an error, -1 is returned (in which case, errno is set appropriately).

Errors

EACCES
One of the directories in pathname did not allow search (execute) permission.
EEXIST
pathname already exists.
ENAMETOOLONG
Either the total length of pathname is greater than PATH_MAX, or an individual filename component has a length greater than NAME_MAX. In the GNU system, there is no imposed limit on overall filename length, but some file systems may place limits on the length of a component.
ENOENT
A directory component in pathname does not exist or is a dangling symbolic link.
ENOSPC
The directory or filesystem has no room for the new file.
ENOTDIR
A component used as a directory in pathname is not, in fact, a directory.
EROFS
pathname refers to a read-only filesystem.

Conforming to

POSIX.1-2001.
阅读(1244) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~