HI Daniel Marian The field addr_limit in the task_struct structure is used to define the highest virtual address that is to be considered valid; the macros get_fs and set_fs can be used to read and write the value. The limit that must be used when invoking system calls from kernel space is returned by the get_ds macro. KERNEL_DS macro is defined in uaccess.h This macro defines the max. possible virtual address for the kernel #define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF) define get_ds() (KERNEL_DS) #define get_fs() (current->addr_limit) #define set_fs(x) (current->addr_limit = (x)) So, kernel-to-kernel system calls must be wrapped by the following code: mm_segment_t fs; fs = get_fs(); /* save previous value */ set_fs (get_ds()); /* use kernel limit */ /* system calls can be invoked */ set_fs(fs); /* restore before returning to user space */] Hope this will be useful to understand the code praveen -----Original Message----- From: "Daniel Marian" <daniel.marian@wipro.com> Date: Thu, 22 Nov 2001 13:13:38 +0530 To: Linux Kernel Newbies <kernelnewbies@nl.linux.org> Subject: KERNEL_DS ? > Hello, > Before File I/O( read or write using f_op->read or f_op->write ) in > kernel space, why is it that > the following is done > oldfs = get_fs(); > set_fs(KERNEL_DS); > read /write > set_fs(oldfs); > > What is KERNEL_DS ? and what is the functionality of get_fs() and set_fs(). > > kindly bear with me for the disclaimer attachment. I am helpless about this. > Thanks a lot in advance, > kind regards, > daniel marian. > > -- _______________________________________________ Sign-up for your own FREE Personalized E-mail at Mail.com http://www.mail.com/?sr=signup 1 cent a minute calls anywhere in the U.S.! http://www.getpennytalk.com/cgi-bin/adforward.cgi?p_key=RG9853KJ&url=http://www.getpennytalk.com -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ IRC Channel: irc.openprojects.net / #kernelnewbies Web Page: http://www.kernelnewbies.org/