container instance) or creating one scope unit for each container instance
via systemd's transient unit API (in case you have one container manager
that manages all instances. Either way, make sure to set `Delegate=yes` in
- it. This ensures that that the unit you created will be part of all cgroup
+ it. This ensures that the unit you created will be part of all cgroup
controllers (or at least the ones systemd understands). The latter may also
be done via `systemd-machined`'s `CreateMachine()` API. Make sure to use the
cgroup path systemd put your process in for all operations of the container.
please check `/proc/1/environ` and look for the `container=` environment
variable. Do not assume the environment variable is inherited down the process
tree. It generally is not. Hence check the environment block of PID 1, not your
-own. Note though that that file is only accessible to root. systemd hence early
+own. Note though that this file is only accessible to root. systemd hence early
on also copies the value into `/run/systemd/container`, which is readable for
everybody. However, that's a systemd-specific interface and other init systems
are unlikely to do the same.
assert(from);
assert(to);
- /* We try to use O_TMPFILE here to create the file if we can. Note that that only works if COPY_REPLACE is not
+ /* We try to use O_TMPFILE here to create the file if we can. Note that this only works if COPY_REPLACE is not
* set though as we need to use linkat() for linking the O_TMPFILE file into the file system but that system
* call can't replace existing files. Hence, if COPY_REPLACE is set we create a temporary name in the file
* system right-away and unconditionally which we then can renameat() to the right name after we completed
* ioctl can return EAGAIN in case we change the lo_offset field, if someone else is accessing the
* block device while we try to reconfigure it. This is a pretty common case, since udev might
* instantly start probing the device as soon as we attach an fd to it. Hence handle it in two ways:
- * first, let's take the BSD lock that that ensures that udev will not step in between the point in
+ * first, let's take the BSD lock to ensure that udev will not step in between the point in
* time where we attach the fd and where we reconfigure the device. Secondly, let's wait 50ms on
* EAGAIN and retry. The former should be an efficient mechanism to avoid we have to wait 50ms
* needlessly if we are just racing against udev. The latter is protection against all other cases,
BLOCK_SIGNALS(SIGCHLD);
- /* Due to the possibility of the sync operation hanging, we fork a child process and monitor the progress. If
- * the timeout lapses, the assumption is that that particular sync stalled. */
+ /* Due to the possibility of the sync operation hanging, we fork a child process and monitor
+ * the progress. If the timeout lapses, the assumption is that the particular sync stalled. */
r = asynchronous_sync(&pid);
if (r < 0) {
assert(m);
- /* Due to the possibility of a remount operation hanging, we
- * fork a child process and set a timeout. If the timeout
- * lapses, the assumption is that that particular remount
- * failed. */
+ /* Due to the possibility of a remount operation hanging, we fork a child process and set a
+ * timeout. If the timeout lapses, the assumption is that the particular remount failed. */
r = safe_fork("(sd-remount)", FORK_RESET_SIGNALS|FORK_CLOSE_ALL_FDS|FORK_LOG|FORK_REOPEN_LOG, &pid);
if (r < 0)
return r;
assert(m);
- /* Due to the possibility of a umount operation hanging, we
- * fork a child process and set a timeout. If the timeout
- * lapses, the assumption is that that particular umount
- * failed. */
+ /* Due to the possibility of a umount operation hanging, we fork a child process and set a
+ * timeout. If the timeout lapses, the assumption is that the particular umount failed. */
r = safe_fork("(sd-umount)", FORK_RESET_SIGNALS|FORK_CLOSE_ALL_FDS|FORK_LOG|FORK_REOPEN_LOG, &pid);
if (r < 0)
return r;