chiark / gitweb /
journal: PAGE_SIZE is not known on ppc and other archs
[elogind.git] / src / journal / journald.c
index 93cdec6c6c6dacebdec54994c30c80012aea21cf..87390bdec9921538e3f4c2f6943fffab79e25703 100644 (file)
@@ -29,7 +29,6 @@
 #include <sys/ioctl.h>
 #include <linux/sockios.h>
 #include <sys/statvfs.h>
-#include <sys/user.h>
 
 #include <systemd/sd-journal.h>
 #include <systemd/sd-login.h>
@@ -154,13 +153,10 @@ static uint64_t available_space(Server *s) {
         for (;;) {
                 struct stat st;
                 struct dirent buf, *de;
-                int k;
 
-                k = readdir_r(d, &buf, &de);
-                if (k != 0) {
-                        r = -k;
-                        goto finish;
-                }
+                r = readdir_r(d, &buf, &de);
+                if (r != 0)
+                        break;
 
                 if (!de)
                         break;
@@ -612,7 +608,15 @@ retry:
         else {
                 r = journal_file_append_entry(f, NULL, iovec, n, &s->seqnum, NULL, NULL);
 
-                if ((r == -EBADMSG || r == -E2BIG) && !vacuumed) {
+                if ((r == -E2BIG || /* hit limit */
+                     r == -EFBIG || /* hit fs limit */
+                     r == -EDQUOT || /* quota hit */
+                     r == -ENOSPC || /* disk full */
+                     r == -EBADMSG || /* corrupted */
+                     r == -ENODATA || /* truncated */
+                     r == -EHOSTDOWN || /* other machine */
+                     r == -EPROTONOSUPPORT) && /* unsupported feature */
+                    !vacuumed) {
 
                         if (r == -E2BIG)
                                 log_info("Allocation limit reached, rotating.");
@@ -1918,7 +1922,7 @@ static int system_journal_open(Server *s) {
                          * if it already exists, so that we can flush
                          * it into the system journal */
 
-                        r = journal_file_open_reliably(fn, O_RDWR, 0640, NULL, &s->runtime_journal);
+                        r = journal_file_open(fn, O_RDWR, 0640, NULL, &s->runtime_journal);
                         free(fn);
 
                         if (r < 0) {
@@ -2144,10 +2148,20 @@ static int process_event(Server *s, struct epoll_event *ev) {
                         size_t label_len = 0;
                         union {
                                 struct cmsghdr cmsghdr;
+
+                                /* We use NAME_MAX space for the
+                                 * SELinux label here. The kernel
+                                 * currently enforces no limit, but
+                                 * according to suggestions from the
+                                 * SELinux people this will change and
+                                 * it will probably be identical to
+                                 * NAME_MAX. For now we use that, but
+                                 * this should be updated one day when
+                                 * the final limit is known.*/
                                 uint8_t buf[CMSG_SPACE(sizeof(struct ucred)) +
                                             CMSG_SPACE(sizeof(struct timeval)) +
-                                            CMSG_SPACE(sizeof(int)) +
-                                            CMSG_SPACE(PAGE_SIZE)]; /* selinux label */
+                                            CMSG_SPACE(sizeof(int)) + /* fd */
+                                            CMSG_SPACE(NAME_MAX)]; /* selinux label */
                         } control;
                         ssize_t n;
                         int v;