Merge pull request #28032 from poettering/mumumµ

deal with µ unicode ambiguities
This commit is contained in:
Lennart Poettering
2023-06-14 14:00:10 +02:00
committed by GitHub
34 changed files with 64 additions and 60 deletions

View File

@@ -563,4 +563,4 @@ resources back to the OS kernel, making them available for other components of
the OS.
@TRIMMED_BYTES@ of memory were returned to the OS, which took @TRIMMED_USEC@
micro-seconds (µs).
micro-seconds (μs).

View File

@@ -556,7 +556,7 @@
<varlistentry>
<term><varname>systemd.clock-usec=</varname></term>
<listitem><para>Takes a decimal, numeric timestamp in µs since January 1st 1970, 00:00am, to set the
<listitem><para>Takes a decimal, numeric timestamp in μs since January 1st 1970, 00:00am, to set the
system clock to. The system time is set to the specified timestamp early during boot. It is not
propagated to the hardware clock (RTC).</para></listitem>
</varlistentry>

View File

@@ -37,7 +37,7 @@
unit and job objects or directly convert a unit name or job identifier to a bus path of the corresponding
D-Bus object.</para>
<para>Properties exposing time values are usually encoded in microseconds (µs) on the bus, even if
<para>Properties exposing time values are usually encoded in microseconds (μs) on the bus, even if
their corresponding settings in the unit files are in seconds.</para>
<para>PID 1 uses <ulink url="https://www.freedesktop.org/software/polkit/docs/latest/">polkit</ulink> to

View File

@@ -66,7 +66,7 @@
<constant>POLLIN</constant>, <constant>POLLOUT</constant>, … events, or negative on error.
</para>
<para><function>sd_bus_get_timeout()</function> returns the <emphasis>absolute</emphasis> time-out in µs,
<para><function>sd_bus_get_timeout()</function> returns the <emphasis>absolute</emphasis> time-out in μs,
from which the relative time-out to pass to <function>poll()</function> (or a similar call) can be
derived, when waiting for events on the specified bus connection. The returned timeout may be zero, in
which case a subsequent I/O polling call should be invoked in non-blocking mode. The returned timeout may

View File

@@ -47,7 +47,7 @@
indicating that no work is pending on the connection. Internally, this call invokes <citerefentry
project='man-pages'><refentrytitle>ppoll</refentrytitle><manvolnum>2</manvolnum></citerefentry>, to wait for I/O on
the bus connection. If the <parameter>timeout_usec</parameter> parameter is specified, the call will block at most
for the specified amount of time in µs. Pass <constant>UINT64_MAX</constant> to permit it to sleep
for the specified amount of time in μs. Pass <constant>UINT64_MAX</constant> to permit it to sleep
indefinitely.</para>
<para>After each invocation of <function>sd_bus_wait()</function> the <function>sd_bus_process()</function> call

View File

