LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-24-2008, 11:19 AM   #1
linuxdoniv
Member
 
Registered: Mar 2008
Posts: 63

Rep: Reputation: 15
Unhappy maximum size of entry in /proc


Hi,

I have a module where I write some information to /proc. With proc file size argument as 4000, I am able to write the info to /proc. But if I increase the size to 40000, trying to write more information, I get segmentation fault.

Is there any restriction on the maximum size of the file that can be written dynamically by a module onto /proc. Do I have to set some arguments
in the kernel to be able to insert a larger file in /proc.

Thanks.....
 
Old 03-24-2008, 12:26 PM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
I am not aware of any such limitation. On some machines 4096 is the page size, so you might have a subtle problem in your code with allows writing to no more than one page. Perhaps if you showed us the code, it would help us debug.
 
Old 03-24-2008, 06:46 PM   #3
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
I took a look at the code you sent via personal message. You have a statement such as the following:
Code:
return sprintf(buffer, to_be_written);
In general, you can’t do this. You have to look at how many bytes the userspace application requested (in buffer_length in your code) and to be completely correct, you also need to look at the offset.
 
Old 04-01-2008, 03:41 PM   #4
linuxdoniv
Member
 
Registered: Mar 2008
Posts: 63

Original Poster
Rep: Reputation: 15
Unhappy

Thanks for that reply.
I have another problem. It is working fine if I access the data fields in task_struct. But if I access the data fields through the pointer of task_struct structure, and log the data in /proc/process_info, then I get segmentation fault if I vim the process_info file. I tried accessing only the data fields of task_struct , it works. I don't access the data fields of task_struct but the data fields of task->mm->ANY FIELD, it does not work. I am confused about this.

Thanks for any help...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
writing a structure to the a entry in /proc linuxdoniv Programming 2 03-20-2008 07:05 AM
Maximum packet size mrtcn Linux - Security 15 08-07-2007 03:43 PM
/proc/kcore size doesn't match with physical ram size cash_05 Linux - Newbie 2 06-01-2005 01:23 PM
maximum size for crontab? JakeS Linux - Software 6 01-18-2005 05:23 PM
Maximum memory reported by /proc/meminfo in vanilla 2.4.26 kobica Linux - General 0 11-15-2004 05:49 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration