LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Mobile
User Name
Password
Linux - Mobile This forum is for the discussion of all topics relating to Mobile Linux. This includes Android, Tizen, Sailfish OS, Replicant, Ubuntu Touch, webOS, and other similar projects and products.

Notices


Reply
  Search this Thread
Old 09-13-2013, 10:50 AM   #1
amitragarwal
LQ Newbie
 
Registered: Sep 2013
Posts: 2

Rep: Reputation: Disabled
Question Proc_create creates only text file??


Hi All,
I recently registered to this site but have been active listener so far . So spare me if my first question is too basic or out of line here.

In newer kernel release there is proc_create API defined to create files in proc filesystem. From the code it seems it checks if the umode_t is S_IFREG or else returns with a warning. And as per the documentation for S_IFREG, its for regular file (txt or binary).

I am trying to create binary file in proc filesystem and it works well. The problem is it adds carriage return when new line character is seen. I expect for binary file nothing should be added to the file and I should see raw binary data without any manipulation for line endings or new line. It seems somehow proc_create only generates ascii based text file. Can I create a binary file using this API? if so how, what flags I need to set.

465 struct proc_dir_entry *proc_create_data(const char *name, umode_t mode,
466 struct proc_dir_entry *parent,
467 const struct file_operations *proc_fops,
468 void *data)
469 {
470 struct proc_dir_entry *pde;
471 if ((mode & S_IFMT) == 0)
472 mode |= S_IFREG;
473
474 if (!S_ISREG(mode)) {
475 WARN_ON(1); /* use proc_mkdir() */
476 return NULL;
477 }
478

thanks

Last edited by amitragarwal; 09-13-2013 at 09:41 PM. Reason: Icon for the message
 
  


Reply



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
[SOLVED] Redirecting terminal output to text file leads to corrupted text file mariovrn Linux - Newbie 5 11-30-2011 07:21 AM
[SOLVED] Bash command to 'cut' text into another text file & modifying text. velgasius Programming 4 10-17-2011 04:55 AM
text match pipe to file then delete from original text file create new dir automatic tr1px Linux - Newbie 6 09-10-2008 09:40 PM
How to parse text file to a set text column width and output to new text file? jsstevenson Programming 12 04-23-2008 02:36 PM
LXer: Piracy creates jobs, FOSS creates opportunities LXer Syndicated Linux News 0 11-02-2006 11:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Mobile

All times are GMT -5. The time now is 06:15 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