Mikhail Karpov, le mar. 03 nov. 2026 13:04:42 +0700, a ecrit: > Hello, > > On Tue, 3 Nov 2026 01:28:44 Samuel Thibault wrote: > > > > I’m not entirely certain, but perhaps it would be better not to return > the > > > result from mach_notify_new_task immediately; instead, one should first > > > check > > > for an error, and if one exists, dealloc the task and call deref on > childp. > > > > I'm not sure what you mean, do you mean to factorize the exit cases? > > Yes, I think it’s possible to factor out the program-exit scenarios into > separate elements. The question is whether any action needs to be taken > regarding task and childp if an error is returned within > mach_notify_new_task. > If no such action is required, then the code can be left as is.
The mach_notify_new_task routine has its task and parent set to task_move_t, so on success it is consumed by the mach_notify_new_task RPC and on error it is consumed by the S_mach_notify_new_task error cleanup. At that point we have already made the S_proc_child call. The mach_notify_new_task is just to update the downstream namespace. If they fail to record it, too bad for them :) Samuel
