X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Fregression%2Ftools%2Fnotification%2Fdefault_pipe_size_getter.cpp;fp=tests%2Fregression%2Ftools%2Fnotification%2Fdefault_pipe_size_getter.cpp;h=cc24cec1ea01ea45bd34ecba5b8697d3d5d5409c;hp=0000000000000000000000000000000000000000;hb=a6bc4ca9d659caf016ef932fcd944029737ac57c;hpb=97535efaa975ca52bf02c2d5e76351bfd2e3defa diff --git a/tests/regression/tools/notification/default_pipe_size_getter.cpp b/tests/regression/tools/notification/default_pipe_size_getter.cpp new file mode 100644 index 000000000..cc24cec1e --- /dev/null +++ b/tests/regression/tools/notification/default_pipe_size_getter.cpp @@ -0,0 +1,53 @@ +/* + * default_pipe_size_getter.c + * + * Tests suite for LTTng notification API (get default size of pipes) + * + * Copyright (C) 2021 Jérémie Galarneau + * + * SPDX-License-Identifier: MIT + * + */ + +#include +#include +#include +#include + +#include +#include + +int lttng_opt_verbose; +int lttng_opt_mi; +int lttng_opt_quiet; + +int main(int argc, const char **argv) +{ + int ret; + /* + * The event notifier pipes are not "special"; they are created using + * the lttng_pipe utility. Hence, this should be representative of a + * pipe created by the session daemon for event notifier messages to + * go through. + */ + struct lttng_pipe *pipe = lttng_pipe_open(0); + + if (!pipe) { + /* lttng_pipe_open already logs on error. */ + ret = EXIT_FAILURE; + goto end; + } + + ret = fcntl(lttng_pipe_get_writefd(pipe), F_GETPIPE_SZ); + if (ret < 0) { + PERROR("Failed to get the size of the pipe"); + ret = EXIT_FAILURE; + goto end; + } + + printf("%d\n", ret); + ret = EXIT_SUCCESS; +end: + lttng_pipe_destroy(pipe); + return ret; +}