root/include/crm/common/io_internal.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. pcmk__open_devnull

   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 
  40 /*!
  41  * \internal
  42  * \brief Open /dev/null to consume next available file descriptor
  43  *
  44  * Open /dev/null, disregarding the result. This is intended when daemonizing to
  45  * be able to null stdin, stdout, and stderr.
  46  *
  47  * \param[in] flags  O_RDONLY (stdin) or O_WRONLY (stdout and stderr)
  48  */
  49 static inline void
  50 pcmk__open_devnull(int flags)
     /* [previous][next][first][last][top][bottom][index][help] */
  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

/* [previous][next][first][last][top][bottom][index][help] */