On 5/9/05, Vincenzo Mallozzi <vinjunior@xxxxxxxx> wrote: > Hi all, > I've modified the do_page_fault function adding the > line > > printk(KERN_DEBUG "line added to > PAGE_FAULT!!!\n"); > > on top of it, then I've compiled the file and I've > rebooted my machine. > Now, I want to do a page fault in order to obtain the > string "line added to PAGE_FAULT!!!" in my > /var/log/debug file. > I've read that COW is handled by do_page_fault > function, so I've compiled and executed a simple > "fork" file (listed below) in which I do a fork and > then modify a global and a local variable in order to > obtain a COW. > At this point, I expect the searched string as output > but nothing seems matter. > Where I fail? > Can anyone help me? > > Vincenzo Mallozzi. > > #include <sys/types.h> > #include <unistd.h> > > int glob = 6; > char buf[] = "a write to stdout\n"; > > int main (void) > { > int var; > pid_t pid; > > var = 88; > if (write(STDOUT_FILENO, buf, sizeof(buf)-1) != > sizeof(buf)-1) > printf("write error"); > > printf("before fork\n"); > if ((pid=fork())<0) > printf("fork error"); > else if (pid=0){ > glob++; > var++; > }else{ > glob++; > var++; > sleep(2); > } > exit(0); > } > > ___________________________________ > Check the output of the dmesg command or check in the latest /var/log/messages file you should find the expected result. Also this log message will not be seen on the terminals in X. To see it in X please follow instructions mentioned in http://webs1152.im1.net/reader.pl?pgid=lkmpghello_world Regards, Ashwin -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/