Re: Serial Port access from kernel

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

 



On Tue, Dec 25, 2001 at 12:15:12PM +0530, Chirag Kantharia wrote:
> Is there any way to access the serial port from within kernel code? I
> came across this code, while googling, which is supposedly dangerous.
> 
> > struct file *filp;
> > mm_segment_t old_fs;
> > filp = filp_open(name,flags,mode);
> > old_fs= getfs();
> > set_fs(KERNEL_DS);
> > filp->f_op->read(filp,buffer,count,&filp->f_pos);
> 
> (from: http://mail.nl.linux.org/kernelnewbies/2001-02/msg00068.html)
> 
> Morever, I don't have a filesystem in the kernel, and so I guess, this
> won't work. Is there any other way?

Sure, do it in userland. Opening and using a serial port smells like
policy, and policy should always be done in userland.


Erik

-- 
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Faculty
of Information Technology and Systems, Delft University of Technology,
PO BOX 5031, 2600 GA Delft, The Netherlands  Phone: +31-15-2783635
Fax: +31-15-2781843  Email: J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[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