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