Advertisement
Advertisement
| 03.09.2008 at 10:29AM PDT, ID: 23226789 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
| Microsoft |
| Apple |
| Internet |
| Gamers |
| Digital Living |
| Virus & Spyware |
| Hardware |
| Software |
| ITPro |
| Developer |
| Storage |
| OS |
| Database |
| Security |
| Programming |
| Web Development |
| Networking |
| Other |
| Community Support |
| 03.09.2008 at 11:04AM PDT, ID: 21082092 |
| 03.09.2008 at 11:14AM PDT, ID: 21082123 |
| 03.09.2008 at 11:18AM PDT, ID: 21082132 |
| 03.09.2008 at 11:33AM PDT, ID: 21082187 |
| 03.09.2008 at 12:05PM PDT, ID: 21082277 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: |
#include <unistd.h>
#include <stdio.h>
int main()
{
pid_t pid = fork();
if(pid < 0)
{
// Oops, something wicked this way comes!
puts("Error forking");
perror(NULL);
}
else
if(0 == pid)
{
setsid(); // Detatch from parent
for(;;) sleep(0); // Keep child alive to prove it's daemonised
}
else
{
// Parent waits for child
printf("Daemon started (%d)\n", pid);
}
return 0;
}
|
| 03.09.2008 at 06:05PM PDT, ID: 21083480 |
| 03.09.2008 at 08:16PM PDT, ID: 21083956 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: |
/* demonstrate easy daemonization */
/* (c) 2005-2008, by Nopius */
#include <unistd.h>
#include <signal.h>
#include <stdlib.h>
int
main()
{
struct sigaction act;
/* some info about me */
printf("Pid: %d, Ppid: %d, Pgrp: %d, Sid: %d\n", getpid(), getppid(),
getpgrp(), getsid(0));
act.sa_handler=SIG_IGN;
sigaction(SIGHUP, &act, NULL); /* ignore termilal disconnect */
kill(getppid(), SIGKILL); /* kill the parrent */
do
{
printf("I'm a daemon\n");
sleep(5);
} while(1);
}
|