LKML Archive on
help / color / mirror / Atom feed
From: Robert Hancock <>
To: andy <>
Subject: Re: accessing file operations directly in the kernel
Date: Thu, 06 Nov 2008 19:20:50 -0600	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <fa.8yqIDPH3sfvHfyr9YeQyeb9HG/>

andy wrote:
> Hi,
> I am dealing with an interesting situation, which I have to access a
> serial device driver
> from the kernel space. I tried to use sys_open, sys_ioctl ... but
> there is a problem
> with the file descriptors.  Now, I started using direct calls to the
> drivers functions
> driver_open, driver_ioctl... passing the *inode from user_path_walk(),
> but it doesn't
> seem that works right. This serial device is going to be used only
> from the other
> module that runs in the kernel.

For some reason this kind of question (using file operations inside the 
kernel) gets asked a lot. The short answer is that if you're asking it, 
you likely have a wrong design. It's just not the right thing to do. For 
one thing, file descriptors belong to a process, so just stealing the FD 
space from some random process is unlikely to do the right thing.

If you really need to do this, adding hooks to the serial device driver 
would seem a more logical thing to do.. but even that seems a suspicious 
design. It would be best if you explained what it is you're actually 
trying to accomplish.

       reply	other threads:[~2008-11-07  1:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fa.8yqIDPH3sfvHfyr9YeQyeb9HG/>
2008-11-07  1:20 ` Robert Hancock [this message]
2008-11-07 14:46   ` andy
2008-11-06 22:39 andy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \
    --subject='Re: accessing file operations directly in the kernel' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).