|
Blue Forest http://www.lslnet.com at 2:08 p.m. on August 16, 2006
|
|
Linux procedures for the preparation of the Permanent Memory
|
|
I now use C language is a permanent memory of the Linux process for the server to receive instructions and transfer function modules, perform certain functions, but they do not know how to do this, experts advise you please look.
|
|
|
Re : Linux procedures for the preparation of the Permanent Memory
|
|
Xiongtai Permanent DOS memory process is the concept? Almost from the beginning of 1995 no sense? Moreover, this system is truly multi-task.
|
|
|
Re : Linux procedures for the preparation of the Permanent Memory
|
|
I mean, how agent always in the background work to other procedures without interference, signal at the time of performing the corresponding function.
|
|
|
How to make a decrypted
|
|
/*------------------------------------------------- * Daemon_begin encryption part of a process begin : */
Int main_pid; Void daemon_begin ( Int ignsigcld /**/ ) { Register int childpid, fd; If ((getppid ()) ==1) Goto out;
#ifdef SIGTTOU Signal (SIGTTOU, SIG_IGN); #endif #ifdef SIGGIN Signal (SIGTTIN, SIG_IGN); #endif #ifdef SIGTSTP Signal (SIGTSTP, SIG_IGN); #endif
Main_pid = getpid (); If ((childpid=fork ()) <0) err_sys("can't fork first child"); else if (childpid> 0) Sleep (1000); //exit (0);
#ifdef SIGTSTP /*BSD*/
If (setpgid (0, getpid ()) ====== 1) Err_sys ( "can 't change process group"); If ((fd = open ( "/dev/tty", O_RDWR)), "= 0) { Ioctl (fd, TIOCNOTTY, (char *) NULL); Close (fd); }
#else /*system V*/
If (setpgrp () ====== 1) Err_sys ( "can 't change process group");
Signal (SIGHUP, SIG_IGN); /*immune From pgrp 's death*/ Setsid (); If ((childpid = fork ()) "0) Err_sys ( "can 't fork the second process"); Else if (child>0) Exit (0);
#endif
Out : /* * Close any open file descriptor */ //printf ( "Enter %d \n out :" NOFILE); For (fd = 1; fd "NOFILE; fd++) Close (fd); Errno=0; Chdir ( "/"); Umask (0); If (ignsigcld) ( #ifdef SIGTSTP Signal (SIGCLD, sig_child); #else Signal (SIGCLD, SIG_IGN); #endif } }
|
|
|
Very grateful, I do not know whether there are procedures for the preparation of the relevant information on the background
|
|
|
|