@@ -113,14 +113,14 @@
<constant>CLOCK_REALTIME_ALARM</constant>, or <constant>CLOCK_BOOTTIME_ALARM</constant>. See
<citerefentry><refentrytitle>timerfd_create</refentrytitle><manvolnum>2</manvolnum></citerefentry> for details
regarding the various types of clocks. The <parameter>usec</parameter> parameter specifies the earliest time, in
microseconds (µs), relative to the clock's epoch, when the timer shall be triggered. If a time already in the past
microseconds (μs), relative to the clock's epoch, when the timer shall be triggered. If a time already in the past
is specified (including <constant>0</constant>), this timer source "fires" immediately and is ready to be
dispatched. If the parameter is specified as <constant>UINT64_MAX</constant> the timer event will never elapse,
which may be used as an alternative to explicitly disabling a timer event source with
<citerefentry><refentrytitle>sd_event_source_set_enabled</refentrytitle><manvolnum>3</manvolnum></citerefentry>. The
<parameter>accuracy</parameter> parameter specifies an additional accuracy value in µs specifying how much the
timer event may be delayed. Use <constant>0</constant> to select the default accuracy (250ms). Use 1µs for maximum
accuracy. Consider specifying 60000000µs (1min) or larger for long-running events that may be delayed
<parameter>accuracy</parameter> parameter specifies an additional accuracy value in μs specifying how much the
timer event may be delayed. Use <constant>0</constant> to select the default accuracy (250ms). Use 1μs for maximum
accuracy. Consider specifying 60000000μs (1min) or larger for long-running events that may be delayed
substantially. Picking higher accuracy values allows the system to coalesce timer events more aggressively,
improving power efficiency.</para>
@@ -203,14 +203,14 @@
<para><function>sd_event_source_get_time()</function> retrieves the configured time value of an event
source created previously with <function>sd_event_add_time()</function> or
<function>sd_event_add_time_relative()</function>. It takes the event source object and a pointer to a
variable to store the time in, relative to the selected clock's epoch, in µs. The returned value is
variable to store the time in, relative to the selected clock's epoch, in μs. The returned value is
relative to the epoch, even if the event source was created with a relative time via
<function>sd_event_add_time_relative()</function>.</para>
<para><function>sd_event_source_set_time()</function> changes the time of an event source created
previously with <function>sd_event_add_time()</function> or
<function>sd_event_add_time_relative()</function>. It takes the event source object and a time relative
to the selected clock's epoch, in µs.</para>
to the selected clock's epoch, in μs.</para>
<para><function>sd_event_source_set_time_relative()</function> is similar to
<function>sd_event_source_set_time()</function>, but takes a time relative to the current time of the
@@ -220,12 +220,12 @@
retrieves the configured accuracy value of an event source
created previously with <function>sd_event_add_time()</function>. It
takes the event source object and a pointer to a variable to store
the accuracy in. The accuracy is specified in µs.</para>
the accuracy in. The accuracy is specified in μs.</para>
<para><function>sd_event_source_set_time_accuracy()</function>
changes the configured accuracy of a timer event source created
previously with <function>sd_event_add_time()</function>. It takes
the event source object and accuracy, in µs.</para>
the event source object and accuracy, in μs.</para>
<para><function>sd_event_source_get_time_clock()</function>
retrieves the configured clock of an event source created

View File

@@ -53,7 +53,7 @@
<citerefentry project='man-pages'><refentrytitle>clock_gettime</refentrytitle><manvolnum>2</manvolnum></citerefentry>
for more information on the various clocks. The retrieved
timestamp is stored in the <parameter>usec</parameter> parameter,
in µs since the clock's epoch. If this function is invoked before
in μs since the clock's epoch. If this function is invoked before
the first event loop iteration, the current time is returned, as
reported by <function>clock_gettime()</function>. To distinguish
this case from a regular invocation the return value will be

View File

@@ -168,7 +168,7 @@
is no timeout to wait for this will fill in <constant>(uint64_t)
-1</constant> instead. Note that <function>poll()</function> takes
a relative timeout in milliseconds rather than an absolute timeout
in microseconds. To convert the absolute 'µs' timeout into
in microseconds. To convert the absolute 'μs' timeout into
relative 'ms', use code like the following:</para>
<programlisting>uint64_t t;

View File

@@ -140,7 +140,7 @@
<term>MONOTONIC_USEC=…</term>
<listitem><para>A field carrying the monotonic timestamp (as per
<constant>CLOCK_MONOTONIC</constant>) formatted in decimal in µs, when the notification message was
<constant>CLOCK_MONOTONIC</constant>) formatted in decimal in μs, when the notification message was
generated by the client. This is typically used in combination with <literal>RELOADING=1</literal>,
to allow the service manager to properly synchronize reload cycles. See
<citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>

View File

