How forbid use fork() in exec() program.

Hello World!
I am writing code in C++ which have to launch another application X using exec().
I would like to set some limits on it using setrlimit etc...
My problem is that i don't know how to forbid using fork() and strlimit by application X.
How can i do it?

If you are using Solaris 10 or newer, you can use these commands to disable further forks:

  priv_set(PRIV_OFF, PRIV_EFFECTIVE, PRIV_PROC_FORK, NULL);
  priv_set(PRIV_OFF, PRIV_PERMITTED, PRIV_PROC_FORK, NULL);

On the same platforms, hard-setting resource limits can be done using projects resource controls.
resource_controls(5) - resource controls available through project database (man pages section 5: Standards, Environments, and Macros) - Sun Microsystems

exec() doesn't as much launch another application as much as replace the same process with a different one, fyi.

Expressed differently, exec launches another application but the original application doesn't survive the event. Hopefully, fork helps avoiding that issue.