summaryrefslogtreecommitdiff
path: root/quickexec/johns/README
blob: 1af84dc2cce73e5e73ae0a3d271e3dbeef2dbcee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

Compile qinit_srv.c to qinit_srv as usual
Compile your applications at shared libraries instead of as executables:
    eg: gcc test.c -o test.so -shared
Make a symbolic link from qinit_srv to the name of the application:
    eg: ln -s qinit_srv test
Now make sure 'test' (The symlink) and 'test.so' (the shared library version of the app) are together.
When you run ./test it will load test.so and run it just like you were running the application for real.
There will be a qinit_srv process created the first time you run a program this way.

How it works:

qinit_srv checks to see if there is already a server, if not it starts as a server which runs in the background as a deamon.
If it's a server it loads all the libraries listed in the library.lst file.
It then waits for signals to be sent to it which tell it to fork itself and load shared libraries and run them.
If it decides it's not the server, it sends a signal to the server to run the given command.
The server then executes a shared object file of whatever name the original process is invoked as (argv[0], the symlink trick)
The other process waits until the forked server finishes and signals the original process that it as finished and to return