@@ -65,7 +65,7 @@
<para>If the <parameter>usec</parameter> parameter is non-<constant>NULL</constant>,
<function>sd_watchdog_enabled()</function> will write the timeout
in µs for the watchdog logic to it.</para>
in μs for the watchdog logic to it.</para>
<para>To enable service supervision with the watchdog logic, use
<varname>WatchdogSec=</varname> in service files. See
@@ -122,7 +122,7 @@
<listitem><para>Set by the system manager for supervised
process for which watchdog support is enabled, and contains
the watchdog timeout in µs. See above for
the watchdog timeout in μs. See above for
details.</para></listitem>
</varlistentry>
</variablelist>

View File

@@ -2464,7 +2464,7 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
<variablelist>
<varlistentry>
<term><option>us</option></term>
<term><option>µs</option></term>
<term><option>μs</option></term>
<listitem><para><literal>Day YYYY-MM-DD HH:MM:SS.UUUUUU TZ</literal></para></listitem>
</varlistentry>
</variablelist>
@@ -2479,7 +2479,7 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
<variablelist>
<varlistentry>
<term><option>us+utc</option></term>
<term><option>µs+utc</option></term>
<term><option>μs+utc</option></term>
<listitem><para><literal>Day YYYY-MM-DD HH:MM:SS.UUUUUU UTC</literal></para></listitem>
</varlistentry>
</variablelist>

View File

@@ -192,7 +192,7 @@ COREDUMP_FILENAME=/var/lib/systemd/coredump/core.Web….552351.….zst
<varlistentry>
<term><varname>COREDUMP_TIMESTAMP=</varname></term>
<listitem><para>The time of the crash as reported by the kernel (in µs since the epoch).</para>
<listitem><para>The time of the crash as reported by the kernel (in μs since the epoch).</para>
</listitem>
</varlistentry>

View File

@@ -1362,7 +1362,7 @@ DeviceAllow=/dev/loop-control
<varname>DefaultMemoryPressureThresholdSec=</varname> setting in
<citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
(which in turn defaults to 200ms). The specified value expects a time unit such as
<literal>ms</literal> or <literal>µs</literal>, see
<literal>ms</literal> or <literal>μs</literal>, see
<citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry> for
details on the permitted syntax.</para></listitem>
</varlistentry>

View File

@@ -236,7 +236,7 @@
<literal>MONOTONIC_USEC=</literal> set to the current monotonic time
(i.e. <constant>CLOCK_MONOTONIC</constant> in
<citerefentry><refentrytitle>clock_gettime</refentrytitle><manvolnum>2</manvolnum></citerefentry>)
in µs, formatted as decimal string. Once reloading is complete another notification message must
in μs, formatted as decimal string. Once reloading is complete another notification message must
be sent, containing <literal>READY=1</literal>. Using this service type and implementing this
reload protocol is an efficient alternative to providing an <varname>ExecReload=</varname>
command for reloading of the service's configuration.</para></listitem>

View File

@@ -715,7 +715,7 @@
<varlistentry>
<term><varname>Timestamping=</varname></term>
<listitem><para>Takes one of <literal>off</literal>, <literal>us</literal> (alias:
<literal>usec</literal>, <literal>µs</literal>) or <literal>ns</literal> (alias:
<literal>usec</literal>, <literal>μs</literal>) or <literal>ns</literal> (alias:
<literal>nsec</literal>). This controls the <constant>SO_TIMESTAMP</constant> or
<constant>SO_TIMESTAMPNS</constant> socket options, and enables whether ingress network traffic shall
carry timestamping metadata. Defaults to <option>off</option>.</para></listitem>

View File

@@ -47,7 +47,7 @@
understood:</para>
<itemizedlist>
<listitem><para>usec, us, µs</para></listitem>
<listitem><para>usec, us, μs</para></listitem>
<listitem><para>msec, ms</para></listitem>
<listitem><para>seconds, second, sec, s</para></listitem>
<listitem><para>minutes, minute, min, m</para></listitem>

View File

