2 FUSE fselclient: FUSE select example client
3 Copyright (C) 2008 SUSE Linux Products GmbH
4 Copyright (C) 2008 Tejun Heo <teheo@suse.de>
6 This program can be distributed under the terms of the GNU GPL.
9 gcc -Wall fselclient.c -o fselclient
12 #include <sys/select.h>
14 #include <sys/types.h>
27 static const char hex_map[FSEL_FILES] = "0123456789ABCDEF";
31 for (i = 0; i < FSEL_FILES; i++) {
32 char name[] = { hex_map[i], '\0' };
33 fds[i] = open(name, O_RDONLY);
39 nfds = fds[FSEL_FILES - 1] + 1;
42 static char buf[4096];
47 for (i = 0; i < FSEL_FILES; i++)
48 FD_SET(fds[i], &rfds);
50 rc = select(nfds, &rfds, NULL, NULL, NULL);
57 for (i = 0; i < FSEL_FILES; i++) {
58 if (!FD_ISSET(fds[i], &rfds)) {
63 rc = read(fds[i], buf, sizeof(buf));