bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 05/14] add mach_port tests


From: Samuel Thibault
Subject: Re: [PATCH 05/14] add mach_port tests
Date: Fri, 29 Dec 2023 15:01:02 +0100
User-agent: NeoMutt/20170609 (1.8.3)

Luca Dariz, le jeu. 28 déc. 2023 20:42:52 +0100, a ecrit:
> +  mach_port_t newname = 123;

Why initializing it?

> +  err = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, 
> &newname);
> +  ASSERT_RET(err, "mach_port_allocate");
> +  err = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_PORT_SET, 
> &newname);
> +  ASSERT_RET(err, "mach_port_allocate");
> +  err = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_DEAD_NAME, 
> &newname);
> +  ASSERT_RET(err, "mach_port_allocate");

You could check that you are getting different names.

> +  err = mach_port_destroy(mach_task_self(), newname);
> +  ASSERT_RET(err, "mach_port_destroy");
> +
> +  err = mach_port_deallocate(mach_task_self(), 1002);
> +  ASSERT_RET(err, "mach_port_deallocate");
> +
> +  mach_port_urefs_t urefs;
> +  err = mach_port_get_refs(mach_task_self(), 1002, 
> MACH_PORT_RIGHT_DEAD_NAME, &urefs);
> +  ASSERT_RET(err, "mach_port_get_refs");

You could also check the references of the ports created above.

Samuel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]