First, get your own copy of the kernel source from the server (note that your working directory is on the local disk, whereas the original source tree is on a mounted read-only partition):
[root@localhost ~]# cd /usr/src/redhat.FC6/BUILD [root@localhost ~]# cp -R /usr/src/redhat/BUILD/kernel-2.6.18/ .You can now carry on with the project, starting at Phase 1.
WARNING!!! You should keep a copy of your modifications at the end of your session and delete the your working kernel to protect your work.
The stub is defined in a header file (suspend.h) below,
which is included in the user space program (it is located in
/usr/include/linux directory.
/* * User space suspend header file * */ /* header files */ #include <linux/unistd.h> #include <errno.h>
#define __NR_suspend 260
/* stub function for the suspend systen call, it takes no argument */ _syscall0(void, suspend);Partial
entry.S file:
/* * linux/arch/i386/entry.S * * Copyright (C) 1991, 1992 Linus Torvalds */ ... .long SYMBOL_NAME(sys_suspend) /* 260 */The (kernel) function
suspend() is defined as follows:
#include <linux/suspend.h> /* for local stuff. This is *not*
the header file above. This file
is located in:
/usr/src/linux-x.yy.zz-t/include/linux */
...
/* suspend system call function */
asmlinkage void sys_suspend()
{
...
}
And the new system call can be used in a user program as follows:
#include <linux/suspend.h>
/* main */
int main()
{
...
printf("I am the %d. child\n", i + 1);
/* suspend the child process */
suspend();
printf("I am the %d. suspended child\n", i + 1);
...
|
|
Copyright ©
Dr. Rasit Eskicioglu
Last update: |