Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.12 KB | None | 0 0
  1. $ cat Portability-fixes.patch
  2. From d59918e0b6e49fb68da5f11a9f17826a1de81b12 Mon Sep 17 00:00:00 2001
  3. From:
  4. Date: Mon, 8 Apr 2019 18:12:43 -0500
  5. Subject: [PATCH 3/3] Portability fixes:
  6.  
  7. - Use fcntl.h for O_RDONLY and friends.
  8. - Only use mallinfo with glibc.
  9.  
  10. Signed-off-by: Jory Pratt <anarchy@gentoo.org>
  11. ---
  12. lib/mm/memlock.c | 2 +-
  13. libdaemon/server/daemon-server.c | 1 +
  14. 2 files changed, 2 insertions(+), 1 deletion(-)
  15.  
  16. diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c
  17. index c8e6ef1..81b74fc 100644
  18. --- a/lib/mm/memlock.c
  19. +++ b/lib/mm/memlock.c
  20. @@ -159,7 +159,7 @@ static void _touch_memory(void *mem, size_t size)
  21.  
  22. static void _allocate_memory(void)
  23. {
  24. -#ifndef VALGRIND_POOL
  25. +#if !defined(VALGRIND_POOL) && defined(__GLIBC__)
  26. void *stack_mem;
  27. struct rlimit limit;
  28. int i, area = 0, missing = _size_malloc_tmp, max_areas = 32, hblks;
  29. diff --git a/libdaemon/server/daemon-server.c b/libdaemon/server/daemon-server.c
  30. index 3b19883..4a38de9 100644
  31. --- a/libdaemon/server/daemon-server.c
  32. +++ b/libdaemon/server/daemon-server.c
  33. @@ -18,6 +18,7 @@
  34. #include "daemon-server.h"
  35. #include "daemon-log.h"
  36.  
  37. +#include <fcntl.h>
  38. #include <dlfcn.h>
  39. #include <errno.h>
  40. #include <pthread.h>
  41. --
  42. 2.21.0
  43.  
  44. $ cat enable-mlock-by-default-on-everything-but-GLIBC.patch
  45. From b69ecf32b72c28f59a068d935d66a7b8df73e645 Mon Sep 17 00:00:00 2001
  46. From:
  47. Date: Mon, 8 Apr 2019 18:12:12 -0500
  48. Subject: [PATCH 2/3] enable mlock by default on everything but GLIBC
  49.  
  50. Signed-off-by: Jory Pratt <anarchy@gentoo.org>
  51. ---
  52. lib/config/defaults.h | 4 ++++
  53. 1 file changed, 4 insertions(+)
  54.  
  55. diff --git a/lib/config/defaults.h b/lib/config/defaults.h
  56. index 9e398d7..347206a 100644
  57. --- a/lib/config/defaults.h
  58. +++ b/lib/config/defaults.h
  59. @@ -55,7 +55,11 @@
  60. #define DEFAULT_LVMLOCKD_LOCK_RETRIES 3
  61. #define DEFAULT_LVMETAD_UPDATE_WAIT_TIME 10
  62. #define DEFAULT_PRIORITISE_WRITE_LOCKS 1
  63. +#ifdef __GLIBC__
  64. #define DEFAULT_USE_MLOCKALL 0
  65. +#else
  66. +#define DEFAULT_USE_MLOCKALL 1
  67. +#endif
  68. #define DEFAULT_METADATA_READ_ONLY 0
  69. #define DEFAULT_LVDISPLAY_SHOWS_FULL_DEVICE_PATH 0
  70. #define DEFAULT_UNKNOWN_DEVICE_NAME "[unknown]"
  71. --
  72. 2.21.0
  73.  
  74. $ cat fix-stdio-useage.patch
  75. From f176f0c0a7c7b24c98923ba749acca31e314fb64 Mon Sep 17 00:00:00 2001
  76. From:
  77. Date: Mon, 8 Apr 2019 18:11:50 -0500
  78. Subject: [PATCH 1/3] fix stdio useage
  79.  
  80. Signed-off-by: Jory Pratt <anarchy@gentoo.org>
  81. ---
  82. lib/commands/toolcontext.c | 4 ++--
  83. tools/lvmcmdline.c | 6 +++---
  84. 2 files changed, 5 insertions(+), 5 deletions(-)
  85.  
  86. diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
  87. index 25e8b87..8782db5 100644
  88. --- a/lib/commands/toolcontext.c
  89. +++ b/lib/commands/toolcontext.c
  90. @@ -1864,7 +1864,7 @@ struct cmd_context *create_toolcontext(unsigned is_clvmd,
  91. /* FIXME Make this configurable? */
  92. reset_lvm_errno(1);
  93.  
  94. -#ifndef VALGRIND_POOL
  95. +#if !defined(VALGRIND_POOL) && defined(__GLIBC__)
  96. /* Set in/out stream buffering before glibc */
  97. if (set_buffering
  98. #ifdef SYS_gettid
  99. @@ -2258,7 +2258,7 @@ void destroy_toolcontext(struct cmd_context *cmd)
  100. if (cmd->libmem)
  101. dm_pool_destroy(cmd->libmem);
  102.  
  103. -#ifndef VALGRIND_POOL
  104. +#if !defined(VALGRIND_POOL) && defined(__GLIBC__)
  105. if (cmd->linebuffer) {
  106. /* Reset stream buffering to defaults */
  107. if (is_valid_fd(STDIN_FILENO) &&
  108. diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
  109. index a9c3e41..daad90d 100644
  110. --- a/tools/lvmcmdline.c
  111. +++ b/tools/lvmcmdline.c
  112. @@ -3110,7 +3110,7 @@ static int _check_standard_fds(void)
  113. int err = is_valid_fd(STDERR_FILENO);
  114.  
  115. if (!is_valid_fd(STDIN_FILENO) &&
  116. - !(stdin = fopen(_PATH_DEVNULL, "r"))) {
  117. + !freopen(_PATH_DEVNULL, "r", stdin)) {
  118. if (err)
  119. perror("stdin stream open");
  120. else
  121. @@ -3120,7 +3120,7 @@ static int _check_standard_fds(void)
  122. }
  123.  
  124. if (!is_valid_fd(STDOUT_FILENO) &&
  125. - !(stdout = fopen(_PATH_DEVNULL, "w"))) {
  126. + !freopen(_PATH_DEVNULL, "w", stdout)) {
  127. if (err)
  128. perror("stdout stream open");
  129. /* else no stdout */
  130. @@ -3128,7 +3128,7 @@ static int _check_standard_fds(void)
  131. }
  132.  
  133. if (!is_valid_fd(STDERR_FILENO) &&
  134. - !(stderr = fopen(_PATH_DEVNULL, "w"))) {
  135. + !freopen(_PATH_DEVNULL, "w", stderr)) {
  136. printf("stderr stream open: %s\n",
  137. strerror(errno));
  138. return 0;
  139. --
  140. 2.21.0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement