httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bart Wiegmans <bartwiegm...@gmail.com>
Subject Re: modules-dev Digest 14 Jun 2012 19:58:49 -0000 Issue 639
Date Fri, 15 Jun 2012 08:58:21 GMT
Hello!

Thank you for your responses.
The reason I asked is because I'm actually embedding parrot, which is
a virtual machine, into apache. The end goal is to run applications
much in the same fashion as PHP and mod_perl (and maybe mod_lua, I
don't know anything about that).
The design of this module to do as much as possible in the virtual
machine itself; i.e. setting up configuration variables, compiling the
script to be run, etc. This keeps the module small and manageable.
Thus, I need to fetch a 'loader script' to run before the actual
/requested/ script is run. It was the on-filesystem location of this
loader script which was my problem. The solution is actually a really
simple one, namely to insert the installation directory (which apxs
knows) into a configuration header as a constant, and include this
file. This tells me exactly where the loader scripts are to be
installed.
For those who cannot install their loader bytecodes in this directory
(me, during testing) I have added an configuration option. It would
have been a nice detail to know that the return value of configuration
callback would be interpreted as an error message unless NULL. Obvious
in hindsight, but it caused me a nasty segfault.

Kind regards and once again thanks for your time,
Bart Wiegmans


2012/6/14  <modules-dev-digest-help@httpd.apache.org>:
>
> modules-dev Digest 14 Jun 2012 19:58:49 -0000 Issue 639
>
> Topics (messages 3910 through 3917)
>
> Get the directory of the module
>        3910 by: Bart Wiegmans
>        3911 by: Ben Noordhuis
>        3912 by: Jerry Stuckle
>        3913 by: Joshua Marantz
>        3914 by: Jerry Stuckle
>        3915 by: Joshua Marantz
>        3916 by: Jerry Stuckle
>        3917 by: Joshua Marantz
>
> Administrivia:
>
> ---------------------------------------------------------------------
> To post to the list, e-mail: modules-dev@httpd.apache.org
> To unsubscribe, e-mail: modules-dev-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: modules-dev-digest-help@httpd.apache.org
>
> ----------------------------------------------------------------------
>
>
> Hello everybody,
>
> For a project I'm doing, I need to install a few bytecode files
> alongside my module. I was planning on placing them in the modules
> directory but I realised that at runtime I do not know where that is.
> What is more, that directory may (and will, as a matter of fact) vary
> during installation and testing. But most importantly, the server
> knows where the module is kept as it specified by LoadModule.
>
> So in short, how can I determine the directory of my module at runtime?
> Kind regards,
> Bart Wiegmans
>
>
> On Mon, Jun 11, 2012 at 10:10 PM, Bart Wiegmans <bartwiegmans@gmail.com> wrote:
>> Hello everybody,
>>
>> For a project I'm doing, I need to install a few bytecode files
>> alongside my module. I was planning on placing them in the modules
>> directory but I realised that at runtime I do not know where that is.
>> What is more, that directory may (and will, as a matter of fact) vary
>> during installation and testing. But most importantly, the server
>> knows where the module is kept as it specified by LoadModule.
>>
>> So in short, how can I determine the directory of my module at runtime?
>
> You can't, the file path is internal to mod_so.c. I don't think it
> even stores it.
>
>
>
>
> On 6/11/2012 5:49 PM, Ben Noordhuis wrote:
>>
>> On Mon, Jun 11, 2012 at 10:10 PM, Bart Wiegmans<bartwiegmans@gmail.com>  wrote:
>>>
>>> Hello everybody,
>>>
>>> For a project I'm doing, I need to install a few bytecode files
>>> alongside my module. I was planning on placing them in the modules
>>> directory but I realised that at runtime I do not know where that is.
>>> What is more, that directory may (and will, as a matter of fact) vary
>>> during installation and testing. But most importantly, the server
>>> knows where the module is kept as it specified by LoadModule.
>>>
>>> So in short, how can I determine the directory of my module at runtime?
>>
>>
>> You can't, the file path is internal to mod_so.c. I don't think it
>> even stores it.
>>
>>
>
> In addition, there is no guarantee you have write access to that directory.
>
>
> I think he wants to write bytecodes during module installation when he will
> have write access.
>
> During installation can you also write a .conf template showing your module
> where the bytecodes are?
>
> Josh
>  On Jun 11, 2012 7:29 PM, "Jerry Stuckle" <jerry@smartechhomes.com> wrote:
>
>>
>>
>> On 6/11/2012 5:49 PM, Ben Noordhuis wrote:
>>
>>> On Mon, Jun 11, 2012 at 10:10 PM, Bart Wiegmans<bartwiegmans@gmail.**com<bartwiegmans@gmail.com>>
>>>  wrote:
>>>
>>>> Hello everybody,
>>>>
>>>> For a project I'm doing, I need to install a few bytecode files
>>>> alongside my module. I was planning on placing them in the modules
>>>> directory but I realised that at runtime I do not know where that is.
>>>> What is more, that directory may (and will, as a matter of fact) vary
>>>> during installation and testing. But most importantly, the server
>>>> knows where the module is kept as it specified by LoadModule.
>>>>
>>>> So in short, how can I determine the directory of my module at runtime?
>>>>
>>>
>>> You can't, the file path is internal to mod_so.c. I don't think it
>>> even stores it.
>>>
>>>
>>>
>> In addition, there is no guarantee you have write access to that directory.
>>
>
> In that case he should also be able to tell his module where the files are.
>
> On 6/11/2012 7:40 PM, Joshua Marantz wrote:
>>
>> I think he wants to write bytecodes during module installation when he will
>> have write access.
>>
>> During installation can you also write a .conf template showing your module
>> where the bytecodes are?
>>
>> Josh
>>  On Jun 11, 2012 7:29 PM, "Jerry Stuckle"<jerry@smartechhomes.com>  wrote:
>>
>>>
>>>
>>> On 6/11/2012 5:49 PM, Ben Noordhuis wrote:
>>>
>>>> On Mon, Jun 11, 2012 at 10:10 PM, Bart Wiegmans<bartwiegmans@gmail.**com<bartwiegmans@gmail.com>>
>>>>  wrote:
>>>>
>>>>> Hello everybody,
>>>>>
>>>>> For a project I'm doing, I need to install a few bytecode files
>>>>> alongside my module. I was planning on placing them in the modules
>>>>> directory but I realised that at runtime I do not know where that is.
>>>>> What is more, that directory may (and will, as a matter of fact) vary
>>>>> during installation and testing. But most importantly, the server
>>>>> knows where the module is kept as it specified by LoadModule.
>>>>>
>>>>> So in short, how can I determine the directory of my module at runtime?
>>>>>
>>>>
>>>> You can't, the file path is internal to mod_so.c. I don't think it
>>>> even stores it.
>>>>
>>>>
>>>>
>>> In addition, there is no guarantee you have write access to that directory.
>>>
>>
>
>
> I think we are saying the same thing, right?  To "tell his module" I'm
> suggesting he write the path where the .so is installed into his .conf file
> so that he can get the path at runtime.
>
> On Mon, Jun 11, 2012 at 8:02 PM, Jerry Stuckle <jerry@smartechhomes.com>wrote:
>
>> In that case he should also be able to tell his module where the files are.
>>
>>
>> On 6/11/2012 7:40 PM, Joshua Marantz wrote:
>>
>>> I think he wants to write bytecodes during module installation when he
>>> will
>>> have write access.
>>>
>>> During installation can you also write a .conf template showing your
>>> module
>>> where the bytecodes are?
>>>
>>> Josh
>>>  On Jun 11, 2012 7:29 PM, "Jerry Stuckle"<jerry@smartechhomes.**com<jerry@smartechhomes.com>>
>>>  wrote:
>>>
>>>
>>>>
>>>> On 6/11/2012 5:49 PM, Ben Noordhuis wrote:
>>>>
>>>>  On Mon, Jun 11, 2012 at 10:10 PM, Bart Wiegmans<bartwiegmans@gmail.****
>>>>> com<bartwiegmans@gmail.com>>
>>>>>
>>>>>  wrote:
>>>>>
>>>>>  Hello everybody,
>>>>>>
>>>>>> For a project I'm doing, I need to install a few bytecode files
>>>>>> alongside my module. I was planning on placing them in the modules
>>>>>> directory but I realised that at runtime I do not know where that
is.
>>>>>> What is more, that directory may (and will, as a matter of fact)
vary
>>>>>> during installation and testing. But most importantly, the server
>>>>>> knows where the module is kept as it specified by LoadModule.
>>>>>>
>>>>>> So in short, how can I determine the directory of my module at runtime?
>>>>>>
>>>>>>
>>>>> You can't, the file path is internal to mod_so.c. I don't think it
>>>>> even stores it.
>>>>>
>>>>>
>>>>>
>>>>>  In addition, there is no guarantee you have write access to that
>>>> directory.
>>>>
>>>>
>>>
>
> But how would he know where his .conf file is installed?
>
> If he could find where his .conf file is installed, he could just put the data there.
>
> On 6/11/2012 8:19 PM, Joshua Marantz wrote:
>>
>> I think we are saying the same thing, right?  To "tell his module" I'm
>> suggesting he write the path where the .so is installed into his .conf file
>> so that he can get the path at runtime.
>>
>> On Mon, Jun 11, 2012 at 8:02 PM, Jerry Stuckle<jerry@smartechhomes.com>wrote:
>>
>>> In that case he should also be able to tell his module where the files are.
>>>
>>>
>>> On 6/11/2012 7:40 PM, Joshua Marantz wrote:
>>>
>>>> I think he wants to write bytecodes during module installation when he
>>>> will
>>>> have write access.
>>>>
>>>> During installation can you also write a .conf template showing your
>>>> module
>>>> where the bytecodes are?
>>>>
>>>> Josh
>>>>  On Jun 11, 2012 7:29 PM, "Jerry Stuckle"<jerry@smartechhomes.**com<jerry@smartechhomes.com>>
>>>>  wrote:
>>>>
>>>>
>>>>>
>>>>> On 6/11/2012 5:49 PM, Ben Noordhuis wrote:
>>>>>
>>>>>  On Mon, Jun 11, 2012 at 10:10 PM, Bart Wiegmans<bartwiegmans@gmail.****
>>>>>>
>>>>>> com<bartwiegmans@gmail.com>>
>>>>>>
>>>>>>  wrote:
>>>>>>
>>>>>>  Hello everybody,
>>>>>>>
>>>>>>>
>>>>>>> For a project I'm doing, I need to install a few bytecode files
>>>>>>> alongside my module. I was planning on placing them in the modules
>>>>>>> directory but I realised that at runtime I do not know where
that is.
>>>>>>> What is more, that directory may (and will, as a matter of fact)
vary
>>>>>>> during installation and testing. But most importantly, the server
>>>>>>> knows where the module is kept as it specified by LoadModule.
>>>>>>>
>>>>>>> So in short, how can I determine the directory of my module at
runtime?
>>>>>>>
>>>>>>>
>>>>>> You can't, the file path is internal to mod_so.c. I don't think it
>>>>>> even stores it.
>>>>>>
>>>>>>
>>>>>>
>>>>>>  In addition, there is no guarantee you have write access to that
>>>>>
>>>>> directory.
>>>>>
>>>>>
>>>>
>>
>
>
>
> Modules register a configuration callback called on every declared option.
> So they don't need to know where the configuration file is; they get called
> with the parsed config-file options.  See
> http://svn.apache.org/repos/asf/httpd/httpd/trunk/modules/examples/mod_example_hooks.cfunction
> cmd_example.
>
> -Josh
>

Mime
View raw message