Fix: tests: missing _GNU_SOURCE for F_GETPIPE_SZ
[lttng-tools.git] / tests / regression / tools / notification / default_pipe_size_getter.cpp
... / ...
CommitLineData
1/*
2 * default_pipe_size_getter.c
3 *
4 * Tests suite for LTTng notification API (get default size of pipes)
5 *
6 * Copyright (C) 2021 Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 *
8 * SPDX-License-Identifier: MIT
9 *
10 */
11
12#ifndef _GNU_SOURCE
13#define _GNU_SOURCE
14#endif
15
16#include <unistd.h>
17#include <fcntl.h>
18#include <stdio.h>
19#include <stdlib.h>
20
21#include <common/pipe.hpp>
22#include <common/error.hpp>
23
24int lttng_opt_verbose;
25int lttng_opt_mi;
26int lttng_opt_quiet;
27
28int main(void)
29{
30 int ret;
31 /*
32 * The event notifier pipes are not "special"; they are created using
33 * the lttng_pipe utility. Hence, this should be representative of a
34 * pipe created by the session daemon for event notifier messages to
35 * go through.
36 */
37 struct lttng_pipe *pipe = lttng_pipe_open(0);
38
39 if (!pipe) {
40 /* lttng_pipe_open already logs on error. */
41 ret = EXIT_FAILURE;
42 goto end;
43 }
44
45 ret = fcntl(lttng_pipe_get_writefd(pipe), F_GETPIPE_SZ);
46 if (ret < 0) {
47 PERROR("Failed to get the size of the pipe");
48 ret = EXIT_FAILURE;
49 goto end;
50 }
51
52 printf("%d\n", ret);
53 ret = EXIT_SUCCESS;
54end:
55 lttng_pipe_destroy(pipe);
56 return ret;
57}
This page took 0.022787 seconds and 4 git commands to generate.