The system calls DUP and dup2 to copy the file descriptor. The DUP returns a new file descriptor (the smallest number that is not used by the file descriptor). Dup2 can let the user specify the value of the returned file descriptor, and, if
This article was reproduced from: http://blog.csdn.net/tennysonsky/article/details/45870459DUP () and dup2 () are two very useful system calls that are used to copy the descriptor of a file so that the new file descriptor also identifies the file
1, what is the pipelineThe pipe is half-duplex, the data can only flow in one direction, need to establish two pipelines when the two sides communicate, can only be used for parent-child process or sibling process (affinity process); Separate file
Use the original DUP function of the system when implemented
MYDUP2.C//2015/08/17 Lucifer Zhang version1.0//write my own dup2 function//use DUP () function when inplemen tation #include //include DUP () #include #include #define OPEN_MAX 25
6/*
Section 8 Chapters Exception Control FlowControl Flow: Controls the transfer sequence.Control transfer: From an instruction to the next instruction.Exception control Flow: The modern operating system responds to the system state by causing mutations
DUP Function: Copy file descriptorRelated header files: # include Function expression: int DUP (INT filedes );Parameter description: The DUP function parameter filedes indicates the file descriptor of the file to be copied.Return Value Description:
Reproduced from: http://blog.csdn.net/orange_os/article/details/7485069
Directory:
1. Linux system call principle
2. Implementation of System call
3. Linux system call Classification and list
4. System call, User programming Interface (API), System
Today, see DUP and dup2 system calls, is not too understanding, first write a little simple application examples.
DUP and dup2 are used to copy file descriptors.
Function Prototypes:
#include
int dup (int oldfd);
int dup2 (int oldfd,int
1. Three ways to implement file sharing 1. What is file sharing: (1) file sharing is the same file (the same file refers to the same inode, the same pathname) by a plurality of independent read-write (almost understood as multiple file
Use pipelines for programming in Linux
Http://www.lupaworld.com/tutorial-view-aid-10366.html
Introduction
In this article, we will learn about the GNU/Linux pipeline. Although the pipeline model is very old, it is still a very useful inter-process
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.