I have a 6-core system and I would like to change the affinity of all processes to restrict them to use only the first four cores. I know what I'm doing, and I'll use the last two cores for a special purpose. I created a new init script under /etc/init.d/affty and here is its contents:

The linked one shows there was a problem, but I think that could be fixed with applet = basename_c(argv[1]); instead of applet = basename_c(service); which would allow the use of service = realpath(argv[1], NULL);.