Re: how to take password in kernel model...



On Mon, 5 Dec 2005, Peter T. Breuer spake:
> shiva <nikhilbhargav_nsit@xxxxxxxxxxxxx> wrote:
>> IS there a way I could use proc file system to know hte
>> filetype--application association...
>
> Yep - easy: there isn't one.

.... or at least not a stable one, and *definitely* not one the kernel
should be concerned with.

If you were completely crazy you could have something where the
kernel calls out to userspace to run file(1) over the file, perhaps
exporting the result as a synthetic xattr. But this would still be
mostly useless because apps would need modification to read your
synthetic xattr in any case, and if you're changing them to do that
you might as well change them to call file(1) themselves (which is
more portable, to boot).

If you need speed and don't care so much about portability to systems
with different file(1) implementations, you can have your apps link
directly to libmagic.so and use the functions in <magic.h>. That'll be
faster than *any* kernel implementation because you don't have to fork
at all. (It would even be faster than some hideous thing which
reimplements file(1) in kernel space because you're eliminating the,
admittedly tiny, system call overhead.)

This is really, really, *really* not a job for the kernel.

--
`Y'know, London's nice at this time of year. If you like your cities
freezing cold and full of surly gits.' --- David Damerell

.



Relevant Pages

  • Re: Get number of running processes
    ... If the proc file system is built in ... the kernel you can achieve this through ... is to develop with a dynamic system that has extreme late binding in ...
    (comp.unix.programmer)
  • Re: how to change osrelease?
    ... > I am new to the world of unix programming. ... > i see sysctl as one option but the osrelease file in proc file system ... Recompile kernel and add extra_version, like the kernel on my box ...
    (comp.os.linux.setup)
  • Re: Get number of running processes
    ... If the proc file system is built in ... the kernel you can achieve this through ... opendir and readdir. ...
    (comp.unix.programmer)
  • Re: posix_spawnp never fails
    ... this routine? ... posix_spawnpisn't a kernel call: ... The child process now has no way to communicate with the parent, ... you are welcome to write a kernel implementation of posix_spawnp, ...
    (comp.os.linux.development.apps)
  • [DISCUSS] Making system calls more portable.
    ... using headers from version_1 of the kernel, and then install another version of the kernel or a ... the portability then we can avoid this approach or improve this approach. ... Invoke a system call using its name. ... Mail has the best spam protection around ...
    (Linux-Kernel)