size_t k;
/* If we shall fail when reading overly large data, then read exactly one byte more than the
- * specified size at max, since that'll tell us if there's anymore data beyond the limit*/
+ * specified size at max, since that'll tell us if there's anymore data beyond the limit. */
if (FLAGS_SET(flags, READ_FULL_FILE_FAIL_WHEN_LARGER) && n_next > size)
n_next = size + 1;
/* A special pidref value that we are using when a PID shall be automatically acquired from some surrounding
* context, for example connection peer. Much like PIDREF_NULL it will be considered unset by
- * pidref_is_set().*/
+ * pidref_is_set(). */
#define PIDREF_AUTOMATIC (const PidRef) { .pid = PID_AUTOMATIC, .fd = -EBADF }
/* Turns a pid_t into a PidRef structure on-the-fly *without* acquiring a pidfd for it. (As opposed to
int pidref_set_pid(PidRef *pidref, pid_t pid);
int pidref_set_pidstr(PidRef *pidref, const char *pid);
int pidref_set_pidfd(PidRef *pidref, int fd);
-int pidref_set_pidfd_take(PidRef *pidref, int fd); /* takes ownership of the passed pidfd on success*/
+int pidref_set_pidfd_take(PidRef *pidref, int fd); /* takes ownership of the passed pidfd on success */
int pidref_set_pidfd_consume(PidRef *pidref, int fd); /* takes ownership of the passed pidfd in both success and failure */
int pidref_set_parent(PidRef *ret);
static inline int pidref_set_self(PidRef *pidref) {
n = strv_length(*l);
position = MIN(position, n);
- /* check for overflow and increase*/
+ /* check for overflow and increase */
if (n > SIZE_MAX - 2)
return -ENOMEM;
m = n + 2;
assert(tm);
- if (tm->tm_year < 69) /* early check for negative (i.e. before 1970) time_t (Note that in some timezones the epoch is in the year 1969!)*/
+ if (tm->tm_year < 69) /* early check for negative (i.e. before 1970) time_t (Note that in some timezones the epoch is in the year 1969!) */
return -ERANGE;
if ((usec_t) tm->tm_year > CONST_MIN(USEC_INFINITY / USEC_PER_YEAR, (usec_t) TIME_T_MAX / (365U * 24U * 60U * 60U)) - 1900) /* early check for possible overrun of usec_t or time_t */
return -ERANGE;
#include "efi.h"
-/* This is the actual PE format of the section header*/
+/* This is the actual PE format of the section header */
typedef struct PeSectionHeader {
uint8_t Name[8];
uint32_t VirtualSize;
if (!p)
return -ENOMEM;
- /* This is only filled transiently (see mount_in_namespace()), should be empty or even non-existent*/
+ /* This is only filled transiently (see mount_in_namespace()), should be empty or even non-existent. */
if (rmdir(p) < 0 && errno != ENOENT)
log_unit_debug_errno(u, errno, "Unable to remove propagation dir '%s', ignoring: %m", p);
{ "virtio_rng", NULL, false, false, has_virtio_rng },
/* we want early logging to hvc consoles if possible, and make sure systemd-getty-generator
- * can rely on all consoles being probed already.*/
+ * can rely on all consoles being probed already. */
{ "virtio_console", NULL, false, false, has_virtio_console },
/* Make sure we can send sd-notify messages over vsock as early as possible. */
/* Mandatory keys must be understood by the client, otherwise the record should be discarded.
* Automatic mandatory keys must not appear in the mandatory parameter, so these are all
* supplementary. We don't understand any supplementary keys, so if the mandatory parameter
- * is present, we cannot use this record.*/
+ * is present, we cannot use this record. */
case DNS_SVC_PARAM_KEY_MANDATORY:
if (plen > 0)
return -EBADMSG;
typedef enum sd_dns_alpn_flags {
/* There isn't really an alpn reserved for Do53 service, but designated resolvers may or may not offer
* Do53 service, so we should probably have a flag to represent this capability. Unfortunately DNR
- * does not indicate the status to us.*/
+ * does not indicate the status to us. */
SD_DNS_ALPN_DO53 = 1 << 0,
/* SD_DNS_ALPN_HTTP_1_1, "http/1.1" [RFC9112] */
SD_DNS_ALPN_HTTP_2_TLS = 1 << 1, /* "h2" [RFC9113] [RFC9461] */
if (sd_id128_is_null(*seqnum_id))
*seqnum_id = f->header->seqnum_id; /* Caller has none assigned, then copy the one from the file */
else if (!sd_id128_equal(*seqnum_id, f->header->seqnum_id)) {
- /* Different seqnum IDs? We can't allow entries from multiple IDs end up in the same journal.*/
+ /* Different seqnum IDs? We can't allow entries from multiple IDs end up in the same journal. */
if (le64toh(f->header->n_entries) == 0)
f->header->seqnum_id = *seqnum_id; /* Caller has one, and file so far has no entries, then copy the one from the caller */
else
/* This is similar to if_nametoindex(), but also resolves alternative names and decimal formatted
* ifindex too. Returns ifindex, and optionally provides the main interface name and alternative
- * names.*/
+ * names. */
if (!rtnl)
rtnl = &our_rtnl;
/* Which session classes can pin our user tracking? */
#define SESSION_CLASS_PIN_USER(class) (!IN_SET((class), SESSION_MANAGER, SESSION_MANAGER_EARLY, SESSION_NONE))
-/* Which session classes decide whether system is idle? (should only cover sessions that have input, and are not idle screens themselves)*/
+/* Which session classes decide whether system is idle? (should only cover sessions that have input, and are not idle screens themselves) */
#define SESSION_CLASS_CAN_IDLE(class) (IN_SET((class), SESSION_USER, SESSION_USER_EARLY, SESSION_USER_EARLY_LIGHT, SESSION_USER_LIGHT, SESSION_GREETER))
/* Which session classes have a lock screen concept? */
/* If o->done set, call it. It sends a response, but can return
* an error in which case it expect this code to reply.
* If o->done is not set, the default action is to simply return
- * an error on failure or an empty success message on success.*/
+ * an error on failure or an empty success message on success. */
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
if (o->done)
/* If o->done set, call it. Unlike o->message case above, this
* code expect o->done to reply in all cases.
* If o->done is not set, the default action is to simply return
- * an error on failure or an empty success message on success.*/
+ * an error on failure or an empty success message on success. */
if (o->done)
(void) o->done(o, r, /* error = */ NULL);
* the first Router Advertisement was received.
*
* If the received Cur Hop Limit value is non-zero, the host SHOULD set
- * its CurHopLimit variable to the received value.*/
+ * its CurHopLimit variable to the received value. */
if (hop_limit <= 0)
return 0;
/* There are several more conditions if we can replace a group nexthop, e.g. hash threshold and
* resilience. But, currently we do not support to modify that. Let's add checks for them in the
- * future when we support to configure them.*/
+ * future when we support to configure them. */
/* When a nexthop is replaced with a blackhole nexthop, and a group nexthop has multiple nexthops
* including this nexthop, then the kernel refuses to replace the existing nexthop.
/* If StaleRetentionSec is greater than zero, the 'until' property is set to a duration
* of StaleRetentionSec from the time of TTL expiry.
* If StaleRetentionSec is zero, both the 'until' and 'until_valid' are set to the TTL duration,
- * leading to the eviction of the record once the TTL expires.*/
+ * leading to the eviction of the record once the TTL expires. */
usec_t until_valid = calculate_until_valid(rr, min_ttl, UINT32_MAX, timestamp, false);
*i = (DnsCacheItem) {
.type = DNS_CACHE_POSITIVE,
return r;
/* RFC 2181, Section 8, suggests to treat a TTL with the MSB set as a zero TTL. We avoid doing this
- * for OPT records so that all 8 bits of the extended RCODE may be used .*/
+ * for OPT records so that all 8 bits of the extended RCODE may be used. */
if (key->type != DNS_TYPE_OPT && rr->ttl & UINT32_C(0x80000000))
rr->ttl = 0;
return r;
/* The variable contains a series of individually NUL terminated UTF-16 strings. We gracefully
- * consider the final NUL byte optional (i.e. the last string may or may not end in a NUL byte).*/
+ * consider the final NUL byte optional (i.e. the last string may or may not end in a NUL byte). */
for (size_t i = 0, start = 0;; i++) {
_cleanup_free_ char *decoded = NULL;
* delimiter. To work around this limitation, mkfs.xfs allows escaping whitespace by using the /
* character (which isn't allowed in filenames and as such can be used to escape whitespace). See
* https://lore.kernel.org/linux-xfs/20230222090303.h6tujm7y32gjhgal@andromeda/T/#m8066b3e7d62a080ee7434faac4861d944e64493b
- * for more information.*/
+ * for more information. */
if (strchr(de->d_name, ' ')) {
copy = strdup(de->d_name);
if (!f->osc_sequence)
return 0;
- const char *t = startswith(f->osc_sequence, "0;"); /* Set window title OSC sequence*/
+ const char *t = startswith(f->osc_sequence, "0;"); /* Set window title OSC sequence */
if (!t)
return 0;
int sd_rtnl_message_routing_policy_rule_get_family(sd_netlink_message *m, int *ret); /* family */
int sd_rtnl_message_routing_policy_rule_set_dst_prefixlen(sd_netlink_message *m, uint8_t prefixlen); /* dst_len */
int sd_rtnl_message_routing_policy_rule_get_dst_prefixlen(sd_netlink_message *m, uint8_t *ret);
-int sd_rtnl_message_routing_policy_rule_set_src_prefixlen(sd_netlink_message *m, uint8_t prefixlen); /* src_len*/
+int sd_rtnl_message_routing_policy_rule_set_src_prefixlen(sd_netlink_message *m, uint8_t prefixlen); /* src_len */
int sd_rtnl_message_routing_policy_rule_get_src_prefixlen(sd_netlink_message *m, uint8_t *ret);
int sd_rtnl_message_routing_policy_rule_set_tos(sd_netlink_message *m, uint8_t tos); /* tos */
int sd_rtnl_message_routing_policy_rule_get_tos(sd_netlink_message *m, uint8_t *ret);
SD_VARLINK_STRING,
SD_VARLINK_OBJECT,
SD_VARLINK_ENUM_VALUE,
- _SD_VARLINK_FIELD_COMMENT, /* Not really a field, just a comment about a field*/
+ _SD_VARLINK_FIELD_COMMENT, /* Not really a field, just a comment about a field */
_SD_VARLINK_FIELD_TYPE_MAX,
_SD_VARLINK_FIELD_TYPE_INVALID = -EINVAL,
_SD_ENUM_FORCE_S64(SD_VARLINK_FIELD)
if (!terminal_is_dumb()) {
for (size_t i = 0; i <= n; i++)
- fputs("\n", stderr); /* Possibly scroll the terminal to make room (including total)*/
+ fputs("\n", stderr); /* Possibly scroll the terminal to make room (including total) */
fprintf(stderr, "\e[%zuF", n+1); /* Go back */
if (isempty(path))
return -EINVAL;
- /* assume length of pathname is not greater than 40*/
+ /* assume length of pathname is not greater than 40 */
if (strlen(path) > 40)
return -ENAMETOOLONG;
}
static int get_dir_fd(const char *dir_path, mode_t mode) {
- /* create a new directory and return its descriptor*/
+ /* create a new directory and return its descriptor */
int dir_fd = -EBADF;
assert(dir_path);
if (r < 0)
return log_error_errno(r, "Error in pathname =>: %m");
- /* Open the file within the directory for writing*/
+ /* Open the file within the directory for writing */
write_fd = RET_NERRNO(openat(dir_fd, path, O_CLOEXEC|O_WRONLY|O_TRUNC|O_CREAT, 0644));
if (write_fd < 0)
return log_error_errno(write_fd, "Error in opening directory for writing =>: %m");
- /* Write data to the file*/
+ /* Write data to the file */
count = RET_NERRNO(write(write_fd, text, strlen(text)));
if (count < 0)
return log_error_errno(count, "Error occurred while opening file for writing =>: %m");
mempool_trim(&test_mempool);
- /* free everything from the original set*/
+ /* free everything from the original set */
for (size_t i = 0; i < NN; i += 1) {
assert_se(!a[i] || a[i]->value == i);
}
TEST(streq_skip_trailing_chars) {
- /* NULL is WHITESPACE by default*/
+ /* NULL is WHITESPACE by default */
assert_se(streq_skip_trailing_chars("foo bar", "foo bar", NULL));
assert_se(streq_skip_trailing_chars("foo", "foo", NULL));
assert_se(streq_skip_trailing_chars("foo bar ", "foo bar", NULL));
/* setfont(8) silently ignores when the font can't be applied due to the vc being in
* KD_GRAPHICS. Hence we continue to accept this case however we now let the user know that the vc
- * will be initialized only partially.*/
+ * will be initialized only partially. */
r = verify_vc_display_mode(fd);
if (r < 0)
log_notice_errno(r, "Virtual console %s is not in KD_TEXT, font settings likely won't be applied.", src_vc);