New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install VUT headers, plus cleanups #2314
Conversation
Can you name some tools that will output the full path in the usage? |
edit: aka "apache 2" On my system:
|
Any others? I don't really like this change tbh. |
I figured you didn't like it, and I hadn't thought of other tools doing that prior to doing this change.
|
Hmm, might be a linux-only thing. I cannot see this in any of the BSDs I have access to. Most likely due to lacking __progname. EDIT: Aha: http://stackoverflow.com/questions/273691/using-progname-instead-of-argv0 |
FWIW, my preference wrt using argv[0] as the VUT.progname is to keep the existing behaviour, if anything because I don't see the benefit. |
Bugwash summary:
At this point we want to make sure it's safe to expose this API, look at all the bells and whistles (coverage, coverity, flexelint...) and avoid shipping an inappropriate interface to |
This is the kind of stuff I was thinking of, when I talked about making sure VUT was properly polished before we expose it:
|
Another observation: Functions like VUT_Error() which sometimes return (status == 0) and sometimes don't (status != 0) are generally a bad idea. Split it into VUT_Warning() which always return and VUT_Error() or VUT_Fatal() which never does. |
FYI this evening I started a tutorial in the form of a repository similar to libvmod-example: https://github.com/dridi/varnish-template It's making use of the current VUT headers from Varnish 5.1.2 (for now). |
There were only one VUT_Error() use outside vut.c with status zero (varnishstat), so I have made VUT_Error() always fatal. I'm a bit torn on the fprintf's about acquiring SHM, maybe they should only happen under some kind of verbose flag ? |
How about a |
And we could wrap the NULL check+fprintf in a |
Updated to current master (started 328 commits ago!) and ready to resume the discussion any time. |
+1 for getting this in the september release |
New elements from IRC discussions and changes since the 328 commits ago:
It wouldn't be hard to make it usable on multiple
The main problem is that |
I'd like to take a step back after further IRC discussions. First, I'm no longer in favor of making this API concurrent-able, because Not only is the API single-process oriented as shown by the use of On the other hand if someone needs to build something more involved than a single-purpose VSL consumer, they have access to the rest of This would make it a realistic target for the September release again. |
75cacbc
to
5dd0a89
Compare
Does not build in OSX.
|
That's on me, I didn't notice in the manual that |
This gives users a consistent usage/help message depending on whether they run VUTs from the PATH or from a specific location. In order to kill some of the redundancy, a VUT_InitProg macro does the $0 magic.
The API is responsible for checking that global options aren't used more than once, despite it being handled (soon) in individual VUT setups.
This is a first step away from the global VUT symbol, handled outside of VUT_Setup in preparation for the "unglobalization".
With the exception of dispatch_f that already has a dispatch_priv.
When omitted, the callback defaults to printing to stderr and exiting with the provided status.
The corresponding symbols were already in libvarnishapi since 1.5!
For out-of-tree utilities.
Hopefully for the last time I updated this pull request (rebased against latest master). The new commits are: 7dcb762 (autoconf macro) and 704e186 (release notes) I ported my template project to 5.1.2 [1] and by adding the macro to [1] Dridi/varnish-template@267f0e5 |
I just realized that the headers were deemed private, despite the fact that they were added in version 1.5 of libvarnishapi. While at it I had a quick look and polished things here and there in the VUT area.