I am writing a simple code which sets the Nproc prlimit to 0. I then try to fork a process which should generate an error. But the child is created. I tried creating multiple children and there seems to be no error message ever.
import resource,os
resource.prlimit(os.getpid(),resource.RLIMIT_NPROC,(0,0))
print(resource.getrlimit(resource.RLIMIT_NPROC))
os.fork()
os.fork()
print("a")
Output:
(0, 0)
a
a
a
a
The same thing happened when I set the limit using ulimit -u.
Is this the expected behaviour?