On 07/10/2014 05:41 PM, Nathan Scott wrote:
Hmmm, OK. The only other suggestion then would be to make it a more
general, and call it "flags" (where flags can go in/out of the API).
But thats a pretty ordinary approach too, really.
Oh, or could interrupted-ness be indicated via the return code?
No, the interrupted flag is intended to be set from the calling app in
after calling the service discovery API (via signal handler, another
thread, or some similar means) in order to interrupt the process.
Anyway, you make a decision - it seems nothing here is particularly
attractive, and you're in the best position to consider all of the
approaches - go ahead, pick one and run with it.
OK. The latest incarnation features a pointer to a bit mask for boolean
global options and state, including the 'interrupted' bit and now also
the 'resolve' bit. For non-boolean global options, we're back to using a
string argument. The name of the function is
__pmDiscoverServicesWithOptions. I think it best describes the
enhancement compared to the existing pmDiscoverServices(1).
The commits below (brolley/dev in pcpfans) contain the changes. They
also temporarily disable the -t or --timeout option pending a proper
re-implementation.
Dave
-------------------------------------
commit 44e6d0f80e41d24c5c054e0b39e30114bd5c83be
Author: Dave Brolley <brolley@xxxxxxxxxx>
Date: Fri Jul 11 15:26:36 2014 -0400
Don't catch SIGALRM in pmfind.c
commit 6531827861ac520ca041a8344b8a39feba4a111d
Author: Dave Brolley <brolley@xxxxxxxxxx>
Date: Fri Jul 11 15:14:54 2014 -0400
Latest service discovery with options API attempt.
Revert back to a string based API for non-boolean global options.
Pointer to a bit mask of boolean options and state, including
PM_SERVICE_DISCOVERY_INTERRUPTED
PM_SERVICE_DISCOVERY_RESOLVE.
This pointer may be NULL to indicate no flags are set.
This commit temporarily disables the global timeout option (-t,
--timeout).
|