|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [XEN PATCH 2/2] tools/lsevtchn: Use evtchn port upper bound for evtchn enumeration
On 11.04.2024 17:24, Matthew Barnes wrote:
> --- a/tools/xcutils/lsevtchn.c
> +++ b/tools/xcutils/lsevtchn.c
> @@ -11,6 +11,7 @@ int main(int argc, char **argv)
> xc_interface *xch;
> int domid, port, rc;
> xc_evtchn_status_t status;
> + xc_domaininfo_t info;
>
> domid = (argc > 1) ? strtol(argv[1], NULL, 10) : 0;
>
> @@ -18,13 +19,16 @@ int main(int argc, char **argv)
> if ( !xch )
> errx(1, "failed to open control interface");
>
> - for ( port = 0; ; port++ )
> + if ( xc_domain_getinfo_single(xch, domid, &info) < 0 )
> + errx(1, "failed to fetch domain info");
This being backed by a domctl will make things fail when run on a DomU,
which aiui is supposed to be a valid environment to run lsevtchn in
(to obtain information just for the local domain). Imo instead of trying
to figure out the highest valid port number (which at least in principle
may even be dynamic, and hence the value returned by be stale by the
time it is being used), the loop below needs to continue until receiving
a specific indicator (special error code most likely).
Jan
> + for ( port = 0; port <= info.highest_evtchn_port; port++ )
> {
> status.dom = domid;
> status.port = port;
> rc = xc_evtchn_status(xch, &status);
> if ( rc < 0 )
> - break;
> + continue;
>
> if ( status.status == EVTCHNSTAT_closed )
> continue;
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |