tmextras.c

来自「PPPoE协议在Psos中的实现源代码」· C语言 代码 · 共 136 行

C
136
字号
/* syslog.c,v 1993/12/02 22:42:29 */
/************************************************************************/
/*                                                                      */
/*   MODULE: syslog.c                                                   */
/*   PRODUCT: pNA+                                                      */
/*   PURPOSE: Logging routine                                           */
/*   DATE: 10/02/93                                                     */
/*                                                                      */
/*----------------------------------------------------------------------*/
/*                                                                      */
/*              Copyright 1993, Integrated Systems Inc.                 */
/*                      ALL RIGHTS RESERVED                             */
/*                                                                      */
/*   This computer program is the property of Integrated Systems Inc.   */
/*   Santa Clara, California, U.S.A. and may not be copied              */
/*   in any form or by any means, whether in part or in whole,          */
/*   except under license expressly granted by Integrated Systems Inc.  */
/*                                                                      */
/*   All copies of this program, whether in part or in whole, and       */
/*   whether modified or not, must display this and all other           */
/*   embedded copyright and ownership notices in full.                  */
/*                                                                      */
/*----------------------------------------------------------------------*/
/*                                                                      */
/* Global Procedures:                                                   */
/*                                                                      */
/************************************************************************/

#ifndef TRACING
#define TRACING 1
#endif

#include <errno.h>
#include <stdarg.h>
#include <stdio.h>

#ifndef __TCS__
#include <tmInterrupts.h>
#else
#include <tm1/tmInterrupts.h>
#endif

#include "syslog.h"

#if 1
#include "traceppp.h"
#endif

static char *err_msg[] = 
{
   "LOG_EMERG",
   "LOG_ALERT",
   "LOG_CRIT",
   "LOG_ERR",
   "LOG_WARNING",
   "LOG_NOTICE",
   "LOG_INFO",
   "LOG_DEBUG",
};

void syslog
(
   int   pri,
   char *fmt,
   ...
)
{
#if 0
   va_list ap;

   va_start(ap, fmt);
   printf("%s: ", err_msg[pri]);
   vprintf(fmt, ap);
   putchar('\n');
   va_end(ap);
#else
   va_list  list;
   char     s [1024];
   char    *ptr = s;

   ptr += (int) sprintf (ptr, "%s: ", err_msg [pri]);

   va_start (list, fmt);
   ptr += (int) vsprintf (ptr, fmt, list);
   va_end (list);

#ifdef __TCS__
   TRACE_mem (s, ptr);
#endif
#endif
}

/************************************************************************/
/* ISRLOG : log routine used in ISR's.                                  */
/*  INPUTS:                                                             */
/* RETURNS:                                                             */
/* OUTPUTS:                                                             */
/* NOTE(S): Only use it when absolutely necessary.  This whole thing    */
/*          is executed in an isr.                                      */
/************************************************************************/
void ISRLOG
(
   int   prio,
   char *fmt,
   ...
)
{
}

void logprint
(
   void *arg,
   char *fmt,
   ...
)
{
#if 0
    va_list ap;

    va_start (ap, fmt);
    vprintf (fmt, ap);
    va_end (ap);
#endif
}

int splx
(
   int prio
)
{
   intPriority_t prev_prio;
   
   prev_prio = intSetPriority ((intPriority_t) prio);
   return (int) prev_prio;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?