On Wed, Mar 21, 2001 at 04:31:31PM +0100, Giscard Wépiwé wrote: # Hallo everybody, # As it seems to be, proc_register und proc_unregister # are obsolete in kernel 2.4.x to create and delete a # /proc file entry. # Could someone tell me, what is the new alternative to # do it? # Thanks already for the help. hi ! below is code snippet (!typo proof :) that reguisters/unregisters proc entry MY_PROC_ENTRY_NAME right under /proc dir. hope that helps. rgds, Denis. //===================================================== #include <linux/kernel.h> #include <linux/proc_fs.h> #include <asm/uaccess.h> #define MY_PROC_ENTRY_NAME "my_proc_entry" struct proc_dir_entry *my_proc_entry=NULL; static ssize_t ip_prof_output( struct file *file, char *buf, size_t len, loff_t *offset) { /* ... implement output from proc entry here ... */ return N; /* returns number of output bytes */ } static ssize_t ip_prof_input( struct file *file, const char *buf, size_t len, loff_t *offset) { /* ... implemetnt input into proc entry here ... */ return N; /* returns number of input bytes */ } int my_proc_entry_open(struct inode *inode, struct file *file) { return 0; } int my_proc_entry_close(struct inode *inode, struct file *file){ return 0; } static int my_proc_entry_permission( struct inode *inode, int op) { /* allow supeuser access only. doesn't really matter. */ if(op==4 || (op==2 && current->euid==0)) return 0; return -EACCES; } static struct file_operations my_proc_entry_fops = { read: my_proc_entry_output, write: my_proc_entry_input, open: my_proc_entry_open, release:my_proc_entry_close, }; static struct inode_operations my_proc_entry_iops = { permission: my_proc_entry_permission }; int start_my_proc_entry(void) { my_proc_file = create_proc_entry(MY_PROC_ENTRY_NAME, S_IFREG | S_IRUGO | S_IWUSR, &proc_root); if ( !my_proc_file ) return -ENOMEM; my_proc_entry->proc_fops = &my_proc_entry_fops; ip_prof->proc_iops = &my_proc_entry_iops; return 0; } int stop_my_proc_entry(void) { printk("my_proc_entry: terminating.\n"); remove_proc_entry(MY_PROC_ENTRY_NAME, &proc_root); return 0; } //============================================================== -- ("\''/").__..-''"`-. . denis.karpov@necsom.com `9_ 9 ) `-. ( ).`-._.`) Necsom Oy (_Y_.)' ._ ) `._`. " -.-' +358 (0)40 502 0931 _..`-'_..-_/ /-'_.' (l)-'' ((i).' ((!.' *** 42.7 percent of all statistics are made up on the spot. *** - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org