chiark / gitweb /
Prep v238: Applied some upstream updates to src/basic (3/5)
authorSven Eden <yamakuzure@gmx.net>
Fri, 1 Jun 2018 18:21:25 +0000 (20:21 +0200)
committerSven Eden <yamakuzure@gmx.net>
Mon, 4 Jun 2018 08:32:14 +0000 (10:32 +0200)
src/basic/build.h
src/basic/cgroup-util.c
src/basic/label.c
src/basic/label.h
src/basic/meson.build
src/basic/raw-reboot.h [deleted file]
src/basic/reboot-util.c [deleted file]
src/basic/reboot-util.h [deleted file]
src/basic/socket-util.c
src/basic/terminal-util.h

index 61968d59e2dc8e90df6d33fdad69c00780af634d..cbc638c8cb1b946f805e6ef7be7f3c8edde7cefa 100644 (file)
 
 #if HAVE_LIBIDN
 #define _IDN_FEATURE_ "+IDN"
+#else
+#define _IDN_FEATURE_ "-IDN"
+#endif
 
 #if HAVE_PCRE2
 #define _PCRE2_FEATURE_ "+PCRE2"
index 452a8e2f7e333b8f78993637e0ad7cbe362335ae..302fc95ddcfaca7776cf4430d96ad95160770372 100644 (file)
@@ -1076,13 +1076,11 @@ int cg_pid_get_path(const char *controller, pid_t pid, char **path) {
                                 continue;
 
                         *e = 0;
-                        FOREACH_WORD_SEPARATOR(word, k, l, ",", state) {
+                        FOREACH_WORD_SEPARATOR(word, k, l, ",", state)
                                 if (k == cs && memcmp(word, controller_str, cs) == 0) {
                                         found = true;
                                         break;
                                 }
-                        }
-
                         if (!found)
                                 continue;
                 }
index 0bea2aa39e58715932481a6a358b6d795d0d62cc..50cdd8c7319315a214add2b6d9f261dec3d25e60 100644 (file)
@@ -22,6 +22,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
+//#include "btrfs-util.h"
 #include "label.h"
 #include "macro.h"
 #include "selinux-util.h"
@@ -63,4 +64,22 @@ int symlink_label(const char *old_path, const char *new_path) {
 
         return mac_smack_fix(new_path, false, false);
 }
+
+int btrfs_subvol_make_label(const char *path) {
+        int r;
+
+        assert(path);
+
+        r = mac_selinux_create_file_prepare(path, S_IFDIR);
+        if (r < 0)
+                return r;
+
+        r = btrfs_subvol_make(path);
+        mac_selinux_create_file_clear();
+
+        if (r < 0)
+                return r;
+
+        return mac_smack_fix(path, false, false);
+}
 #endif // 0
index df25d8bafe42ed7aaae4bc9d65737a8c857012ea..4bfcfe39f631e32dd819b5372b734b6e0a4e71de 100644 (file)
@@ -28,6 +28,6 @@ int label_fix(const char *path, bool ignore_enoent, bool ignore_erofs);
 int mkdir_label(const char *path, mode_t mode);
 #if 0 /// UNNEEDED by elogind
 int symlink_label(const char *old_path, const char *new_path);
-#endif // 0
 
 int btrfs_subvol_make_label(const char *path);
+#endif // 0
index 33cfe8e531850f67c399ca4209bf8cc27e5a8931..1f23863553b6431ad7d923e256aafe1ef43ea8fd 100644 (file)
 #         xml.h
 # '''.split())
 #else
-basic_sources_plain = files('''
+basic_sources = files('''
         alloc-util.c
         alloc-util.h
         audit-util.c
@@ -475,18 +475,20 @@ libbasic = static_library(
                         libcap,
 #if 0 /// no blkid in elogind
 #                         libblkid,
+#                         libmount,
 #endif // 0
-                        libmount,
                         libselinux],
         c_args : ['-fvisibility=default'],
         install : false)
 
-# A convenience library that is separate from libbasic to avoid
-# unnecessary linking to libgcrypt.
-libbasic_gcrypt = static_library(
-        'basic-gcrypt',
-        'gcrypt-util.c',
-        'gcrypt-util.h',
-        include_directories : includes,
-        dependencies : [libgcrypt],
-        c_args : ['-fvisibility=default'])
+#if 0 /// elogind does not need gcrypt
+# # A convenience library that is separate from libbasic to avoid
+# # unnecessary linking to libgcrypt.
+# libbasic_gcrypt = static_library(
+#         'basic-gcrypt',
+#         'gcrypt-util.c',
+#         'gcrypt-util.h',
+#         include_directories : includes,
+#         dependencies : [libgcrypt],
+#         c_args : ['-fvisibility=default'])
+#endif // 0
diff --git a/src/basic/raw-reboot.h b/src/basic/raw-reboot.h
deleted file mode 100644 (file)
index 3f7f63b..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/* SPDX-License-Identifier: LGPL-2.1+ */
-#pragma once
-
-//#include <linux/reboot.h>
-//#include <sys/reboot.h>
-//#include <sys/syscall.h>
-
-/* glibc defines the reboot() API call, which is a wrapper around the system call of the same name, but without the
- * extra "arg" parameter. Since we need that parameter for some calls, let's add a "raw" wrapper that is defined the
- * same way, except it takes the additional argument. */
-
-static inline int raw_reboot(int cmd, const void *arg) {
-        return (int) syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, arg);
-}
diff --git a/src/basic/reboot-util.c b/src/basic/reboot-util.c
deleted file mode 100644 (file)
index 2528d9b..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/* SPDX-License-Identifier: LGPL-2.1+ */
-
-//#include <errno.h>
-//#include <unistd.h>
-
-//#include "fileio.h"
-//#include "log.h"
-//#include "reboot-util.h"
-//#include "string-util.h"
-//#include "umask-util.h"
-
-int update_reboot_parameter_and_warn(const char *parameter) {
-        int r;
-
-        if (isempty(parameter)) {
-                if (unlink("/run/systemd/reboot-param") < 0) {
-                        if (errno == ENOENT)
-                                return 0;
-
-                        return log_warning_errno(errno, "Failed to unlink reboot parameter file: %m");
-                }
-
-                return 0;
-        }
-
-        RUN_WITH_UMASK(0022) {
-                r = write_string_file("/run/systemd/reboot-param", parameter,
-                                      WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_ATOMIC);
-                if (r < 0)
-                        return log_warning_errno(r, "Failed to write reboot parameter file: %m");
-        }
-
-        return 0;
-}
diff --git a/src/basic/reboot-util.h b/src/basic/reboot-util.h
deleted file mode 100644 (file)
index 6f1d24c..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/* SPDX-License-Identifier: LGPL-2.1+ */
-#pragma once
-
-int update_reboot_parameter_and_warn(const char *parameter);
index 007b302e721acee91f8f2543d33082037981662c..7e68a672e60bb88326aa9dcf2bf5269b1c255a18 100644 (file)
@@ -52,7 +52,7 @@
 
 #if 0 /// UNNEEDED by elogind
 #if ENABLE_IDN
