aix getpgid fails when called from parent and parent and child have different session

aix - getpgid fails with EPERM when called from parent process and the parent and child have different session (man page also states this) 
Fix is to create a new process group and have same session.
yeah but what you want to say is that if it raises ESRCH that is fine, or if it returns != 0 that is fine.  you don't have to emulate the linux behavior and throw an exception just to ignore it and succeed.