@@ -375,7 +375,7 @@
<row>
<entry><literal>@t</literal></entry>
<entry>File modification time</entry>
<entry>Formatted decimal integer, µs since UNIX epoch Jan 1st 1970</entry>
<entry>Formatted decimal integer, μs since UNIX epoch Jan 1st 1970</entry>
<entry>Only relevant if target resource type chosen as <constant>regular-file</constant></entry>
</row>

View File

@@ -165,7 +165,7 @@ int procfs_cpu_get_usage(nsec_t *ret) {
(uint64_t) irq_ticks + (uint64_t) softirq_ticks +
(uint64_t) guest_ticks + (uint64_t) guest_nice_ticks;
/* Let's reduce this fraction before we apply it to avoid overflows when converting this to µsec */
/* Let's reduce this fraction before we apply it to avoid overflows when converting this to μsec */
gcd = calc_gcd64(NSEC_PER_SEC, ticks_per_second);
a = (uint64_t) NSEC_PER_SEC / gcd;

View File

@@ -327,7 +327,7 @@ char *format_timestamp_style(
if (l < (size_t) (1 + 1 + 1))
return NULL; /* not enough space for even the shortest of forms */
return snprintf_ok(buf, l, "@" USEC_FMT, t / USEC_PER_SEC); /* round down µs → s */
return snprintf_ok(buf, l, "@" USEC_FMT, t / USEC_PER_SEC); /* round down μs → s */
}
utc = IN_SET(style, TIMESTAMP_UTC, TIMESTAMP_US_UTC, TIMESTAMP_DATE);
@@ -1046,7 +1046,8 @@ static const char* extract_multiplier(const char *p, usec_t *ret) {
{ "y", USEC_PER_YEAR },
{ "usec", 1ULL },
{ "us", 1ULL },
{ "µs", 1ULL },
{ "μs", 1ULL }, /* U+03bc (aka GREEK SMALL LETTER MU) */
{ "µs", 1ULL }, /* U+b5 (aka MICRO SIGN) */
};
assert(p);
@@ -1224,7 +1225,8 @@ static const char* extract_nsec_multiplier(const char *p, nsec_t *ret) {
{ "y", NSEC_PER_YEAR },
{ "usec", NSEC_PER_USEC },
{ "us", NSEC_PER_USEC },
{ "µs", NSEC_PER_USEC },
{ "μs", NSEC_PER_USEC }, /* U+03bc (aka GREEK LETTER MU) */
{ "µs", NSEC_PER_USEC }, /* U+b5 (aka MICRO SIGN) */
{ "nsec", 1ULL },
{ "ns", 1ULL },
{ "", 1ULL }, /* default is nsec */
@@ -1701,9 +1703,9 @@ TimestampStyle timestamp_style_from_string(const char *s) {
t = (TimestampStyle) string_table_lookup(timestamp_style_table, ELEMENTSOF(timestamp_style_table), s);
if (t >= 0)
return t;
if (streq_ptr(s, "µs"))
if (STRPTR_IN_SET(s, "µs", "μs")) /* acccept both µ symbols in unicode, i.e. micro symbol + greek small letter mu. */
return TIMESTAMP_US;
if (streq_ptr(s, "µs+utc"))
if (STRPTR_IN_SET(s, "µs+utc", "μs+utc"))
return TIMESTAMP_US_UTC;
return t;
}

View File

@@ -3519,7 +3519,7 @@ SocketTimestamping socket_timestamping_from_string_harder(const char *p) {
* too. */
if (streq(p, "nsec"))
return SOCKET_TIMESTAMPING_NS;
if (STR_IN_SET(p, "usec", "µs"))
if (STR_IN_SET(p, "usec", "µs", "μs")) /* Accept both small greek letter mu + micro sign unicode codepoints */
return SOCKET_TIMESTAMPING_US;
r = parse_boolean(p);

Some files were not shown because too many files have changed in this diff Show More