Move "get max pid" code into platform specific area.