how-to-update-process

Description: Process self-update example code
Status: Complete
Source: https://git.maandree.se/how-to-update-process
Latest release: None, this software is not intended to be used
License: Public domain (due to triviality)
Written in: C (ISO C99)

This is a just a simple example demonstrating how to a program re-execute into the newest version of itself (as well as how to re-execute into the same version that is running). For this to be useful you have to serialise the process's state and than deserialise it after exec(3). Serialisation is trivial, and there are several ways to hand over the serialised state, you can do it with shared memory, a fork, memfd, or an anonymous temporary file, but that is out of scope for this example.