Re: [systemd-devel] Order-only mount units?

2023-01-07 Thread Andrei Borzenkov

On 07.01.2023 19:06, Norbert Lange wrote:

Hello,

Say want a service unit which mounts some stuff, then does further
steps (create some initial files, etc..).
The problem here is that it is not automatically ordered in regards to
mounts in the subdirectories or some other dependencies like
RequiresMountsFor - that would happen with a mount unit.



Add them to /etc/fstab with "noauto" and use RequiresMountsFor. Unless I 
misunderstand what you need.



So the idea would be to add a dummy mount unit with a dependency to the service.
like this:

[Unit]
Description=My dummy mount
After=realmount.service

[Mount]
# What were need to be adapted to what realmount.service does
What=*
Where=/mountpoint
Type=*
Options=remount

Any thought on this?
Without a mount unit there is alot of implicit stuff thats hard to recreate.

Another option would be that realmount.service mounts on another path,
then the dummy mount unit doing a "bind mount" or move, but I am not
sure systemd allows that?

Norbert




[systemd-devel] Order-only mount units?

2023-01-07 Thread Norbert Lange
Hello,

Say want a service unit which mounts some stuff, then does further
steps (create some initial files, etc..).
The problem here is that it is not automatically ordered in regards to
mounts in the subdirectories or some other dependencies like
RequiresMountsFor - that would happen with a mount unit.

So the idea would be to add a dummy mount unit with a dependency to the service.
like this:

[Unit]
Description=My dummy mount
After=realmount.service

[Mount]
# What were need to be adapted to what realmount.service does
What=*
Where=/mountpoint
Type=*
Options=remount

Any thought on this?
Without a mount unit there is alot of implicit stuff thats hard to recreate.

Another option would be that realmount.service mounts on another path,
then the dummy mount unit doing a "bind mount" or move, but I am not
sure systemd allows that?

Norbert


[systemd-devel] sd_bus_get_timeout returns absolute time despite what's documented

2023-01-07 Thread Stanislav Angelovič
Hi everyone,

According to sd_bus_get_timeout(3) man page, sd_bus_get_timeout() returns 
"timeout in us to pass to poll()" and it also states that "the returned 
time-value is relative".

However, in reality, this function returns an absolute time point (a-ka 
relative to the monotonic clock epoch). Hence, the returned value cannot be 
simply converted to milliseconds and given to poll(). It must first be 
subtracted from the current monotonic clock time.

I followed the documentation and had a bug in my code for some time :) Shall 
the documentation be updated to mention the necessity of conversion from 
absolute to relative? Or does sd_bus_get_timeout() have a bug and shall this 
function do the subtraction for the user and return relative time?

Thanks, kind regards,

Stanislav.