Mailing List Archive

Varnish subroutines return type different from 3.x
Hi All,

Is there is any reason why subroutines return type changes from "static
int" to "void" in varnish.
During compilation of VCL to C code, all the function return type as void
instead of static int before.

Can you please help if there a way I can return status code from
subroutine?.

lib/libvcc/vcc_parse.c
vcc_ParseFunction(struct vcc *tl)

{

Fh(tl, 0, "void %s(VRT_CTX);\n", sym->rname);
Fc(tl, 1, "\nvoid __match_proto__(vcl_func_t)\n");
Fc(tl, 1, "%s(VRT_CTX)\n", sym->rname);




-Prem
Re: Varnish subroutines return type different from 3.x [ In reply to ]
Hi,

Pretty sure there was a reason, possibly paving the way to have subroutines
return VCL types, some time in the future.

Can I ask you what's the goal behind this? I feel like you're headed toward
an overkill solution, and we can probably avoid that.

Cheers,

--
Guillaume Quintard

On Wed, Jan 3, 2018 at 3:37 PM, Prem Kumar <n.premkumar.me@gmail.com> wrote:

> Hi All,
>
> Is there is any reason why subroutines return type changes from "static
> int" to "void" in varnish.
> During compilation of VCL to C code, all the function return type as void
> instead of static int before.
>
> Can you please help if there a way I can return status code from
> subroutine?.
>
> lib/libvcc/vcc_parse.c
> vcc_ParseFunction(struct vcc *tl)
>
> {
>
> Fh(tl, 0, "void %s(VRT_CTX);\n", sym->rname);
> Fc(tl, 1, "\nvoid __match_proto__(vcl_func_t)\n");
> Fc(tl, 1, "%s(VRT_CTX)\n", sym->rname);
>
>
>
>
> -Prem
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
Re: Varnish subroutines return type different from 3.x [ In reply to ]
Ok.the scenario is if separate vcl recv/hash/.. subroutines configured for
2 domain URLs,first domain url will be always called and call 2nd domain.
The first domain will serve only specific url and return 0 if not. If zero
is returned I will use 2nd domain’s recv with header with index 2.
Otherwise header to 1. i would like to get return error from respective
recv/hash/.. subroutine to main handler which will set header .

-prem

On Wed, 3 Jan 2018 at 8:12 PM, Guillaume Quintard <
guillaume@varnish-software.com> wrote:

> Hi,
>
> Pretty sure there was a reason, possibly paving the way to have
> subroutines return VCL types, some time in the future.
>
> Can I ask you what's the goal behind this? I feel like you're headed
> toward an overkill solution, and we can probably avoid that.
>
> Cheers,
>
> --
> Guillaume Quintard
>
> On Wed, Jan 3, 2018 at 3:37 PM, Prem Kumar <n.premkumar.me@gmail.com>
> wrote:
>
>> Hi All,
>>
>> Is there is any reason why subroutines return type changes from "static
>> int" to "void" in varnish.
>> During compilation of VCL to C code, all the function return type as
>> void instead of static int before.
>>
>> Can you please help if there a way I can return status code from
>> subroutine?.
>>
>> lib/libvcc/vcc_parse.c
>> vcc_ParseFunction(struct vcc *tl)
>>
>> {
>>
>> Fh(tl, 0, "void %s(VRT_CTX);\n", sym->rname);
>> Fc(tl, 1, "\nvoid __match_proto__(vcl_func_t)\n");
>> Fc(tl, 1, "%s(VRT_CTX)\n", sym->rname);
>>
>>
>>
>>
>> -Prem
>>
>> _______________________________________________
>> varnish-misc mailing list
>> varnish-misc@varnish-cache.org
>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>>
>
>
Re: Varnish subroutines return type different from 3.x [ In reply to ]
Then I would use vmod_var and store a value in the subroutines and check it
once they've returned, that way you won't fuss with the C code.

--
Guillaume Quintard

On Wed, Jan 3, 2018 at 5:47 PM, Prem Kumar <n.premkumar.me@gmail.com> wrote:

> Ok.the scenario is if separate vcl recv/hash/.. subroutines configured for
> 2 domain URLs,first domain url will be always called and call 2nd domain.
> The first domain will serve only specific url and return 0 if not. If zero
> is returned I will use 2nd domain’s recv with header with index 2.
> Otherwise header to 1. i would like to get return error from respective
> recv/hash/.. subroutine to main handler which will set header .
>
> -prem
>
> On Wed, 3 Jan 2018 at 8:12 PM, Guillaume Quintard <
> guillaume@varnish-software.com> wrote:
>
>> Hi,
>>
>> Pretty sure there was a reason, possibly paving the way to have
>> subroutines return VCL types, some time in the future.
>>
>> Can I ask you what's the goal behind this? I feel like you're headed
>> toward an overkill solution, and we can probably avoid that.
>>
>> Cheers,
>>
>> --
>> Guillaume Quintard
>>
>> On Wed, Jan 3, 2018 at 3:37 PM, Prem Kumar <n.premkumar.me@gmail.com>
>> wrote:
>>
>>> Hi All,
>>>
>>> Is there is any reason why subroutines return type changes from "static
>>> int" to "void" in varnish.
>>> During compilation of VCL to C code, all the function return type as
>>> void instead of static int before.
>>>
>>> Can you please help if there a way I can return status code from
>>> subroutine?.
>>>
>>> lib/libvcc/vcc_parse.c
>>> vcc_ParseFunction(struct vcc *tl)
>>>
>>> {
>>>
>>> Fh(tl, 0, "void %s(VRT_CTX);\n", sym->rname);
>>> Fc(tl, 1, "\nvoid __match_proto__(vcl_func_t)\n");
>>> Fc(tl, 1, "%s(VRT_CTX)\n", sym->rname);
>>>
>>>
>>>
>>>
>>> -Prem
>>>
>>> _______________________________________________
>>> varnish-misc mailing list
>>> varnish-misc@varnish-cache.org
>>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>>>
>>
>>