X-Git-Url: https://gapil.gnulinux.it/gitweb/?p=gapil.git;a=blobdiff_plain;f=sources%2Ftest_signalfd.c;h=a31cf0b27a847f7b9f324461736ebbaaccac5797;hp=628bd4d85bb6519feea6416ff139e9d33b834c0a;hb=04c68576a3be5ccfda8faf2030d4cbc2997c29fa;hpb=a59f46f457248921d34ba7175697a129469d6d90 diff --git a/sources/test_signalfd.c b/sources/test_signalfd.c index 628bd4d..a31cf0b 100644 --- a/sources/test_signalfd.c +++ b/sources/test_signalfd.c @@ -53,7 +53,7 @@ int main(int argc, char *argv[]) /* * Variables definition */ - int i, nomask, testwrite, sigfd; + int i, n, nomask=0, testwrite=0, sigfd; time_t t; struct signalfd_siginfo siginf; sigset_t sigmask; @@ -76,7 +76,7 @@ int main(int argc, char *argv[]) case 'n': /* no mask option */ nomask = 1; break; - case 'w': /* no mask option */ + case 'w': /* testwrite option */ testwrite = 1; break; case '?': /* unrecognized options */ @@ -104,9 +104,10 @@ int main(int argc, char *argv[]) die("Failing in signalfd"); printf("Signalfd armed\n"); if (testwrite) { - if (write(sigfd, buffer, sizeof(buffer))) + if ( (n=write(sigfd, buffer, sizeof(buffer))) < 0) perror("write on signal fd error"); - else printf("write successfully\n"); + else + printf("write successfully %d bytes\n", n); } /* raise signal */ if (raise(SIGINT) != 0) @@ -127,7 +128,7 @@ int main(int argc, char *argv[]) void usage(void) { printf("Program testsignalfd : test signalfd on close \n"); printf("Usage:\n"); - printf(" testfopen [-h] file mode \n"); + printf(" testsignalfd [-h] file mode \n"); printf(" -h print this help\n"); exit(1);