1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| // Librairies utilisées
#include <sys/poll.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/ipc.h>
// Programme testé
long lFdFichier = open("/USR/tassdt/tmp/FATI999", O_CREAT, DROIT_LIRE_ECRIRE);
long fatTest= msgget ((ftok("/USR/tassdt/tmp/FATI999", 'a')), IPC_CREAT | DROIT_LIRE_ECRIRE );
struct pollfd DescripteurEvtFat;
long lCrPollFat;
DescripteurEvtFat.fd = fatTest;
DescripteurEvtFat.events = POLLIN | POLLERR; // JBG : POLLIN 0x0001 + POLLERR 0x0008 font bien 9. /!\revents are bitmasks constructed by OR'ing a combination of the following event flags.
DescripteurEvtFat.revents = 0;
lCrPollFat = poll (&DescripteurEvtFat, 1, 10 ); // Traitement du file descripteur.
fTracer ( NV_DEBUG, "JBG", ( pFicTrc, "Reception d'un message FAT lCrPollFat=%ld fd=%ld events=%d revents=%d strerrno=%s",lCrPollFat, DescripteurEvtFat.fd, DescripteurEvtFat.events, DescripteurEvtFat.revents, strerror(errno))); |
Partager