[PATCH v2] tst: Provide test for timerfd related functions
Florian Weimer
fweimer@redhat.com
Thu Jan 14 12:03:40 GMT 2021
* Lukasz Majewski:
> +static int
> +do_test (void)
> +{
> + struct itimerspec settings = { { 2, 0 }, { 2, 0 } };
> + struct itimerspec val1, val2;
> + int fd, ret;
> +
> + fd = timerfd_create (CLOCK_REALTIME, 0);
> + if (fd < 0)
> + {
> + FAIL_EXIT1 ("*** timerfd_create %d failed: %m", fd);
> + }
The braces are unncessary.
> + /* Set the timer. */
> + ret = timerfd_settime (fd, 0, &settings, NULL);
> + if (ret != 0)
> + {
> + printf ("*** timerfd_settime failed: %m\n");
> + goto err;
> + }
Please use FAIL_EXIT1 throughout. This is not merely a style issue: As
written, ret is not a valid return value for do_test.
> + /* Check difference between timerfd_gettime() calls. */
No () after function names.
> + xclose(fd);
Missing space before parenthesis.
Thanks,
Florian
--
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill
More information about the Libc-alpha
mailing list