KernelNewbies
  • Comments
  • Immutable Page
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
  • Login

Kernel Hacking

  • Frontpage

  • Kernel Hacking

  • Kernel Documentation

  • Kernel Glossary

  • FAQ

  • Found a bug?

  • Kernel Changelog

  • Upstream Merge Guide

Projects

  • KernelJanitors

  • KernelMentors

  • KernelProjects

Community

  • Why a community?

  • Regional Kernelnewbies

  • Personal Pages

  • Upcoming Events

References

  • Mailing Lists

  • Related Sites

  • Programming Links

Wiki

  • Recent Changes

  • Site Editors

  • Side Bar

  • Tips for Editors

  • Hosted by WikiWall

Navigation

  • RecentChanges
  • FindPage
  • HelpContents
Revision 1 as of 2006-08-01 20:36:01
KernelNewbies:
  • FAQ
  • WhyWritingFilesFromKernelIsBad

Why writing files from the kernel is bad ?

The question "how to I open/read/write files from the kernel ?" is often asked on the kernelnewbies mailing list. However, the question cannot really be answered: opening, reading and writing files from within the kernel is usually a bad idea, for several reasons:

  • - it is not the role of the kernel

There are several ways to exchange informations between userspace and the kernel, and the one to use really depends on what you want to do:

  • - kernel module parameters are useful to set general configuration options for your modules - sysfs is useful to get/set attributes to devices

    - [http://lwn.net/Articles/115405/ debugfs] - [http://sosdg.org/~coywolf/lxr/source/Documentation/filesystems/relayfs.txt relayfs] - netlink sockets

Using /proc is not anymore a good idea these days, except if you want to export information related to processes.

  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01