:: Re: [DNG] Disabling daemon/process …
Top Page
Delete this message
Reply to this message
Author: Didier Kryn
Date:  
To: dng
Subject: Re: [DNG] Disabling daemon/process swap
Le 22/10/2025 à 17:45, Didier Kryn a écrit :
> Le 22/10/2025 à 15:44, Didier Kryn a écrit :
>>     It is possible to disable the current process' swapping
>> programmatically.
>>
>>     You would need to write a very small wrapper application which
>> would call
>>
>>     mlockall(MCL_CURRENT | MCL_FUTURE);
>>
>>     then execute your daemon, by calling execve() or a wrapper. *Do
>> not* fork another process before execve.
>>
>> --     Didier
>>
>     The following C program should do it. Let's call it "noswap.c",
> compile it: 'gcc -o noswap noswap.c',


...

    Sorry! Should have better read the documentation: it states that
memory locking is removed when executing a new program. Therefore the
method does not work; the call to mlockall() must be done by the daemon
itself, unless using artefacts like containers, which I'm not familiar
with. Anyway I could not test my program because I don't even know how
to check if memory locking is in effect.

--     Didier