pacemaker  2.1.5-b7adf64e51
Scalable High-Availability cluster resource manager
io_internal.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 the Pacemaker project contributors
3  *
4  * The version control history for this file may have further details.
5  *
6  * This source code is licensed under the GNU Lesser General Public License
7  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8  */
9 
10 #ifndef PCMK__CRM_COMMON_IO_INTERNAL__H
11 # define PCMK__CRM_COMMON_IO_INTERNAL__H
12 
13 #include <fcntl.h> // open()
14 #include <stdbool.h> // bool
15 #include <unistd.h> // uid_t, gid_t
16 
17 int pcmk__real_path(const char *path, char **resolved_path);
18 
19 char *pcmk__series_filename(const char *directory, const char *series,
20  int sequence, bool bzip);
21 int pcmk__read_series_sequence(const char *directory, const char *series,
22  unsigned int *seq);
23 void pcmk__write_series_sequence(const char *directory, const char *series,
24  unsigned int sequence, int max);
25 int pcmk__chown_series_sequence(const char *directory, const char *series,
26  uid_t uid, gid_t gid);
27 
28 int pcmk__build_path(const char *path_c, mode_t mode);
29 char *pcmk__full_path(const char *filename, const char *dirname);
30 bool pcmk__daemon_can_write(const char *dir, const char *file);
31 void pcmk__sync_directory(const char *name);
32 
33 int pcmk__file_contents(const char *filename, char **contents);
34 int pcmk__write_sync(int fd, const char *contents);
35 int pcmk__set_nonblocking(int fd);
36 const char *pcmk__get_tmpdir(void);
37 
38 void pcmk__close_fds_in_child(bool);
39 
49 static inline void
50 pcmk__open_devnull(int flags)
51 {
52  // Static analysis clutter
53  // cppcheck-suppress leakReturnValNotUsed
54  (void) open("/dev/null", flags);
55 }
56 
57 #endif // PCMK__CRM_COMMON_IO_INTERNAL__H
int pcmk__set_nonblocking(int fd)
Definition: io.c:518
const char * name
Definition: cib.c:24
void pcmk__write_series_sequence(const char *directory, const char *series, unsigned int sequence, int max)
Definition: io.c:187
int pcmk__chown_series_sequence(const char *directory, const char *series, uid_t uid, gid_t gid)
Definition: io.c:238
int pcmk__read_series_sequence(const char *directory, const char *series, unsigned int *seq)
Definition: io.c:140
char * pcmk__series_filename(const char *directory, const char *series, int sequence, bool bzip)
Definition: io.c:121
int pcmk__write_sync(int fd, const char *contents)
Definition: io.c:488
int pcmk__build_path(const char *path_c, mode_t mode)
Definition: io.c:45
void pcmk__sync_directory(const char *name)
Definition: io.c:396
char * pcmk__full_path(const char *filename, const char *dirname)
Duplicate a file path, inserting a prefix if not absolute.
Definition: io.c:628
const char * pcmk__get_tmpdir(void)
Definition: io.c:541
int pcmk__file_contents(const char *filename, char **contents)
Definition: io.c:432
const char * path
Definition: cib.c:26
bool pcmk__daemon_can_write(const char *dir, const char *file)
Definition: io.c:328
void pcmk__close_fds_in_child(bool)
Definition: io.c:559
int pcmk__real_path(const char *path, char **resolved_path)
Definition: io.c:85
uint64_t flags
Definition: remote.c:215