Linux Kernel Module - Creating proc file - proc_root undeclared error

Zach picture Zach · Mar 28, 2010 · Viewed 10.6k times · Source

I copy and paste code from this URL for creating and reading/writing a proc file using a kernel module and get the error that proc_root is undeclared. This same example is on a few sites so I assume it works. Any ideas why I'd get this error? Does my makefile need something different. Below is my makefile as well:

Example code for a basic proc file creation (direct copy and paste to get initial test done): http://tldp.org/LDP/lkmpg/2.6/html/lkmpg.html#AEN769

Makefile I'm using:

obj-m    := counter.o

KDIR    := /MY/LINUX/SRC

PWD    := $(shell pwd)

default:
 $(MAKE) ARCH=um -C $(KDIR) SUBDIRS=$(PWD) modules

Answer

ephemient picture ephemient · Mar 28, 2010

That example is out of date. Under the current kernel API, pass NULL for the root of procfs.

Also, instead of create_proc_entry, you should use proc_create() with a proper const struct file_operations *.