LibBSD | Add poll() and select() support for pipe (#39)

Ning Yang (@yangn0) gitlab at rtems.org
Tue Feb 11 05:45:18 UTC 2025



Ning Yang created an issue: https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/issues/39



The pipe requires poll and select support. I suppose some `SYSINIT` is needed like this commit. https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/commit/045ff6e11cf21454c6216a1099b44a6fe692586f

```c
puts( "Init - create pipe -- OK" );
status = pipe( fd );
assert( status == 0 );

struct pollfd pfd = {
  .fd = fd[1],
  .events = POLLIN
};
int n=poll(&pfd,1,-1);
printf("pfd.revents: %d",pfd.revents);
```
The `pfd.revents` is 8. 
It means POLLHUP,
```
The  device  or socket has been disconnected.  This flag
is always	checked, even if not  present  in  the	events
bitmask.	 Note that POLLHUP and POLLOUT should never be
present in the revents bitmask at	the same time.
```

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/issues/39
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20250211/2e33807e/attachment.htm>


More information about the bugs mailing list