added --uid and --gid options and code integrated with twistd.