Rename C++ header files to .hpp
[lttng-tools.git] / tests / regression / tools / notification / default_pipe_size_getter.cpp
CommitLineData
38eb8a68
FD
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#include <unistd.h>
13#include <fcntl.h>
14#include <stdio.h>
15#include <stdlib.h>
16
c9e313bc
SM
17#include <common/pipe.hpp>
18#include <common/error.hpp>
38eb8a68
FD
19
20int lttng_opt_verbose;
21int lttng_opt_mi;
22int lttng_opt_quiet;
23
f46376a1 24int main(void)
38eb8a68
FD
25{
26 int ret;
27 /*
28 * The event notifier pipes are not "special"; they are created using
29 * the lttng_pipe utility. Hence, this should be representative of a
30 * pipe created by the session daemon for event notifier messages to
31 * go through.
32 */
33 struct lttng_pipe *pipe = lttng_pipe_open(0);
34
35 if (!pipe) {
36 /* lttng_pipe_open already logs on error. */
37 ret = EXIT_FAILURE;
38 goto end;
39 }
40
41 ret = fcntl(lttng_pipe_get_writefd(pipe), F_GETPIPE_SZ);
42 if (ret < 0) {
43 PERROR("Failed to get the size of the pipe");
44 ret = EXIT_FAILURE;
45 goto end;
46 }
47
48 printf("%d\n", ret);
49 ret = EXIT_SUCCESS;
50end:
51 lttng_pipe_destroy(pipe);
52 return ret;
53}
This page took 0.030652 seconds and 4 git commands to generate.