-#  define IDN_FLAGS (NI_IDN|NI_IDN_USE_STD3_ASCII_RULES)
+#  define IDN_FLAGS NI_IDN
 #else
 #  define IDN_FLAGS 0
 #endif
index 3c41a5b976b69ba4946e83082b79a9a24e083f1e..667424c0a81a4930783968db12e3f88c3ffdd631 100644 (file)
 #include "macro.h"
 #include "time-util.h"
 
-#define ANSI_RED "\x1B[0;31m"
-#define ANSI_GREEN "\x1B[0;32m"
+/* Regular colors */
+#define ANSI_BLACK   "\x1B[0;30m"
+#define ANSI_RED     "\x1B[0;31m"
+#define ANSI_GREEN   "\x1B[0;32m"
+#define ANSI_YELLOW  "\x1B[0;33m"
+#define ANSI_BLUE    "\x1B[0;34m"
+#define ANSI_MAGENTA "\x1B[0;35m"
+#define ANSI_CYAN    "\x1B[0;36m"
+#define ANSI_WHITE   "\x1B[0;37m"
+
+/* Bold/highlighted */
+#define ANSI_HIGHLIGHT_BLACK   "\x1B[0;1;30m"
+#define ANSI_HIGHLIGHT_RED     "\x1B[0;1;31m"
+#define ANSI_HIGHLIGHT_GREEN   "\x1B[0;1;32m"
+#define ANSI_HIGHLIGHT_YELLOW  "\x1B[0;1;33m"
+#define ANSI_HIGHLIGHT_BLUE    "\x1B[0;1;34m"
+#define ANSI_HIGHLIGHT_MAGENTA "\x1B[0;1;35m"
+#define ANSI_HIGHLIGHT_CYAN    "\x1B[0;1;36m"
+#define ANSI_HIGHLIGHT_WHITE   "\x1B[0;1;37m"
+
+/* Underlined */
+#define ANSI_HIGHLIGHT_BLACK_UNDERLINE   "\x1B[0;1;4;30m"
+#define ANSI_HIGHLIGHT_RED_UNDERLINE     "\x1B[0;1;4;31m"
+#define ANSI_HIGHLIGHT_GREEN_UNDERLINE   "\x1B[0;1;4;32m"
+#define ANSI_HIGHLIGHT_YELLOW_UNDERLINE  "\x1B[0;1;4;33m"
+#define ANSI_HIGHLIGHT_BLUE_UNDERLINE    "\x1B[0;1;4;34m"
+#define ANSI_HIGHLIGHT_MAGENTA_UNDERLINE "\x1B[0;1;4;35m"
+#define ANSI_HIGHLIGHT_CYAN_UNDERLINE    "\x1B[0;1;4;36m"
+#define ANSI_HIGHLIGHT_WHITE_UNDERLINE   "\x1B[0;1;4;37m"
+
+/* Other ANSI codes */
 #define ANSI_UNDERLINE "\x1B[0;4m"
 #define ANSI_HIGHLIGHT "\x1B[0;1;39m"
-#define ANSI_HIGHLIGHT_RED "\x1B[0;1;31m"
-#define ANSI_HIGHLIGHT_GREEN "\x1B[0;1;32m"
-#define ANSI_HIGHLIGHT_YELLOW "\x1B[0;1;33m"
-#define ANSI_HIGHLIGHT_BLUE "\x1B[0;1;34m"
 #define ANSI_HIGHLIGHT_UNDERLINE "\x1B[0;1;4m"
-#define ANSI_HIGHLIGHT_RED_UNDERLINE "\x1B[0;1;4;31m"
-#define ANSI_HIGHLIGHT_GREEN_UNDERLINE "\x1B[0;1;4;32m"
-#define ANSI_HIGHLIGHT_YELLOW_UNDERLINE "\x1B[0;1;4;33m"
-#define ANSI_HIGHLIGHT_BLUE_UNDERLINE "\x1B[0;1;4;34m"
+
+/* Reset/clear ANSI styles */
 #define ANSI_NORMAL "\x1B[0m"
 
+/* Erase characters until the end of the line */
 #define ANSI_ERASE_TO_END_OF_LINE "\x1B[K"
 
 /* Set cursor to top left corner and clear screen */