root/lib/common/mock_private.h

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

INCLUDED FROM


   1 /*
   2  * Copyright 2021-2024 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 MOCK_PRIVATE__H
  11 #  define MOCK_PRIVATE__H
  12 
  13 #include <pwd.h>
  14 #include <stdbool.h>
  15 #include <stdio.h>
  16 #include <stdlib.h>
  17 #include <string.h>
  18 #include <sys/types.h>
  19 #include <sys/utsname.h>
  20 #include <unistd.h>
  21 #include <grp.h>
  22 
  23 /* This header is for the sole use of libcrmcommon_test and unit tests */
  24 
  25 _Noreturn void __real_abort(void);
  26 _Noreturn void __wrap_abort(void);
  27 
  28 extern bool pcmk__mock_calloc;
  29 void *__real_calloc(size_t nmemb, size_t size);
  30 void *__wrap_calloc(size_t nmemb, size_t size);
  31 
  32 extern bool pcmk__mock_fopen;
  33 FILE *__real_fopen(const char *pathname, const char *mode);
  34 FILE *__wrap_fopen(const char *pathname, const char *mode);
  35 #ifdef HAVE_FOPEN64
  36 FILE *__real_fopen64(const char *pathname, const char *mode);
  37 FILE *__wrap_fopen64(const char *pathname, const char *mode);
  38 #endif
  39 
  40 extern bool pcmk__mock_getenv;
  41 char *__real_getenv(const char *name);
  42 char *__wrap_getenv(const char *name);
  43 
  44 extern bool pcmk__mock_realloc;
  45 void *__real_realloc(void *ptr, size_t size);
  46 void *__wrap_realloc(void *ptr, size_t size);
  47 
  48 extern bool pcmk__mock_setenv;
  49 int __real_setenv(const char *name, const char *value, int overwrite);
  50 int __wrap_setenv(const char *name, const char *value, int overwrite);
  51 
  52 extern bool pcmk__mock_unsetenv;
  53 int __real_unsetenv(const char *name);
  54 int __wrap_unsetenv(const char *name);
  55 
  56 extern bool pcmk__mock_getpid;
  57 pid_t __real_getpid(void);
  58 pid_t __wrap_getpid(void);
  59 
  60 extern bool pcmk__mock_grent;
  61 void __real_setgrent(void);
  62 void __wrap_setgrent(void);
  63 struct group * __wrap_getgrent(void);
  64 struct group * __real_getgrent(void);
  65 void __wrap_endgrent(void);
  66 void __real_endgrent(void);
  67 
  68 extern bool pcmk__mock_getpwnam_r;
  69 int __real_getpwnam_r(const char *name, struct passwd *pwd,
  70                       char *buf, size_t buflen, struct passwd **result);
  71 int __wrap_getpwnam_r(const char *name, struct passwd *pwd,
  72                       char *buf, size_t buflen, struct passwd **result);
  73 
  74 extern bool pcmk__mock_readlink;
  75 ssize_t __real_readlink(const char *restrict path, char *restrict buf,
  76                         size_t bufsize);
  77 ssize_t __wrap_readlink(const char *restrict path, char *restrict buf,
  78                         size_t bufsize);
  79 
  80 extern bool pcmk__mock_strdup;
  81 char *__real_strdup(const char *s);
  82 char *__wrap_strdup(const char *s);
  83 
  84 #endif  // MOCK_PRIVATE__H

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