Gilles Chanteperdrix wrote: > Jan Kiszka wrote: >> Matthieu Nottale wrote: >>> Hi, >>> >>> I believe I found a bug in the Xenomai Posix skin while trying to use >>> boost::asio: The accept() call in asychronous mode >>> fails with ENOPEM instead of EAGAIN. Other than that, the call 'works' >>> in the sense that calling it again after a connection is established >>> returns a new file descriptor. >> On what kind of file descriptor descriping what kind of socket are you >> calling accept()? So far I'm not aware of any RTDM driver providing the >> corresponding service - well, at least not a public one (our RT-TCP >> stack is yet to be released). Or is it intended to pass the call to >> plain Linux, switching the caller into secondary more? > > There's a sample attached. Yes, it is a TCP stream. Howeve accept is > wrapped, so it may happen that EPERM is the result of the wrapping. >
Oops, missed that. Indeed, patch below should fix it.
Jan
diff --git a/src/skins/posix/rtdm.c b/src/skins/posix/rtdm.c
index 6e347fb..4e6685f 100644
--- a/src/skins/posix/rtdm.c
+++ b/src/skins/posix/rtdm.c
@@ -404,18 +404,21 @@ int __wrap_accept(int fd, struct sockaddr *addr,
socklen_t * addrlen)
pthread_setcanceltype(oldtype, NULL);
- if (fd >= 0)
- fd += __rtdm_fd_start;
+ if (fd < 0)
+ return set_errno(fd);
+
+ return fd + __rtdm_fd_start;
} else {
fd = __real_accept(fd, addr, addrlen);
if (fd >= __rtdm_fd_start) {
__real_close(fd);
- fd = -EMFILE;
+ errno = EMFILE;
+ fd = -1;
}
- }
- return set_errno(fd);
+ return fd;
+ }
}
int __wrap_getsockname(int fd, struct sockaddr *name, socklen_t * namelen)
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Xenomai-core mailing list [email protected] https://mail.gna.org/listinfo/xenomai-core
