diff options
| -rw-r--r-- | meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch | 53 |
1 files changed, 26 insertions, 27 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 7cf9626539..d1740efc5c 100644 --- a/meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch +++ b/meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | Upstream-Status: Denied [no desire for uclibc support] | 1 | Upstream-Status: Denied [no desire for uclibc support] |
| 2 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 2 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 3 | 3 | ||
| 4 | Index: git/src/journal/journal-file.c | 4 | Index: systemd-208/src/journal/journal-file.c |
| 5 | =================================================================== | 5 | =================================================================== |
| 6 | --- git.orig/src/journal/journal-file.c 2012-09-02 09:49:15.126089594 -0700 | 6 | --- systemd-208.orig/src/journal/journal-file.c 2014-02-14 00:05:05.000000000 -0800 |
| 7 | +++ git/src/journal/journal-file.c 2012-09-02 09:49:17.118089670 -0700 | 7 | +++ systemd-208/src/journal/journal-file.c 2014-02-14 00:08:41.338821677 -0800 |
| 8 | @@ -34,6 +34,8 @@ | 8 | @@ -38,6 +38,8 @@ |
| 9 | #include "compress.h" | 9 | #include "compress.h" |
| 10 | #include "fsprg.h" | 10 | #include "fsprg.h" |
| 11 | 11 | ||
| @@ -14,16 +14,16 @@ Index: git/src/journal/journal-file.c | |||
| 14 | #define DEFAULT_DATA_HASH_TABLE_SIZE (2047ULL*sizeof(HashItem)) | 14 | #define DEFAULT_DATA_HASH_TABLE_SIZE (2047ULL*sizeof(HashItem)) |
| 15 | #define DEFAULT_FIELD_HASH_TABLE_SIZE (333ULL*sizeof(HashItem)) | 15 | #define DEFAULT_FIELD_HASH_TABLE_SIZE (333ULL*sizeof(HashItem)) |
| 16 | 16 | ||
| 17 | @@ -262,7 +264,7 @@ | 17 | @@ -316,7 +318,7 @@ |
| 18 | 18 | ||
| 19 | static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size) { | 19 | static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size) { |
| 20 | uint64_t old_size, new_size; | 20 | uint64_t old_size, new_size, file_size; |
| 21 | - int r; | 21 | - int r; |
| 22 | + int r = 0; | 22 | + int r = 0; |
| 23 | 23 | ||
| 24 | assert(f); | 24 | assert(f); |
| 25 | 25 | ||
| 26 | @@ -307,10 +309,25 @@ | 26 | @@ -359,9 +361,24 @@ |
| 27 | /* Note that the glibc fallocate() fallback is very | 27 | /* Note that the glibc fallocate() fallback is very |
| 28 | inefficient, hence we try to minimize the allocation area | 28 | inefficient, hence we try to minimize the allocation area |
| 29 | as we can. */ | 29 | as we can. */ |
| @@ -31,29 +31,28 @@ Index: git/src/journal/journal-file.c | |||
| 31 | r = posix_fallocate(f->fd, old_size, new_size - old_size); | 31 | r = posix_fallocate(f->fd, old_size, new_size - old_size); |
| 32 | if (r != 0) | 32 | if (r != 0) |
| 33 | return -r; | 33 | return -r; |
| 34 | |||
| 35 | +#else | 34 | +#else |
| 36 | + /* Use good old method to write zeros into the journal file | 35 | + /* Use good old method to write zeros into the journal file |
| 37 | + perhaps very inefficient yet working. */ | 36 | + perhaps very inefficient yet working. */ |
| 38 | + if(new_size > old_size) { | 37 | + if(new_size > old_size) { |
| 39 | + char *buf = alloca(new_size - old_size); | 38 | + char *buf = alloca(new_size - old_size); |
| 40 | + off_t oldpos = lseek(f->fd, 0, SEEK_CUR); | 39 | + off_t oldpos = lseek(f->fd, 0, SEEK_CUR); |
| 41 | + bzero(buf, new_size - old_size); | 40 | + bzero(buf, new_size - old_size); |
| 42 | + lseek(f->fd, old_size, SEEK_SET); | 41 | + lseek(f->fd, old_size, SEEK_SET); |
| 43 | + r = write(f->fd, buf, new_size - old_size); | 42 | + r = write(f->fd, buf, new_size - old_size); |
| 44 | + lseek(f->fd, oldpos, SEEK_SET); | 43 | + lseek(f->fd, oldpos, SEEK_SET); |
| 45 | + } | 44 | + } |
| 46 | + if (r < 0) | 45 | + if (r < 0) |
| 47 | + return -errno; | 46 | + return -errno; |
| 48 | +#endif /* HAVE_POSIX_FALLOCATE */ | 47 | +#endif /* HAVE_POSIX_FALLOCATE */ |
| 49 | if (fstat(f->fd, &f->last_stat) < 0) | ||
| 50 | return -errno; | ||
| 51 | 48 | ||
| 52 | Index: git/src/journal/journald-kmsg.c | 49 | /* Increase the file size a bit further than this, so that we |
| 50 | * we can create larger memory maps to cache */ | ||
| 51 | Index: systemd-208/src/journal/journald-kmsg.c | ||
| 53 | =================================================================== | 52 | =================================================================== |
| 54 | --- git.orig/src/journal/journald-kmsg.c 2012-09-02 09:49:15.130089595 -0700 | 53 | --- systemd-208.orig/src/journal/journald-kmsg.c 2014-02-14 00:05:05.000000000 -0800 |
| 55 | +++ git/src/journal/journald-kmsg.c 2012-09-02 12:26:17.326447895 -0700 | 54 | +++ systemd-208/src/journal/journald-kmsg.c 2014-02-14 00:05:47.498823000 -0800 |
| 56 | @@ -404,6 +404,7 @@ | 55 | @@ -407,6 +407,7 @@ |
| 57 | 56 | ||
| 58 | int server_open_kernel_seqnum(Server *s) { | 57 | int server_open_kernel_seqnum(Server *s) { |
| 59 | int fd; | 58 | int fd; |
| @@ -61,7 +60,7 @@ Index: git/src/journal/journald-kmsg.c | |||
| 61 | uint64_t *p; | 60 | uint64_t *p; |
| 62 | 61 | ||
| 63 | assert(s); | 62 | assert(s); |
| 64 | @@ -417,8 +418,19 @@ | 63 | @@ -420,8 +421,19 @@ |
| 65 | log_error("Failed to open /run/systemd/journal/kernel-seqnum, ignoring: %m"); | 64 | log_error("Failed to open /run/systemd/journal/kernel-seqnum, ignoring: %m"); |
| 66 | return 0; | 65 | return 0; |
| 67 | } | 66 | } |
