helloweworld

openlog("vtund", LOG_PID | LOG_NDELAY | LOG_PERROR, LOG_DAEMON);

打开系统记录

 

在lib.c中定义,

void vtun_syslog (int priority, char *format, ...)
{
   static volatile sig_atomic_t in_syslog= 0;
   char buf[255];
   va_list ap;

   if(! in_syslog) {
      in_syslog = 1;
      va_start(ap, format);
      vsnprintf(buf, sizeof(buf)-1, format, ap);
      syslog(priority, "%s", buf);

      va_end(ap);

      in_syslog = 0;
   }
}

 

是一个变参函数,还是调用了syslog函数,写入系统记录。

 

后面介绍openlog syslog closelog这三个构成的一套系统日志写入接口。

扩展,对文件的操作无非是打开,写,读,关闭等。

分类:

技术点:

相关文章:

  • 2021-07-15
  • 2021-07-13
  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-12
  • 2021-11-02
  • 2022-12-23
  • 2021-05-29
  • 2022-03-09
  • 2021-10-10
  • 2021-04-28
相关资源
相似解决方案