{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/libc/issues/10","labels_url":"https://api.github.com/repos/rust-lang/libc/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/libc/issues/10/comments","events_url":"https://api.github.com/repos/rust-lang/libc/issues/10/events","html_url":"https://github.com/rust-lang/libc/issues/10","id":76313136,"number":10,"title":"Missing select family of functions","user":{"login":"flaub","id":111859,"avatar_url":"https://avatars.githubusercontent.com/u/111859?v=3","gravatar_id":"","url":"https://api.github.com/users/flaub","html_url":"https://github.com/flaub","followers_url":"https://api.github.com/users/flaub/followers","following_url":"https://api.github.com/users/flaub/following{/other_user}","gists_url":"https://api.github.com/users/flaub/gists{/gist_id}","starred_url":"https://api.github.com/users/flaub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flaub/subscriptions","organizations_url":"https://api.github.com/users/flaub/orgs","repos_url":"https://api.github.com/users/flaub/repos","events_url":"https://api.github.com/users/flaub/events{/privacy}","received_events_url":"https://api.github.com/users/flaub/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-14T10:27:15Z","updated_at":"2015-05-14T10:33:52Z","closed_at":null,"body":"Looks like this belongs either in `bsd42` or `posix01`.\r\n\r\nFrom `select(2)` of Linux man pages:\r\n\r\n```\r\n/* According to POSIX.1-2001 */\r\n#include <sys/select.h>\r\n\r\n/* According to earlier standards */\r\n#include <sys/time.h>\r\n#include <sys/types.h>\r\n#include <unistd.h>\r\n\r\nint select(int nfds, fd_set *readfds, fd_set *writefds,\r\n           fd_set *exceptfds, struct timeval *timeout);\r\n\r\nvoid FD_CLR(int fd, fd_set *set);\r\nint  FD_ISSET(int fd, fd_set *set);\r\nvoid FD_SET(int fd, fd_set *set);\r\nvoid FD_ZERO(fd_set *set);\r\n```\r\n\r\nFrom `select(2)` of BSD System Calls Manual:\r\n\r\n```\r\n     #include <sys/select.h>\r\n\r\n     void\r\n     FD_CLR(fd, fd_set *fdset);\r\n\r\n     void\r\n     FD_COPY(fd_set *fdset_orig, fd_set *fdset_copy);\r\n\r\n     int\r\n     FD_ISSET(fd, fd_set *fdset);\r\n\r\n     void\r\n     FD_SET(fd, fd_set *fdset);\r\n\r\n     void\r\n     FD_ZERO(fd_set *fdset);\r\n\r\n     int\r\n     select(int nfds, fd_set *restrict readfds, fd_set *restrict writefds, fd_set *restrict errorfds, struct timeval *restrict timeout);\r\n```\r\n\r\nAnd then on Windows, which only works for sockets:\r\n\r\n```\r\nint select(\r\n  _In_    int                  nfds,\r\n  _Inout_ fd_set               *readfds,\r\n  _Inout_ fd_set               *writefds,\r\n  _Inout_ fd_set               *exceptfds,\r\n  _In_    const struct timeval *timeout\r\n);\r\n```\r\n\r\nWith `FD_CLR`, `FD_ISSET`, `FD_SET`, and `FD_ZERO` defined as macros on most (all?) platforms."},"comment":{"url":"https://api.github.com/repos/rust-lang/libc/issues/comments/101998263","html_url":"https://github.com/rust-lang/libc/issues/10#issuecomment-101998263","issue_url":"https://api.github.com/repos/rust-lang/libc/issues/10","id":101998263,"user":{"login":"flaub","id":111859,"avatar_url":"https://avatars.githubusercontent.com/u/111859?v=3","gravatar_id":"","url":"https://api.github.com/users/flaub","html_url":"https://github.com/flaub","followers_url":"https://api.github.com/users/flaub/followers","following_url":"https://api.github.com/users/flaub/following{/other_user}","gists_url":"https://api.github.com/users/flaub/gists{/gist_id}","starred_url":"https://api.github.com/users/flaub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flaub/subscriptions","organizations_url":"https://api.github.com/users/flaub/orgs","repos_url":"https://api.github.com/users/flaub/repos","events_url":"https://api.github.com/users/flaub/events{/privacy}","received_events_url":"https://api.github.com/users/flaub/received_events","type":"User","site_admin":false},"created_at":"2015-05-14T10:33:52Z","updated_at":"2015-05-14T10:33:52Z","body":"With this layer in place, it would be possible to extend the `std::net::*Socket` API to allow for cancelation of pending I/O operations (`recv`, `recv_from`, `send`, `accept`, etc). This would fix rust-lang/rust#23272 and mentioned in rust-lang/rfcs#957. The goal here would *not* be to allow non-blocking I/O in general per-se, but to simply provide a way for users to cleanly cancel blocking calls."}}