Skip to content

Instantly share code, notes, and snippets.

@tcreech
Created May 27, 2015
Embed
What would you like to do?
OpenAFS on FreeBSD: AFS fd never ready for reading
#include <sys/select.h>
#include <fcntl.h>
/* Accepts exactly one argument: the name of a file which we will open(2) and
* select(2) on for reading. */
int main(int argc, char **argv){
int fd;
fd_set fs;
int sel;
if(argc != 2)
return 1;
fd = open(argv[1], O_RDONLY);
if(fd == -1)
return 2;
FD_ZERO(&fs);
FD_SET(fd, &fs);
select(fd+1, &fs, 0, 0, 0);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment