set_fs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 Hello,
   I am trying to call the open function from within a kernel module.
After searching the web, I tried the following snippet:
  mm_segment_t old_fs;
  old_fs=get_fs();
  set_fs(USER_DS);
  fp=open('/etc/config.txt',O_RDONLY);
  getLine(fp,line);
  close(fp);
  set_fs(old_fs);
For some reason, the open fails and returns -1. Any ideas on what I am 
doing wrong? This is all really new to me.
thanks,
Brad 




The information contained in this message is confidential and is intended for the addressee only.  If you have received this message in error or there are any problems, please notify the sender immediately.  The unauthorized use, disclosure, copying or alteration of this message is strictly forbidden.


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux