mirror of
https://github.com/systemd/systemd.git
synced 2025-01-10 05:18:17 +03:00
Merge pull request #28032 from poettering/mumumµ
deal with µ unicode ambiguities
This commit is contained in:
commit
f66d040d95
@ -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).
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -91,7 +91,7 @@ enum {
|
||||
META_ARGV_UID, /* %u: as seen in the initial user namespace */
|
||||
META_ARGV_GID, /* %g: as seen in the initial user namespace */
|
||||
META_ARGV_SIGNAL, /* %s: number of signal causing dump */
|
||||
META_ARGV_TIMESTAMP, /* %t: time of dump, expressed as seconds since the Epoch (we expand this to µs granularity) */
|
||||
META_ARGV_TIMESTAMP, /* %t: time of dump, expressed as seconds since the Epoch (we expand this to μs granularity) */
|
||||
META_ARGV_RLIMIT, /* %c: core file size soft resource limit */
|
||||
META_ARGV_HOSTNAME, /* %h: hostname */
|
||||
_META_ARGV_MAX,
|
||||
@ -1205,7 +1205,7 @@ static int gather_pid_metadata_from_argv(
|
||||
case META_ARGV_TIMESTAMP:
|
||||
/* The journal fields contain the timestamp padded with six
|
||||
* zeroes, so that the kernel-supplied 1s granularity timestamps
|
||||
* becomes 1µs granularity, i.e. the granularity systemd usually
|
||||
* becomes 1μs granularity, i.e. the granularity systemd usually
|
||||
* operates in. */
|
||||
t = free_timestamp = strjoin(argv[i], "000000");
|
||||
if (!t)
|
||||
|
@ -436,7 +436,7 @@ static int setup_microhttpd_server(RemoteServer *s,
|
||||
MHD_OPTION_ARRAY, opts,
|
||||
MHD_OPTION_END);
|
||||
if (!d->daemon) {
|
||||
log_error("Failed to start µhttp daemon");
|
||||
log_error("Failed to start μhttp daemon");
|
||||
r = -EINVAL;
|
||||
goto error;
|
||||
}
|
||||
@ -446,14 +446,14 @@ static int setup_microhttpd_server(RemoteServer *s,
|
||||
|
||||
info = MHD_get_daemon_info(d->daemon, MHD_DAEMON_INFO_EPOLL_FD_LINUX_ONLY);
|
||||
if (!info) {
|
||||
log_error("µhttp returned NULL daemon info");
|
||||
log_error("μhttp returned NULL daemon info");
|
||||
r = -EOPNOTSUPP;
|
||||
goto error;
|
||||
}
|
||||
|
||||
epoll_fd = info->listen_fd;
|
||||
if (epoll_fd < 0) {
|
||||
log_error("µhttp epoll fd is invalid");
|
||||
log_error("μhttp epoll fd is invalid");
|
||||
r = -EUCLEAN;
|
||||
goto error;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ int journal_remote_get_writer(RemoteServer *s, const char *host, Writer **writer
|
||||
**********************************************************************
|
||||
**********************************************************************/
|
||||
|
||||
/* This should go away as soon as µhttpd allows state to be passed around. */
|
||||
/* This should go away as soon as μhttpd allows state to be passed around. */
|
||||
RemoteServer *journal_remote_server_global;
|
||||
|
||||
static int dispatch_raw_source_event(sd_event_source *event,
|
||||
|
@ -11,22 +11,22 @@
|
||||
* enum elements with the same name. Hence let's check for the *old* name,
|
||||
* and define the new name by the value of the old name. */
|
||||
|
||||
/* Renamed in µhttpd 0.9.51 */
|
||||
/* Renamed in μhttpd 0.9.51 */
|
||||
#ifndef MHD_USE_PIPE_FOR_SHUTDOWN
|
||||
# define MHD_USE_ITC MHD_USE_PIPE_FOR_SHUTDOWN
|
||||
#endif
|
||||
|
||||
/* Renamed in µhttpd 0.9.52 */
|
||||
/* Renamed in μhttpd 0.9.52 */
|
||||
#ifndef MHD_USE_EPOLL_LINUX_ONLY
|
||||
# define MHD_USE_EPOLL MHD_USE_EPOLL_LINUX_ONLY
|
||||
#endif
|
||||
|
||||
/* Renamed in µhttpd 0.9.52 */
|
||||
/* Renamed in μhttpd 0.9.52 */
|
||||
#ifndef MHD_USE_SSL
|
||||
# define MHD_USE_TLS MHD_USE_SSL
|
||||
#endif
|
||||
|
||||
/* Renamed in µhttpd 0.9.53 */
|
||||
/* Renamed in μhttpd 0.9.53 */
|
||||
#ifndef MHD_USE_POLL_INTERNALLY
|
||||
# define MHD_USE_POLL_INTERNAL_THREAD MHD_USE_POLL_INTERNALLY
|
||||
#endif
|
||||
@ -38,7 +38,7 @@
|
||||
# define MHD_HTTP_NOT_ACCEPTABLE MHD_HTTP_METHOD_NOT_ACCEPTABLE
|
||||
#endif
|
||||
|
||||
/* Renamed in µhttpd 0.9.74 (8c644fc1f4d498ea489add8d40a68f5d3e5899fa) */
|
||||
/* Renamed in μhttpd 0.9.74 (8c644fc1f4d498ea489add8d40a68f5d3e5899fa) */
|
||||
#ifndef MHD_HTTP_CONTENT_TOO_LARGE
|
||||
# ifdef MHD_HTTP_PAYLOAD_TOO_LARGE
|
||||
# define MHD_HTTP_CONTENT_TOO_LARGE MHD_HTTP_PAYLOAD_TOO_LARGE /* 0.9.53 or newer */
|
||||
|
@ -45,13 +45,13 @@ static int netlink_new(sd_netlink **ret) {
|
||||
* while the socket sticks around we might get confused by replies from earlier runs coming
|
||||
* in late — which is pretty likely if we'd start our sequence numbers always from 1. Hence,
|
||||
* let's start with a value based on the system clock. This should make collisions much less
|
||||
* likely (though still theoretically possible). We use a 32 bit µs counter starting at boot
|
||||
* likely (though still theoretically possible). We use a 32 bit μs counter starting at boot
|
||||
* for this (and explicitly exclude the zero, see above). This counter will wrap around after
|
||||
* a bit more than 1h, but that's hopefully OK as the kernel shouldn't take that long to
|
||||
* reply to our requests.
|
||||
*
|
||||
* We only pick the initial start value this way. For each message we simply increase the
|
||||
* sequence number by 1. This means we could enqueue 1 netlink message per µs without risking
|
||||
* sequence number by 1. This means we could enqueue 1 netlink message per μs without risking
|
||||
* collisions, which should be OK.
|
||||
*
|
||||
* Note this means the serials will be in the range 1…UINT32_MAX here.
|
||||
|
@ -2871,7 +2871,7 @@ static int method_set_reboot_to_boot_loader_menu(
|
||||
} else {
|
||||
char buf[DECIMAL_STR_MAX(uint64_t) + 1];
|
||||
|
||||
xsprintf(buf, "%" PRIu64, x); /* µs granularity */
|
||||
xsprintf(buf, "%" PRIu64, x); /* μs granularity */
|
||||
|
||||
r = write_string_file_atomic_label("/run/systemd/reboot-to-boot-loader-menu", buf);
|
||||
if (r < 0)
|
||||
|
@ -649,7 +649,7 @@ static int prepend_component(const char **p, bool usec, unsigned nesting, Calend
|
||||
if (repeat == 0)
|
||||
return -ERANGE;
|
||||
} else {
|
||||
/* If no repeat value is specified for the µs component, then let's explicitly refuse ranges
|
||||
/* If no repeat value is specified for the μs component, then let's explicitly refuse ranges
|
||||
* below 1s because our default repeat granularity is beyond that. */
|
||||
|
||||
/* Overflow check */
|
||||
|
@ -309,7 +309,7 @@ int efi_loader_get_config_timeout_one_shot(usec_t *ret) {
|
||||
return -ERANGE;
|
||||
|
||||
cache_stat = new_stat;
|
||||
*ret = cache = sec * USEC_PER_SEC; /* return in µs */
|
||||
*ret = cache = sec * USEC_PER_SEC; /* return in μs */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -298,7 +298,7 @@ int sd_pid_notifyf_with_fds(pid_t pid, int unset_environment, const int *fds, si
|
||||
/*
|
||||
Returns > 0 if synchronization with systemd succeeded. Returns < 0
|
||||
on error. Returns 0 if $NOTIFY_SOCKET was not set. Note that the
|
||||
timeout parameter of this function call takes the timeout in µs, and
|
||||
timeout parameter of this function call takes the timeout in μs, and
|
||||
will be passed to ppoll(2), hence the behaviour will be similar to
|
||||
ppoll(2). This function can be called after sending a status message
|
||||
to systemd, if one needs to synchronize against reception of the
|
||||
@ -330,7 +330,7 @@ int sd_booted(void);
|
||||
Returns > 0 if the service manager expects watchdog keep-alive
|
||||
events to be sent regularly via sd_notify(0, "WATCHDOG=1"). Returns
|
||||
0 if it does not expect this. If the usec argument is non-NULL
|
||||
returns the watchdog timeout in µs after which the service manager
|
||||
returns the watchdog timeout in μs after which the service manager
|
||||
will act on a process that has not sent a watchdog keep alive
|
||||
message. This function is useful to implement services that
|
||||
recognize automatically if they are being run under supervision of
|
||||
|
@ -22,7 +22,7 @@
|
||||
"e \\\n" \
|
||||
"f \n" \
|
||||
"g=g\\ \n" \
|
||||
"h= ąęół\\ śćńźżµ \n" \
|
||||
"h= ąęół\\ śćńźżμ \n" \
|
||||
"i=i\\"
|
||||
|
||||
#define env_file_2 \
|
||||
@ -68,7 +68,7 @@ TEST(load_env_file_1) {
|
||||
assert_se(streq(data[1], "b=bc"));
|
||||
assert_se(streq(data[2], "d=de f"));
|
||||
assert_se(streq(data[3], "g=g "));
|
||||
assert_se(streq(data[4], "h=ąęół śćńźżµ"));
|
||||
assert_se(streq(data[4], "h=ąęół śćńźżμ"));
|
||||
assert_se(streq(data[5], "i=i"));
|
||||
assert_se(data[6] == NULL);
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ TEST(benchmark_sd_id128_get_machine_app_specific) {
|
||||
|
||||
q = now(CLOCK_MONOTONIC) - t;
|
||||
|
||||
log_info("%lf µs each\n", (double) q / iterations);
|
||||
log_info("%lf μs each\n", (double) q / iterations);
|
||||
}
|
||||
|
||||
TEST(id128_at) {
|
||||
|
@ -614,7 +614,7 @@ TEST(getpid_measure) {
|
||||
(void) getpid();
|
||||
q = now(CLOCK_MONOTONIC) - t;
|
||||
|
||||
log_info(" glibc getpid(): %lf µs each\n", (double) q / iterations);
|
||||
log_info(" glibc getpid(): %lf μs each\n", (double) q / iterations);
|
||||
|
||||
iterations *= 50; /* _cached() is about 50 times faster, so we need more iterations */
|
||||
|
||||
@ -623,7 +623,7 @@ TEST(getpid_measure) {
|
||||
(void) getpid_cached();
|
||||
q = now(CLOCK_MONOTONIC) - t;
|
||||
|
||||
log_info("getpid_cached(): %lf µs each\n", (double) q / iterations);
|
||||
log_info("getpid_cached(): %lf μs each\n", (double) q / iterations);
|
||||
}
|
||||
|
||||
TEST(safe_fork) {
|
||||
|
@ -35,7 +35,9 @@ TEST(parse_sec) {
|
||||
assert_se(u == 700 * USEC_PER_MSEC);
|
||||
assert_se(parse_sec("23us", &u) >= 0);
|
||||
assert_se(u == 23);
|
||||
assert_se(parse_sec("23µs", &u) >= 0);
|
||||
assert_se(parse_sec("23μs", &u) >= 0); /* greek small letter mu */
|
||||
assert_se(u == 23);
|
||||
assert_se(parse_sec("23µs", &u) >= 0); /* micro symbol */
|
||||
assert_se(u == 23);
|
||||
assert_se(parse_sec("infinity", &u) >= 0);
|
||||
assert_se(u == USEC_INFINITY);
|
||||
|
@ -32,15 +32,15 @@ static int advance_tstamp(int fd, const struct stat *st) {
|
||||
* different timestamp accuracy: traditional fat has 2s granularity, and even ext2 and friends expose
|
||||
* different granularity depending on selected inode size during formatting! Hence, to ensure the
|
||||
* timestamp definitely is increased, here's what we'll do: we'll first try to increase the timestamp
|
||||
* by 1µs, write that and read it back. If it was updated, great. But if it was not, we'll instead
|
||||
* increase the timestamp by 10µs, and do the same, then 100µs, then 1ms, and so on, until it works,
|
||||
* by 1μs, write that and read it back. If it was updated, great. But if it was not, we'll instead
|
||||
* increase the timestamp by 10μs, and do the same, then 100μs, then 1ms, and so on, until it works,
|
||||
* or we reach 10s. If it still didn't work then, the fs is just broken and we give up. */
|
||||
|
||||
usec_t target = MAX3(now(CLOCK_REALTIME),
|
||||
TIME_EPOCH * USEC_PER_SEC,
|
||||
timespec_load(&st->st_mtim));
|
||||
|
||||
for (usec_t a = 1; a <= 10 * USEC_PER_SEC; a *= 10) { /* 1µs, 10µs, 100µs, 1ms, … 10s */
|
||||
for (usec_t a = 1; a <= 10 * USEC_PER_SEC; a *= 10) { /* 1μs, 10μs, 100μs, 1ms, … 10s */
|
||||
struct timespec ts[2];
|
||||
struct stat new_st;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user