How poll deal with closed pipe
When a pipe close , what status poll will set for the pipe's file descriptor?,I try the code below, After child process close all file descriptor , the poll just think all file descriptor can read! Is that right? Or just I make some mistake in this code?,I think after the child process close all write file descriptor , the poll will set the revents POLLHUP .But it just set it POLLIN !,When the writing end of the pipe is closed, the reading end will appear "readable" to select() and poll() - this is because a read() will not block.
You should always compile your programs with the
-Wall option (at least). That would have told you about this problem:
if (fd[i].revents = POLLIN)
For details of in-depth Linux/UNIX system programming training courses that I teach, look here. , HTML rendering created 2021-08-27 by Michael Kerrisk, author of The Linux Programming Interface, maintainer of the Linux man-pages project.
/dev/poll behaviour is very close to the standard poll() object.,Remove a registered file descriptor from the epoll object.,The module defines the following:,File objects on Windows are not acceptable, but sockets are. On Windows, the underlying select() function is provided by the WinSock library, and does not handle file descriptors that don’t originate from WinSock.
The close() API closes any open socket descriptors.,The send() API echoes the data back to the client. ,close()--Close File or Socket Descriptor API,The following calls are used in the example:
If one end of the pipe is closed, 0 is returned, indicating the end of the file. , If one end of the pipe is closed, 0 is returned, indicating the end of the file. ,If the write side of the FIFO has closed, read(2) returns 0 to indicate the end of the file. , If the write side of the FIFO has closed, read(2) returns 0 to indicate the end of the file.
/usr/sbin / mknod xxx pls - l xxx prw - r--r--1 guest other 0 Aug 26 10: 55 xxx echoput > hello.world > xxx & put >  8733 cat xxx hello world  + Done rm xxx
Other "closed-undefined" queries related to "How poll deal with closed pipe"
- How I can group several marker as one for leaflet cluster? [closed]
- How to deal with empty JSON file
- How do I render the plot from a python script in my React front-end? [closed]
- Is reactjs (or nextjs) suitable for classic website? [closed]
- React css bootstrap no encuentro la manera de hacer que se reparta el contenido por todo el ancho de la navbar [closed]
- How can we access local JSON file data in react class component state [closed]
- What is the difference between vanilla React and react with nextjs? [closed]
- React JS embed maps on pdf [closed]
- Dynamically generating site info based on the URL used to get there [closed]
- React js question image stucked on part to emphasie it [closed]
- What will happen when deno will come [closed]
- Problem with authentication using Context from apollo-boots
- A request to test the responsiveness of the React application [closed]
- Why not use the react native more to make cross-mobile applications? [closed]
- Scroll on mouse position [closed]
- Can next-auth work with React Native or will I have to use another third party for it? [closed]
- How to create nodejs backend to log users actions performerd in UI? [closed]
- Apollo Client client.readQuery returning null when data is in the cache
- How to develop a web interface which records audio and gets saved in firebase upon submitting [closed]
- How to Create Desktop EXE of react native app [closed]
- How to clear fetched data of current screen when onPress the goBack() in react-native [closed]
- Apollo Client - refetchQueries calling 2 times
- Unable to run sample app second time on React Js [closed]
- Reading living process memory without interrupting it
- What is the difference between /dev/mem, /dev/kmem and /proc/kcore?
- Nm reports symbol is defined but ldd reports symbol is undefined
- Is it possible to reference an anonymous function from within itself in PHP?
- Preventing Directory Traversal in PHP but allowing paths
- Laravel console command - Ask for a non required (optional) input
- Redefine Built in PHP Functions
- C++ Portability between Windows and Linux
- How to check if a process has been finished?
- Laravel seeder gives error. Class not found
- Killing Parent process along with child process using SIGKILL
- How do I properly quote this bash pipeline for watch?
- Apt-get install for different python versions
- Get min value in PHP array and get corresponding key
- The use of "r+" in fopen on windows vs linux
- Laravel SQLSTATE[HY000]  Unknown database 'previous_db_name'
- Add a scrollbar on Ncurses or make it like "more"
- Create a file using Runtime.exec using echo in linux?
- Remove / Replace the username field with email using FOSUserBundle in Symfony2 / Symfony3
- Defined or define in PHP [duplicate]