[systemd-commits] 3 commits - TODO src/hostname

Lennart Poettering lennart at kemper.freedesktop.org
Wed Apr 23 14:44:52 PDT 2014


 TODO                       |    8 ++++++++
 src/hostname/hostnamectl.c |   11 ++++++++---
 src/hostname/hostnamed.c   |   12 ++++++++++++
 3 files changed, 28 insertions(+), 3 deletions(-)

New commits:
commit fa4f8f9bc1fbef6a658cff39ac185bbedea6caf4
Author: Djalal Harouni <tixxdz at opendz.org>
Date:   Wed Apr 23 22:41:13 2014 +0100

    hostnamectl: read kernel name and release from remote

diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c
index 326f371..70049d3 100644
--- a/src/hostname/hostnamectl.c
+++ b/src/hostname/hostnamectl.c
@@ -67,6 +67,8 @@ typedef struct StatusInfo {
         char *pretty_hostname;
         char *icon_name;
         char *chassis;
+        char *kernel_name;
+        char *kernel_release;
         char *os_pretty_name;
         char *os_cpe_name;
         char *virtualization;
@@ -76,7 +78,6 @@ typedef struct StatusInfo {
 static void print_status_info(StatusInfo *i) {
         sd_id128_t mid = {}, bid = {};
         int r;
-        struct utsname u;
 
         assert(i);
 
@@ -112,8 +113,8 @@ static void print_status_info(StatusInfo *i) {
         if (!isempty(i->os_cpe_name))
                 printf("       CPE OS Name: %s\n", i->os_cpe_name);
 
-        assert_se(uname(&u) >= 0);
-        printf("            Kernel: %s %s\n", u.sysname, u.release);
+        if (!isempty(i->kernel_name) && !isempty(i->kernel_release))
+                printf("            Kernel: %s %s\n", i->kernel_name, i->kernel_release);
 
         if (!isempty(i->architecture))
                 printf("      Architecture: %s\n", i->architecture);
@@ -156,6 +157,8 @@ static int show_all_names(sd_bus *bus) {
                 { "PrettyHostname", "s", NULL, offsetof(StatusInfo, pretty_hostname) },
                 { "IconName",       "s", NULL, offsetof(StatusInfo, icon_name) },
                 { "Chassis",        "s", NULL, offsetof(StatusInfo, chassis) },
+                { "KernelName",     "s", NULL, offsetof(StatusInfo, kernel_name) },
+                { "KernelRelease",     "s", NULL, offsetof(StatusInfo, kernel_release) },
                 { "OperatingSystemPrettyName",     "s", NULL, offsetof(StatusInfo, os_pretty_name) },
                 { "OperatingSystemCPEName",        "s", NULL, offsetof(StatusInfo, os_cpe_name) },
                 {}
@@ -191,6 +194,8 @@ fail:
         free(info.pretty_hostname);
         free(info.icon_name);
         free(info.chassis);
+        free(info.kernel_name);
+        free(info.kernel_release);
         free(info.os_pretty_name);
         free(info.os_cpe_name);
         free(info.virtualization);

commit f426cc5d4e30b05a0661c74e93ff3e95414f7a3c
Author: Djalal Harouni <tixxdz at opendz.org>
Date:   Wed Apr 23 22:41:12 2014 +0100

    hostnamed: expose KernelName and KernelRelease on the bus

diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index 3b19d43..2be6dcd 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -23,6 +23,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <dlfcn.h>
+#include <sys/utsname.h>
 
 #include "util.h"
 #include "strv.h"
@@ -40,6 +41,8 @@ enum {
         PROP_PRETTY_HOSTNAME,
         PROP_ICON_NAME,
         PROP_CHASSIS,
+        PROP_KERNEL_NAME,
+        PROP_KERNEL_RELEASE,
         PROP_OS_PRETTY_NAME,
         PROP_OS_CPE_NAME,
         _PROP_MAX
@@ -70,11 +73,18 @@ static void context_free(Context *c, sd_bus *bus) {
 
 static int context_read_data(Context *c) {
         int r;
+        struct utsname u;
 
         assert(c);
 
         context_reset(c);
 
+        assert_se(uname(&u) >= 0);
+        c->data[PROP_KERNEL_NAME] = strdup(u.sysname);
+        c->data[PROP_KERNEL_RELEASE] = strdup(u.release);
+        if (!c->data[PROP_KERNEL_NAME] || !c->data[PROP_KERNEL_RELEASE])
+                return -ENOMEM;
+
         c->data[PROP_HOSTNAME] = gethostname_malloc();
         if (!c->data[PROP_HOSTNAME])
                 return -ENOMEM;
@@ -555,6 +565,8 @@ static const sd_bus_vtable hostname_vtable[] = {
         SD_BUS_PROPERTY("PrettyHostname", "s", NULL, offsetof(Context, data) + sizeof(char*) * PROP_PRETTY_HOSTNAME, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
         SD_BUS_PROPERTY("IconName", "s", property_get_icon_name, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
         SD_BUS_PROPERTY("Chassis", "s", property_get_chassis, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
+        SD_BUS_PROPERTY("KernelName", "s", NULL, offsetof(Context, data) + sizeof(char*) * PROP_KERNEL_NAME, SD_BUS_VTABLE_PROPERTY_CONST),
+        SD_BUS_PROPERTY("KernelRelease", "s", NULL, offsetof(Context, data) + sizeof(char*) * PROP_KERNEL_RELEASE, SD_BUS_VTABLE_PROPERTY_CONST),
         SD_BUS_PROPERTY("OperatingSystemPrettyName", "s", NULL, offsetof(Context, data) + sizeof(char*) * PROP_OS_PRETTY_NAME, SD_BUS_VTABLE_PROPERTY_CONST),
         SD_BUS_PROPERTY("OperatingSystemCPEName", "s", NULL, offsetof(Context, data) + sizeof(char*) * PROP_OS_CPE_NAME, SD_BUS_VTABLE_PROPERTY_CONST),
         SD_BUS_METHOD("SetHostname", "sb", NULL, method_set_hostname, SD_BUS_VTABLE_UNPRIVILEGED),

commit e107ed185ef08945102834234a05ec51bb438685
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Apr 23 22:41:44 2014 +0200

    update TODO

diff --git a/TODO b/TODO
index 17fe94a..fc56c61 100644
--- a/TODO
+++ b/TODO
@@ -32,6 +32,14 @@ External:
 
 Features:
 
+* drop parsing of chkconfig header lines from service.c
+
+* mount_cgroup_controllers(): symlinks need to get the label applied
+
+* For timer units: add some mechanisms so that timer units that trigger immediately on boot don't have the services they run added to the initial transaction and thus confuse Type=idle. Alternatively, split up the boot-up state into two, and make Type=idle only be affected by jobs for the default target, but ignore any further jobs
+
+* Add RPM macros for registering/unregistering binfmt drop-ins
+
 * Add timeout to early-boot, and shut down the system if it is hit. Solves the laptop-in-bag problem and is useful for embedded cases
 
 * sd-resolve: add callback api



More information about the systemd-commits mailing list