[systemd-commits] 2 commits - NEWS README TODO man/bootup.xml man/journalctl.xml man/journald.conf.xml man/sd_journal_open.xml man/sd_journal_print.xml man/sd_journal_seek_head.xml man/sd_seat_get_active.xml man/systemctl.xml man/systemd-delta.xml man/systemd-inhibit.xml man/systemd-readahead-replay.service.xml man/systemd.conf.xml man/systemd.exec.xml src/core src/journal src/shared units/syslog.target
Lennart Poettering
lennart at kemper.freedesktop.org
Mon Jul 16 03:16:53 PDT 2012
NEWS | 2
README | 2
TODO | 2
man/bootup.xml | 2
man/journalctl.xml | 8 -
man/journald.conf.xml | 4
man/sd_journal_open.xml | 2
man/sd_journal_print.xml | 2
man/sd_journal_seek_head.xml | 10 +-
man/sd_seat_get_active.xml | 2
man/systemctl.xml | 6 -
man/systemd-delta.xml | 2
man/systemd-inhibit.xml | 2
man/systemd-readahead-replay.service.xml | 2
man/systemd.conf.xml | 2
man/systemd.exec.xml | 10 +-
src/core/load-fragment.c | 2
src/core/shutdown.c | 2
src/core/unit.h | 2
src/journal/lookup3.c | 6 -
src/journal/sd-journal.c | 2
src/shared/dbus-common.c | 2
src/shared/util.c | 132 ++++++++++++++++++++++++++++---
src/shared/util.h | 7 +
units/syslog.target | 2
25 files changed, 167 insertions(+), 50 deletions(-)
New commits:
commit 7c5f152acafcf0964db2f3a111195b3b2f36176f
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Jul 16 12:15:22 2012 +0200
util: add getusername_malloc(), get_shell(), get_home_dir()
diff --git a/src/shared/util.c b/src/shared/util.c
index cef6dbb..a0755ef 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -3078,26 +3078,22 @@ bool hostname_is_set(void) {
return !isempty(u.nodename) && !streq(u.nodename, "(none)");
}
-char* getlogname_malloc(void) {
- uid_t uid;
+
+static char *lookup_uid(uid_t uid) {
long bufsize;
char *buf, *name;
struct passwd pwbuf, *pw = NULL;
- struct stat st;
-
- if (isatty(STDIN_FILENO) && fstat(STDIN_FILENO, &st) >= 0)
- uid = st.st_uid;
- else
- uid = getuid();
/* Shortcut things to avoid NSS lookups */
if (uid == 0)
return strdup("root");
- if ((bufsize = sysconf(_SC_GETPW_R_SIZE_MAX)) <= 0)
+ bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
+ if (bufsize <= 0)
bufsize = 4096;
- if (!(buf = malloc(bufsize)))
+ buf = malloc(bufsize);
+ if (!buf)
return NULL;
if (getpwuid_r(uid, &pwbuf, buf, bufsize, &pw) == 0 && pw) {
@@ -3114,6 +3110,28 @@ char* getlogname_malloc(void) {
return name;
}
+char* getlogname_malloc(void) {
+ uid_t uid;
+ struct stat st;
+
+ if (isatty(STDIN_FILENO) && fstat(STDIN_FILENO, &st) >= 0)
+ uid = st.st_uid;
+ else
+ uid = getuid();
+
+ return lookup_uid(uid);
+}
+
+char *getusername_malloc(void) {
+ const char *e;
+
+ e = getenv("USER");
+ if (e)
+ return strdup(e);
+
+ return lookup_uid(getuid());
+}
+
int getttyname_malloc(int fd, char **r) {
char path[PATH_MAX], *c;
int k;
@@ -5875,3 +5893,97 @@ int make_console_stdio(void) {
return 0;
}
+
+int get_home_dir(char **_h) {
+ char *h;
+ const char *e;
+ uid_t u;
+ struct passwd *p;
+
+ assert(_h);
+
+ /* Take the user specified one */
+ e = getenv("HOME");
+ if (e) {
+ h = strdup(e);
+ if (!h)
+ return -ENOMEM;
+
+ *_h = h;
+ return 0;
+ }
+
+ /* Hardcode home directory for root to avoid NSS */
+ u = getuid();
+ if (u == 0) {
+ h = strdup("/root");
+ if (!h)
+ return -ENOMEM;
+
+ *_h = h;
+ return 0;
+ }
+
+ /* Check the database... */
+ errno = 0;
+ p = getpwuid(u);
+ if (!p)
+ return errno ? -errno : -ENOENT;
+
+ if (!path_is_absolute(p->pw_dir))
+ return -EINVAL;
+
+ h = strdup(p->pw_dir);
+ if (!h)
+ return -ENOMEM;
+
+ *_h = h;
+ return 0;
+}
+
+int get_shell(char **_sh) {
+ char *sh;
+ const char *e;
+ uid_t u;
+ struct passwd *p;
+
+ assert(_sh);
+
+ /* Take the user specified one */
+ e = getenv("SHELL");
+ if (e) {
+ sh = strdup(e);
+ if (!sh)
+ return -ENOMEM;
+
+ *_sh = sh;
+ return 0;
+ }
+
+ /* Hardcode home directory for root to avoid NSS */
+ u = getuid();
+ if (u == 0) {
+ sh = strdup("/bin/sh");
+ if (!sh)
+ return -ENOMEM;
+
+ *_sh = sh;
+ return 0;
+ }
+
+ /* Check the database... */
+ errno = 0;
+ p = getpwuid(u);
+ if (!p)
+ return errno ? -errno : -ESRCH;
+
+ if (!path_is_absolute(p->pw_shell))
+ return -EINVAL;
+
+ sh = strdup(p->pw_shell);
+ if (!sh)
+ return -ENOMEM;
+
+ *_sh = sh;
+ return 0;
+}
diff --git a/src/shared/util.h b/src/shared/util.h
index d9b656d..d3546ba 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -345,9 +345,11 @@ void rename_process(const char name[8]);
void sigset_add_many(sigset_t *ss, ...);
-char* gethostname_malloc(void);
bool hostname_is_set(void);
+
+char* gethostname_malloc(void);
char* getlogname_malloc(void);
+char* getusername_malloc(void);
int getttyname_malloc(int fd, char **r);
int getttyname_harder(int fd, char **r);
@@ -527,4 +529,7 @@ bool in_initrd(void);
void warn_melody(void);
+int get_shell(char **ret);
+int get_home_dir(char **ret);
+
#endif
commit 49f43d5f91a99b23f745726aa351d8f159774357
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Sun Jul 15 11:41:40 2012 +0300
Spelling fixes.
diff --git a/NEWS b/NEWS
index 7e058d8..b9c4529 100644
--- a/NEWS
+++ b/NEWS
@@ -233,7 +233,7 @@ CHANGES WITH 183:
to be used as drop-in files.
* systemd and logind now handle system sleep states, in
- particulary suspending and hibernating.
+ particular suspending and hibernating.
* logind now implements a sleep/shutdown/idle inhibiting logic
suitable for a variety of uses. Soonishly Lennart will blog
diff --git a/README b/README
index d23a3d6..dc8e5f5 100644
--- a/README
+++ b/README
@@ -71,7 +71,7 @@ REQUIREMENTS:
includes systemd-hostnamed.
Note that D-Bus can link against libsystemd-login.so, which
- results in a cyclic build dependency. To accomodate for this
+ results in a cyclic build dependency. To accommodate for this
please build D-Bus without systemd first, then build systemd,
then rebuild D-Bus with systemd support.
diff --git a/TODO b/TODO
index 1ec59b2..ae9fbc2 100644
--- a/TODO
+++ b/TODO
@@ -47,7 +47,7 @@ Features:
* man: clarify that time-sync.target is not only sysv compat but also useful otherwise. Same for similar targets
-* journalctl should complain if run with uid != 0 and no persistant logs exist
+* journalctl should complain if run with uid != 0 and no persistent logs exist
* .device aliases need to be implemented with the "following" logic, probably.
diff --git a/man/bootup.xml b/man/bootup.xml
index ed72acf..760a5a4 100644
--- a/man/bootup.xml
+++ b/man/bootup.xml
@@ -53,7 +53,7 @@
<para>A number of different components are involved in the
system boot. Immediately after power-up, the system
BIOS will do minimal hardware initialization, and hand
- control over to a boot loader stored on a persistant
+ control over to a boot loader stored on a persistent
storage device. This boot loader will then invoke an
OS kernel from disk (or the network). In the Linux
case this kernel now (optionally) extracts and
diff --git a/man/journalctl.xml b/man/journalctl.xml
index f314fb6..05c8703 100644
--- a/man/journalctl.xml
+++ b/man/journalctl.xml
@@ -141,7 +141,7 @@
<term><option>-f</option></term>
<listitem><para>Show only most recent
- journal entries, and continously print
+ journal entries, and continuously print
new entries as they are appended to
the journal.</para></listitem>
</varlistentry>
@@ -189,9 +189,9 @@
is very similar but shows monotonic
timestamps instead of wallclock
timestamps. <literal>verbose</literal>
- shows the full structered entry items
+ shows the full structured entry items
with all
- fiels. <literal>export</literal>
+ fields. <literal>export</literal>
serializes the journal into a binary
(but mostly text-based) stream
suitable for backups and network
@@ -209,7 +209,7 @@
<term><option>-q</option></term>
<listitem><para>Suppresses any warning
- message regarding inaccessable system
+ message regarding inaccessible system
journals when run as normal
user.</para></listitem>
</varlistentry>
diff --git a/man/journald.conf.xml b/man/journald.conf.xml
index 3622709..d7caea8 100644
--- a/man/journald.conf.xml
+++ b/man/journald.conf.xml
@@ -174,7 +174,7 @@
influences the granularity in which
disk space is made available through
rotation, i.e. deletion of historic
- data. Defaults to one eigth of the
+ data. Defaults to one eighth of the
values configured with
<varname>SystemMaxUse=</varname> and
<varname>RuntimeMaxUse=</varname>, so
@@ -317,7 +317,7 @@
directory
<filename>/var/log/journal</filename>
is not created if needed, so that its
- existance controls where log data
+ existence controls where log data
goes. <literal>none</literal> turns
off all storage, all log data received
will be dropped. Forwarding to other
diff --git a/man/sd_journal_open.xml b/man/sd_journal_open.xml
index ffd9a2c..b99c67d 100644
--- a/man/sd_journal_open.xml
+++ b/man/sd_journal_open.xml
@@ -92,7 +92,7 @@
only journal files generated on the local machine will
be opened. <literal>SD_JOURNAL_RUNTIME_ONLY</literal>
makes sure only volatile journal files will be opened,
- excluding those which are stored on persistant
+ excluding those which are stored on persistent
storage. <literal>SD_JOURNAL_SYSTEM_ONLY</literal>
will ensure that only journal files of system services
and the kernel (in opposition to user session processes) will
diff --git a/man/sd_journal_print.xml b/man/sd_journal_print.xml
index 05c1ebe..dfe9919 100644
--- a/man/sd_journal_print.xml
+++ b/man/sd_journal_print.xml
@@ -172,7 +172,7 @@ sd_journal_send("MESSAGE=Hello World, this is PID %lu!", (unsigned long) getpid(
<para><citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>
and and <function>sd_journal_print()</function> may
- largely be used interchangably
+ largely be used interchangeably
functionality-wise. However, note that log messages
logged via the former take a different path to the
journal server than the later, and hence global
diff --git a/man/sd_journal_seek_head.xml b/man/sd_journal_seek_head.xml
index b6a9a73..f8a4eb1 100644
--- a/man/sd_journal_seek_head.xml
+++ b/man/sd_journal_seek_head.xml
@@ -92,7 +92,7 @@
<para><function>sd_journal_seek_head()</function>
seeks to the beginning of the journal, i.e. the oldest
- avilable entry.</para>
+ available entry.</para>
<para>Similar,
<function>sd_journal_seek_tail()</function> may be
@@ -110,7 +110,7 @@
(wallclock) timestamp, i.e. CLOCK_REALTIME. Note that
the realtime clock is not necessary monotonic. If a
realtime timestamp is ambiguous it is not defined
- which position is seeked to.</para>
+ which position is sought to.</para>
<para><function>sd_journal_seek_cursor()</function>
seeks to the entry located at the specified cursor
@@ -125,12 +125,12 @@
may be retrieved via
<citerefentry><refentrytitle>sd_journal_get_data</refentrytitle><manvolnum>3</manvolnum></citerefentry>. If
no entry exists that matches exactly the specified
- seek address the next closest is seeked to. If
+ seek address the next closest is sought to. If
<citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry>
- is used the closest following entry will be seeked to,
+ is used the closest following entry will be sought to,
if
<citerefentry><refentrytitle>sd_journal_previous</refentrytitle><manvolnum>3</manvolnum></citerefentry>
- is used the closest preceeding entry is seeked
+ is used the closest preceding entry is sought
to.</para>
</refsect1>
diff --git a/man/sd_seat_get_active.xml b/man/sd_seat_get_active.xml
index fa47378..801c16a 100644
--- a/man/sd_seat_get_active.xml
+++ b/man/sd_seat_get_active.xml
@@ -118,7 +118,7 @@
<para><function>sd_seat_can_multi_session()</function>
may be used to determine whether a specific seat is
capable of multi-session, i.e. allows multiple login
- sessions in parallel (whith only one being active at a
+ sessions in parallel (with only one being active at a
time).</para>
<para><function>sd_seat_can_tty()</function> may be
diff --git a/man/systemctl.xml b/man/systemctl.xml
index bf31b61..3c0a795 100644
--- a/man/systemctl.xml
+++ b/man/systemctl.xml
@@ -447,7 +447,7 @@
<term><option>-f</option></term>
<listitem><para>When used with
- <command>status</command> continously
+ <command>status</command> continuously
prints new journal entries as they are
appended to the
journal.</para></listitem>
@@ -1202,10 +1202,10 @@
directory, and the path to the new
system manager binary below it to
execute as PID 1. If the latter is
- ommitted or the empty string, a
+ omitted or the empty string, a
systemd binary will automatically be
searched for and used as init. If the
- system manager path is ommitted or
+ system manager path is omitted or
equal the empty string the state of
the initrd's system manager process is
passed to the main system manager,
diff --git a/man/systemd-delta.xml b/man/systemd-delta.xml
index 9ded28b..4e57d18 100644
--- a/man/systemd-delta.xml
+++ b/man/systemd-delta.xml
@@ -155,7 +155,7 @@
<listitem><para>When showing modified
files, when a file is overridden show a
- diff aswell. This option takes a
+ diff as well. This option takes a
boolean argument.</para></listitem>
</varlistentry>
diff --git a/man/systemd-inhibit.xml b/man/systemd-inhibit.xml
index 81ec9ef..e19892b 100644
--- a/man/systemd-inhibit.xml
+++ b/man/systemd-inhibit.xml
@@ -110,7 +110,7 @@
inhibiting
reboot/power-off/halt/kexec,
suspending/hibernating, resp. the
- automatic idle detection. If ommitted
+ automatic idle detection. If omitted
defaults to
<literal>idle:sleep:shutdown</literal>,
i.e. takes all possible
diff --git a/man/systemd-readahead-replay.service.xml b/man/systemd-readahead-replay.service.xml
index e37b1a9..b56fdb8 100644
--- a/man/systemd-readahead-replay.service.xml
+++ b/man/systemd-readahead-replay.service.xml
@@ -85,7 +85,7 @@
and
<filename>systemd-readahead-replay.service</filename>
are activated at boot so that access patterns from the
- preceeding boot are replayed and new data collected
+ preceding boot are replayed and new data collected
for the subsequent boot. However, on read-only media
where the collected data cannot be stored it might
be a good idea to disable
diff --git a/man/systemd.conf.xml b/man/systemd.conf.xml
index fb038ea..804a50e 100644
--- a/man/systemd.conf.xml
+++ b/man/systemd.conf.xml
@@ -125,7 +125,7 @@
hierarchy. By default systemd will
mount all controllers which are
enabled in the kernel in individual
- hierachies, with the exception of
+ hierarchies, with the exception of
those listed in this setting. Takes a
space separated list of comma
separated controller names, in order
diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml
index 8d3b3da..eff75d0 100644
--- a/man/systemd.exec.xml
+++ b/man/systemd.exec.xml
@@ -931,18 +931,18 @@
<term><varname>BlockIOWriteBandwidth=</varname></term>
<listitem><para>Set the per-device
- overall block IO bandwith limit for
+ overall block IO bandwidth limit for
the executed processes. Takes a space
separated pair of a file path and a
- bandwith value (in bytes per second)
+ bandwidth value (in bytes per second)
to specify the device specific
bandwidth. The file path may be
specified as path to a block device
node or as any other file in which
case the backing block device of the
file system of the file is determined.
- If the bandwith is suffixed with K, M,
- G, or T the specified bandwith is
+ If the bandwidth is suffixed with K, M,
+ G, or T the specified bandwidth is
parsed as Kilobytes, Megabytes,
Gigabytes, resp. Terabytes (Example:
"/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0
@@ -951,7 +951,7 @@
and
<literal>blkio.write_bps_device</literal>
control group attributes. Use this
- option multiple times to set bandwith
+ option multiple times to set bandwidth
limits for multiple devices. For
details about these control group
attributes see <ulink
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index e0e42ac..748ab55 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -1910,7 +1910,7 @@ int config_parse_unit_blkio_bandwidth(const char *filename, unsigned line, const
}
if (parse_bytes(l[1], &bytes) < 0 || bytes <= 0) {
- log_error("[%s:%u] Failed to parse block IO bandwith value, ignoring: %s", filename, line, rvalue);
+ log_error("[%s:%u] Failed to parse block IO bandwidth value, ignoring: %s", filename, line, rvalue);
strv_free(l);
return 0;
}
diff --git a/src/core/shutdown.c b/src/core/shutdown.c
index 1c2bf37..78dccfb 100644
--- a/src/core/shutdown.c
+++ b/src/core/shutdown.c
@@ -116,7 +116,7 @@ static int pivot_to_new_root(void) {
if (pivot_root(".", "oldroot") < 0) {
log_error("pivot failed: %m");
- /* only chroot if pivot root succeded */
+ /* only chroot if pivot root succeeded */
return -errno;
}
diff --git a/src/core/unit.h b/src/core/unit.h
index 61a85d7..45849a4 100644
--- a/src/core/unit.h
+++ b/src/core/unit.h
@@ -220,7 +220,7 @@ struct Unit {
/* Ignore this unit when snapshotting */
bool ignore_on_snapshot;
- /* Did the last condition check suceed? */
+ /* Did the last condition check succeed? */
bool condition_result;
bool in_load_queue:1;
diff --git a/src/journal/lookup3.c b/src/journal/lookup3.c
index b90093a..31eac8c 100644
--- a/src/journal/lookup3.c
+++ b/src/journal/lookup3.c
@@ -315,7 +315,7 @@ uint32_t jenkins_hashlittle( const void *key, size_t length, uint32_t initval)
* rest of the string. Every machine with memory protection I've seen
* does it on word boundaries, so is OK with this. But VALGRIND will
* still catch it and complain. The masking trick does make the hash
- * noticably faster for short strings (like English words).
+ * noticeably faster for short strings (like English words).
*/
#ifndef VALGRIND
@@ -499,7 +499,7 @@ void jenkins_hashlittle2(
* rest of the string. Every machine with memory protection I've seen
* does it on word boundaries, so is OK with this. But VALGRIND will
* still catch it and complain. The masking trick does make the hash
- * noticably faster for short strings (like English words).
+ * noticeably faster for short strings (like English words).
*/
#ifndef VALGRIND
@@ -675,7 +675,7 @@ uint32_t jenkins_hashbig( const void *key, size_t length, uint32_t initval)
* rest of the string. Every machine with memory protection I've seen
* does it on word boundaries, so is OK with this. But VALGRIND will
* still catch it and complain. The masking trick does make the hash
- * noticably faster for short strings (like English words).
+ * noticeably faster for short strings (like English words).
*/
#ifndef VALGRIND
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index a2900fb..6befd8b 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -745,7 +745,7 @@ static int next_with_matches(
return journal_file_next_entry(f, c, cp, direction, ret, offset);
/* If we have a match then we look for the next matching entry
- * wiht an offset at least one step larger */
+ * with an offset at least one step larger */
return next_for_match(j, j->level0, f, direction == DIRECTION_DOWN ? cp+1 : cp-1, direction, ret, offset);
}
diff --git a/src/shared/dbus-common.c b/src/shared/dbus-common.c
index ddb50b1..3f5ce97 100644
--- a/src/shared/dbus-common.c
+++ b/src/shared/dbus-common.c
@@ -1156,7 +1156,7 @@ DBusHandlerResult bus_exit_idle_filter(DBusConnection *bus, DBusMessage *m, void
assert(m);
assert(remain_until);
- /* Everytime we get a new message we reset out timeout */
+ /* Every time we get a new message we reset out timeout */
*remain_until = now(CLOCK_MONOTONIC) + DEFAULT_EXIT_USEC;
if (dbus_message_is_signal(m, DBUS_INTERFACE_LOCAL, "Disconnected"))
diff --git a/units/syslog.target b/units/syslog.target
index 87ac886..423fef3 100644
--- a/units/syslog.target
+++ b/units/syslog.target
@@ -15,5 +15,5 @@ Documentation=http://www.freedesktop.org/wiki/Software/systemd/syslog
# Avoid that we conflict with shutdown.target, so that we can stay
# until the very end and do not cancel shutdown.target if we should
-# hapen to be activated very late.
+# happen to be activated very late.
DefaultDependencies=no
More information about the systemd-commits
mailing list