pluswu commented on issue #1335:
URL: https://github.com/apache/incubator-brpc/issues/1335#issuecomment-767322555


   最小可复现代码
   
   #include <gflags/gflags.h>
   #include <brpc/channel.h>
   #include <brpc/server.h>
   
   #include <sys/stat.h>
   #include <sys/types.h>
   #include <sys/utsname.h>
   #include "linux/limits.h"
   
   #include <signal.h>
   void make_daemon()
   {
        pid_t pid;
   
        pid = fork() ;
   
        if (pid != 0)
                exit(0);
   
        setsid();
   
        signal(SIGINT,  SIG_IGN);
        signal(SIGHUP,  SIG_IGN);
        signal(SIGQUIT, SIG_IGN);
        signal(SIGPIPE, SIG_IGN);
        signal(SIGTTOU, SIG_IGN);
        signal(SIGTTIN, SIG_IGN);
        signal(SIGCHLD, SIG_IGN);
        signal(SIGTERM, SIG_IGN);
        signal(SIGHUP,  SIG_IGN);
   
        pid = fork() ;
   
        if (pid != 0)
                exit(0);
   
        umask(0);
   }
   
   int main()
   {
       make_daemon();
       brpc::StartDummyServerAt(8080);
       while (true)
       {
           sleep(1);
       }
       return 0;
   }


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to