All of lore.kernel.org
 help / color / mirror / Atom feed
* Create proc entry under /proc/sys/kernel
@ 2008-06-08  8:00 RuoMu Hu
  2008-06-08 11:18 ` Alexey Dobriyan
  0 siblings, 1 reply; 5+ messages in thread
From: RuoMu Hu @ 2008-06-08  8:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-serial, linux-net

Hi!

Is it possible to create a proc entry under /proc/sys/kernel directly by 
create_proc_read_entry in the way shown below?

test_pde = create_proc_read_entry("/proc/sys/kernel/test", 0, NULL,
                                    test_read_proc, NULL);
if (test_pde == NULL) {
    printk(KERN_ERR "Failed to create the test proc file.\n");
    return -ENOMEM;
}

I'm using this in my kernel module but create_proc_read_entry always 
returns fail, while there's no problem creating proc entries directly 
under /proc.  The kernel source I'm building my kernel module against is 
2.6.25.4.

Any idea?


Thanks
Romu

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Create proc entry under /proc/sys/kernel
@ 2008-06-08  9:28 RuoMu Hu
  0 siblings, 0 replies; 5+ messages in thread
From: RuoMu Hu @ 2008-06-08  9:28 UTC (permalink / raw)
  To: linux-newbie

Hi!

Is it possible to create a proc entry under /proc/sys/kernel directly by
create_proc_read_entry in the way shown below?

test_pde = create_proc_read_entry("/proc/sys/kernel/test", 0, NULL,
                                    test_read_proc, NULL);
if (test_pde == NULL) {
    printk(KERN_ERR "Failed to create the test proc file.\n");
    return -ENOMEM;
}

I'm using this in my kernel module but create_proc_read_entry always
returns fail, while there's no problem creating proc entries directly
under /proc.  The kernel source I'm building my kernel module against is
2.6.25.4.

Any idea?


Thanks
Romu

--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Create proc entry under /proc/sys/kernel
  2008-06-08  8:00 Create proc entry under /proc/sys/kernel RuoMu Hu
@ 2008-06-08 11:18 ` Alexey Dobriyan
  2008-06-08 17:44   ` RuoMu Hu
  0 siblings, 1 reply; 5+ messages in thread
From: Alexey Dobriyan @ 2008-06-08 11:18 UTC (permalink / raw)
  To: RuoMu Hu; +Cc: linux-kernel

On Sun, Jun 08, 2008 at 04:00:57PM +0800, RuoMu Hu wrote:
> Is it possible to create a proc entry under /proc/sys/kernel directly by 
> create_proc_read_entry in the way shown below?

No longer.

> test_pde = create_proc_read_entry("/proc/sys/kernel/test", 0, NULL,
>                                    test_read_proc, NULL);
> if (test_pde == NULL) {
>    printk(KERN_ERR "Failed to create the test proc file.\n");
>    return -ENOMEM;
> }
>
> I'm using this in my kernel module but create_proc_read_entry always 
> returns fail, while there's no problem creating proc entries directly under 
> /proc.  The kernel source I'm building my kernel module against is 
> 2.6.25.4.

Use register_sysctl_table() for sysctls.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Create proc entry under /proc/sys/kernel
  2008-06-08 11:18 ` Alexey Dobriyan
@ 2008-06-08 17:44   ` RuoMu Hu
  2008-06-08 17:59     ` Alexey Dobriyan
  0 siblings, 1 reply; 5+ messages in thread
From: RuoMu Hu @ 2008-06-08 17:44 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: linux-kernel

Alexey Dobriyan wrote:
> On Sun, Jun 08, 2008 at 04:00:57PM +0800, RuoMu Hu wrote:
>   
>> Is it possible to create a proc entry under /proc/sys/kernel directly by 
>> create_proc_read_entry in the way shown below?
>>     
>
> No longer.
>
>   
>> test_pde = create_proc_read_entry("/proc/sys/kernel/test", 0, NULL,
>>                                    test_read_proc, NULL);
>> if (test_pde == NULL) {
>>    printk(KERN_ERR "Failed to create the test proc file.\n");
>>    return -ENOMEM;
>> }
>>
>> I'm using this in my kernel module but create_proc_read_entry always 
>> returns fail, while there's no problem creating proc entries directly under 
>> /proc.  The kernel source I'm building my kernel module against is 
>> 2.6.25.4.
>>     
>
> Use register_sysctl_table() for sysctls.
>   

Thank you for your hint, it really helped me.

Another question: Is it possible to add an entry under /proc/sys/kernel 
by register_sysctl_table() without modifying kernel source (adding an 
entry to the kern_table[] array in kernel/sysctl.c)?

Best regards,
Romu

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Create proc entry under /proc/sys/kernel
  2008-06-08 17:44   ` RuoMu Hu
@ 2008-06-08 17:59     ` Alexey Dobriyan
  0 siblings, 0 replies; 5+ messages in thread
From: Alexey Dobriyan @ 2008-06-08 17:59 UTC (permalink / raw)
  To: RuoMu Hu; +Cc: linux-kernel

On Mon, Jun 09, 2008 at 01:44:57AM +0800, RuoMu Hu wrote:
> Alexey Dobriyan wrote:
>> On Sun, Jun 08, 2008 at 04:00:57PM +0800, RuoMu Hu wrote:
>>   
>>> Is it possible to create a proc entry under /proc/sys/kernel directly by 
>>> create_proc_read_entry in the way shown below?
>>>     
>>
>> No longer.
>>
>>   
>>> test_pde = create_proc_read_entry("/proc/sys/kernel/test", 0, NULL,
>>>                                    test_read_proc, NULL);
>>> if (test_pde == NULL) {
>>>    printk(KERN_ERR "Failed to create the test proc file.\n");
>>>    return -ENOMEM;
>>> }
>>>
>>> I'm using this in my kernel module but create_proc_read_entry always 
>>> returns fail, while there's no problem creating proc entries directly 
>>> under /proc.  The kernel source I'm building my kernel module against is 
>>> 2.6.25.4.
>>>     
>>
>> Use register_sysctl_table() for sysctls.
>>   
>
> Thank you for your hint, it really helped me.
>
> Another question: Is it possible to add an entry under /proc/sys/kernel by 
> register_sysctl_table() without modifying kernel source (adding an entry to 
> the kern_table[] array in kernel/sysctl.c)?

Yes.

grep for register_sysctl_table and you'll see how.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-06-08 18:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-08  8:00 Create proc entry under /proc/sys/kernel RuoMu Hu
2008-06-08 11:18 ` Alexey Dobriyan
2008-06-08 17:44   ` RuoMu Hu
2008-06-08 17:59     ` Alexey Dobriyan
  -- strict thread matches above, loose matches on Subject: below --
2008-06-08  9:28 RuoMu Hu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.