3 * Copyright (c) 2016-2020 Samsung Electronics Co., Ltd
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is furnished
10 * to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in all
13 * copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
31 #define PIPE_FIFO_PATH_TEMPLATE_BASE "/run/dlog/priv/fifo/fd-"
32 #define PIPE_FIFO_PATH_TEMPLATE_FULL PIPE_FIFO_PATH_TEMPLATE_BASE "XXXXXX"
34 #define DLOG_CTRL_REQ_PIPE (struct dlog_control_msg) {sizeof(struct dlog_control_msg), DLOG_REQ_PIPE, 0}
39 /* the following can be OR'd with REPLY,
40 * but are exclusive with each other */
41 DLOG_REQ_PIPE = 1 << 1,
42 DLOG_REQ_CLEAR = 2 << 1,
43 DLOG_REQ_HANDLE_LOGUTIL = 3 << 1,
44 DLOG_REQ_GET_CAPACITY = 4 << 1,
45 DLOG_REQ_GET_USAGE = 5 << 1,
46 DLOG_REQ_STDOUT = 6 << 1,
47 DLOG_REQ_GLOBAL_ENABLE_DISABLE_STDOUT = 7 << 1,
51 DLOG_REQ_RESULT_OK = 0,
55 struct dlog_control_msg {
58 /* signed - declared explicitly to suppress static analyzer SVACE warning:
59 * "In some build environments it [char] can be interpreted as 'unsigned char' [...]" */
65 struct dlog_control_msg_stdout {
71 /* should fit a whole command line with concatenated arguments (reasonably) */
72 #define MAX_LOGGER_REQUEST_LEN 127
74 int connect_pipe(const char *path, struct dlog_control_msg *ctrl_msg, int timeout_ms);