Skip to content

Instantly share code, notes, and snippets.

@tcreech
Created May 27, 2015 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tcreech/b178ec9d34abac22a0b6 to your computer and use it in GitHub Desktop.
Save tcreech/b178ec9d34abac22a0b6 to your computer and use it in GitHub Desktop.
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