summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch')
-rw-r--r--meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch57
1 files changed, 33 insertions, 24 deletions
diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch b/meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch
index d25acefb59..8edf44a8bb 100644
--- a/meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch
+++ b/meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch
@@ -1,10 +1,19 @@
1Upstream-Status: Denied [no desire for uclibc support] 1Upstream-Status: Denied [no desire for uclibc support]
2
3This patch is uclibc specific, thus not suitable for upstream.
4
2Signed-off-by: Khem Raj <raj.khem@gmail.com> 5Signed-off-by: Khem Raj <raj.khem@gmail.com>
6Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
7
8---
9 src/journal/journal-file.c | 16 +++++++++++++++-
10 src/journal/journald-kmsg.c | 16 ++++++++++++++--
11 2 files changed, 29 insertions(+), 3 deletions(-)
3 12
4Index: systemd-209/src/journal/journal-file.c 13diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
5=================================================================== 14index 0e1fc7f..e364298 100644
6--- systemd-209.orig/src/journal/journal-file.c 2014-02-12 18:42:33.000000000 -0800 15--- a/src/journal/journal-file.c
7+++ systemd-209/src/journal/journal-file.c 2014-02-19 23:23:19.464631643 -0800 16+++ b/src/journal/journal-file.c
8@@ -38,6 +38,8 @@ 17@@ -38,6 +38,8 @@
9 #include "compress.h" 18 #include "compress.h"
10 #include "fsprg.h" 19 #include "fsprg.h"
@@ -14,7 +23,7 @@ Index: systemd-209/src/journal/journal-file.c
14 #define DEFAULT_DATA_HASH_TABLE_SIZE (2047ULL*sizeof(HashItem)) 23 #define DEFAULT_DATA_HASH_TABLE_SIZE (2047ULL*sizeof(HashItem))
15 #define DEFAULT_FIELD_HASH_TABLE_SIZE (333ULL*sizeof(HashItem)) 24 #define DEFAULT_FIELD_HASH_TABLE_SIZE (333ULL*sizeof(HashItem))
16 25
17@@ -316,7 +318,7 @@ 26@@ -316,7 +318,7 @@ static int journal_file_verify_header(JournalFile *f) {
18 27
19 static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size) { 28 static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size) {
20 uint64_t old_size, new_size; 29 uint64_t old_size, new_size;
@@ -23,7 +32,7 @@ Index: systemd-209/src/journal/journal-file.c
23 32
24 assert(f); 33 assert(f);
25 34
26@@ -364,9 +366,24 @@ 35@@ -364,9 +366,21 @@ static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size)
27 /* Note that the glibc fallocate() fallback is very 36 /* Note that the glibc fallocate() fallback is very
28 inefficient, hence we try to minimize the allocation area 37 inefficient, hence we try to minimize the allocation area
29 as we can. */ 38 as we can. */
@@ -32,27 +41,24 @@ Index: systemd-209/src/journal/journal-file.c
32 if (r != 0) 41 if (r != 0)
33 return -r; 42 return -r;
34+#else 43+#else
35+ /* Use good old method to write zeros into the journal file 44+ /* Write something every 512 bytes to make sure the block is allocated */
36+ perhaps very inefficient yet working. */ 45+ uint64_t len = new_size - old_size;
37+ if(new_size > old_size) { 46+ uint64_t offset = old_size;
38+ char *buf = alloca(new_size - old_size); 47+ for (offset += (len-1) % 512; len > 0; offset += 512) {
39+ off_t oldpos = lseek(f->fd, 0, SEEK_CUR); 48+ len -= 512;
40+ bzero(buf, new_size - old_size); 49+ if (pwrite(f->fd, "", 1, offset) != 1)
41+ lseek(f->fd, old_size, SEEK_SET); 50+ return -errno;
42+ r = write(f->fd, buf, new_size - old_size); 51+ }
43+ lseek(f->fd, oldpos, SEEK_SET); 52+
44+ }
45+ if (r < 0)
46+ return -errno;
47+#endif /* HAVE_POSIX_FALLOCATE */ 53+#endif /* HAVE_POSIX_FALLOCATE */
48 54
49 if (fstat(f->fd, &f->last_stat) < 0) 55 if (fstat(f->fd, &f->last_stat) < 0)
50 return -errno; 56 return -errno;
51Index: systemd-209/src/journal/journald-kmsg.c 57diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c
52=================================================================== 58index 05b128f..320a52e 100644
53--- systemd-209.orig/src/journal/journald-kmsg.c 2014-02-19 15:03:09.000000000 -0800 59--- a/src/journal/journald-kmsg.c
54+++ systemd-209/src/journal/journald-kmsg.c 2014-02-19 23:22:14.396630422 -0800 60+++ b/src/journal/journald-kmsg.c
55@@ -441,6 +441,7 @@ 61@@ -441,6 +441,7 @@ fail:
56 62
57 int server_open_kernel_seqnum(Server *s) { 63 int server_open_kernel_seqnum(Server *s) {
58 int fd; 64 int fd;
@@ -60,7 +66,7 @@ Index: systemd-209/src/journal/journald-kmsg.c
60 uint64_t *p; 66 uint64_t *p;
61 67
62 assert(s); 68 assert(s);
63@@ -454,8 +455,19 @@ 69@@ -454,8 +455,19 @@ int server_open_kernel_seqnum(Server *s) {
64 log_error("Failed to open /run/systemd/journal/kernel-seqnum, ignoring: %m"); 70 log_error("Failed to open /run/systemd/journal/kernel-seqnum, ignoring: %m");
65 return 0; 71 return 0;
66 } 72 }
@@ -82,3 +88,6 @@ Index: systemd-209/src/journal/journald-kmsg.c
82 log_error("Failed to allocate sequential number file, ignoring: %m"); 88 log_error("Failed to allocate sequential number file, ignoring: %m");
83 close_nointr_nofail(fd); 89 close_nointr_nofail(fd);
84 return 0; 90 return 0;
91--
921.7.9.5
93