beginner question on do_page_fault function and COW

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);
} 



		
___________________________________ 
Nuovo Yahoo! Messenger: E' molto più divertente: Audibles, Avatar, Webcam, Giochi, Rubrica? Scaricalo ora! 
http://it.messenger.yahoo.it

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux