Blame Esm/ib/src/linux/log/common/vslog.c

Packit 857059
/* BEGIN_ICS_COPYRIGHT5 ****************************************
Packit 857059
Packit 857059
Copyright (c) 2018, Intel Corporation
Packit 857059
Packit 857059
Redistribution and use in source and binary forms, with or without
Packit 857059
modification, are permitted provided that the following conditions are met:
Packit 857059
Packit 857059
    * Redistributions of source code must retain the above copyright notice,
Packit 857059
      this list of conditions and the following disclaimer.
Packit 857059
    * Redistributions in binary form must reproduce the above copyright
Packit 857059
      notice, this list of conditions and the following disclaimer in the
Packit 857059
      documentation and/or other materials provided with the distribution.
Packit 857059
    * Neither the name of Intel Corporation nor the names of its contributors
Packit 857059
      may be used to endorse or promote products derived from this software
Packit 857059
      without specific prior written permission.
Packit 857059
Packit 857059
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Packit 857059
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit 857059
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Packit 857059
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
Packit 857059
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit 857059
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Packit 857059
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Packit 857059
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Packit 857059
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit 857059
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 857059
Packit 857059
 * ** END_ICS_COPYRIGHT5   ****************************************/
Packit 857059
Packit 857059
#include <stdio.h>
Packit 857059
#include <stdlib.h>
Packit 857059
#include <unistd.h>
Packit 857059
#include <stdarg.h>
Packit 857059
#include <string.h>
Packit 857059
#include <signal.h>
Packit 857059
#include <errno.h>
Packit 857059
#include "sys/file.h"
Packit 857059
#include <time.h>
Packit 857059
#include <sys/time.h>
Packit 857059
#include <pthread.h>
Packit 857059
#include <syslog.h>
Packit 857059
#include <sys/stat.h>
Packit 857059
Packit 857059
#include <limits.h>
Packit 857059
#include "ib_types.h"
Packit 857059
#include "ib_status.h"
Packit 857059
#include "cs_g.h"
Packit 857059
#include "cs_log.h"
Packit 857059
#include "vslog_l.h"
Packit 857059
Packit 857059
Packit 857059
uint32_t		log_to_console = 0;
Packit 857059
Packit 857059
int				logMode = 0;
Packit 857059
uint32_t		logLevel=1;	// just used for show_masks option
Packit 857059
FILE            *log_file = NULL;
Packit 857059
int 			output_fd = -1;
Packit 857059
Packit 857059
#define MAX_SYSLOG_NAME 64
Packit 857059
char vs_log_syslog_name[MAX_SYSLOG_NAME + 1] = "opafm";
Packit 857059
uint32_t        syslog_facility = LOG_LOCAL6;
Packit 857059
Packit 857059
int             vs_log_initialized;
Packit 857059
Packit 857059
#define	min(a,b) (((a)<(b))?(a):(b))
Packit 857059
Packit 857059
void vs_log_set_log_mode(int mode)
Packit 857059
{
Packit 857059
	logMode = mode;
Packit 857059
}
Packit 857059
Packit 857059
int 
Packit 857059
vs_log_get_syslog_level(uint32_t sev)
Packit 857059
{
Packit 857059
	switch(sev) {
Packit 857059
	 case VS_LOG_NONE:			return LOG_INFO;
Packit 857059
	 case VS_LOG_FATAL:			return LOG_CRIT;
Packit 857059
	 case VS_LOG_CSM_ERROR:		return LOG_ERR;
Packit 857059
	 case VS_LOG_CSM_WARN:		return LOG_WARNING;
Packit 857059
	 case VS_LOG_CSM_NOTICE:	return LOG_NOTICE;
Packit 857059
	 case VS_LOG_CSM_INFO:		return LOG_INFO;
Packit 857059
	 case VS_LOG_ERROR:			return LOG_ERR;
Packit 857059
	 case VS_LOG_WARN:			return LOG_WARNING;
Packit 857059
	 case VS_LOG_NOTICE:		return LOG_NOTICE;
Packit 857059
	 case VS_LOG_INFINI_INFO:	return LOG_INFO;
Packit 857059
	 case VS_LOG_INFO:			return LOG_DEBUG;
Packit 857059
	 case VS_LOG_VERBOSE:		return LOG_DEBUG;
Packit 857059
	 case VS_LOG_DATA:			return LOG_DEBUG;
Packit 857059
	 case VS_LOG_DEBUG1:		return LOG_DEBUG;
Packit 857059
	 case VS_LOG_DEBUG2:		return LOG_DEBUG;
Packit 857059
	 case VS_LOG_DEBUG3:		return LOG_DEBUG;
Packit 857059
	 case VS_LOG_DEBUG4:		return LOG_DEBUG;
Packit 857059
	 case VS_LOG_ENTER:			return LOG_DEBUG;
Packit 857059
	 case VS_LOG_ARGS:			return LOG_DEBUG;
Packit 857059
	 case VS_LOG_EXIT:			return LOG_DEBUG;
Packit 857059
	 default:					return LOG_DEBUG;
Packit 857059
	}
Packit 857059
}
Packit 857059
Packit 857059
// avoid conflict with vssappl.c fprintf version used in tests
Packit 857059
#ifdef LINUX_USR_REL
Packit 857059
void
Packit 857059
vs_log_output(uint32_t sev, /* severity */
Packit 857059
		uint32_t modid,	/* optional Module id */
Packit 857059
		const char *function, /* optional function name */
Packit 857059
		const char *vf,	/* optional vFabric name */
Packit 857059
		const char *format, ...
Packit 857059
		)
Packit 857059
{
Packit 857059
	char buffer[1024];
Packit 857059
	va_list args;
Packit 857059
	FILE *f = NULL;
Packit 857059
	char vfstr[128];
Packit 857059
Packit 857059
	va_start(args, format);
Packit 857059
	(void) vsnprintf (buffer, sizeof(buffer), format, args);
Packit 857059
	va_end (args);
Packit 857059
	buffer[sizeof(buffer)-1] = '\0';
Packit 857059
Packit 857059
	if (vf)
Packit 857059
		snprintf(vfstr, sizeof(vfstr), "[VF:%s] ", vf);
Packit 857059
	else
Packit 857059
		*vfstr='\0';
Packit 857059
Packit 857059
	if(log_to_console){
Packit 857059
		f = stdout;
Packit 857059
	} else if(output_fd != -1) {
Packit 857059
		f = log_file;
Packit 857059
	}
Packit 857059
Packit 857059
	if (f) {
Packit 857059
		struct tm *locTime;
Packit 857059
		char		strTime[28];
Packit 857059
		time_t		theCalTime=0;
Packit 857059
		uint32_t	pid;
Packit 857059
		size_t		lt=0;
Packit 857059
Packit 857059
		time(&theCalTime);
Packit 857059
		locTime = localtime(&theCalTime);
Packit 857059
		if (locTime) {
Packit 857059
			lt = strftime(strTime,
Packit 857059
				sizeof(strTime),
Packit 857059
				"%a %b %d %H:%M:%S %Y",
Packit 857059
				locTime);
Packit 857059
		}
Packit 857059
		if (lt==0) {
Packit 857059
			strncpy(strTime,"(unknown)", sizeof(strTime));
Packit 857059
		}
Packit 857059
Packit 857059
		(void)vs_log_thread_pid(&pid;;
Packit 857059
Packit 857059
		fprintf(f, "%s: %s(%u): %s[%s]: %s%s%s%s%s\n",
Packit 857059
				strTime, vs_log_syslog_name, pid,
Packit 857059
				cs_log_get_sev_name(sev), vs_thread_name_str(),
Packit 857059
			   	cs_log_get_module_prefix(modid), vfstr,
Packit 857059
			   	function?function:"", function?": ":"",
Packit 857059
				buffer);
Packit 857059
		if (! sev || (sev & NONDEBUG_LOG_MASK))
Packit 857059
			fflush(f);
Packit 857059
	} else {
Packit 857059
		syslog(vs_log_get_syslog_level(sev), "%s[%s]: %s%s%s%s%s", 
Packit 857059
				cs_log_get_sev_name(sev), vs_thread_name_str(),
Packit 857059
			   	cs_log_get_module_prefix(modid), vfstr,
Packit 857059
			   	function?function:"", function?": ":"",
Packit 857059
				buffer);
Packit 857059
	}
Packit 857059
Packit 857059
Packit 857059
}
Packit 857059
#endif
Packit 857059
Packit 857059
/* Outputs a messages to the syslog regardless of settings */
Packit 857059
/* Also outputs to LogFile if configured */
Packit 857059
void
Packit 857059
vs_log_output_message(char *msg, int show_masks)
Packit 857059
{
Packit 857059
	if (show_masks) {
Packit 857059
		uint32_t log_masks[VIEO_LAST_MOD_ID+1];
Packit 857059
		uint32_t modid;
Packit 857059
Packit 857059
		cs_log_set_log_masks(logLevel, logMode, log_masks);
Packit 857059
		vs_log_output(VS_LOG_NONE, VIEO_NONE_MOD_ID,NULL,NULL,
Packit 857059
					"%s LogLevel: %u LogMode: %u", msg, logLevel, logMode);
Packit 857059
		for (modid=0; modid <= VIEO_LAST_MOD_ID; ++modid) {
Packit 857059
			if ( modid == VIEO_NONE_MOD_ID)
Packit 857059
				continue;
Packit 857059
			if (log_masks[modid] != cs_log_masks[modid])
Packit 857059
				vs_log_output(VS_LOG_NONE, VIEO_NONE_MOD_ID,NULL,NULL,
Packit 857059
						"%s %s_LogMask: 0x%x", msg, cs_log_get_module_name(modid), cs_log_masks[modid]);
Packit 857059
		}
Packit 857059
	} else {
Packit 857059
		vs_log_output(VS_LOG_NONE, VIEO_NONE_MOD_ID,NULL,NULL, "%s", msg);
Packit 857059
	}
Packit 857059
}
Packit 857059
Packit 857059
void
Packit 857059
vs_log_output_memory(uint32_t sev, /* severity */
Packit 857059
		uint32_t modid,	/* optional Module id */
Packit 857059
		const char *function, /* optional function name */
Packit 857059
		const char *vf,	/* optional vFabric name */
Packit 857059
		const char *prefix,
Packit 857059
		const void* addr,
Packit 857059
		uint32_t len
Packit 857059
		)
Packit 857059
{
Packit 857059
	char hex_buffer[80];
Packit 857059
	unsigned hex_offset = 0;
Packit 857059
	char char_buffer[80];
Packit 857059
	unsigned char_offset = 0;
Packit 857059
	unsigned offset;
Packit 857059
	const uint8_t *p = (uint8_t*)addr;
Packit 857059
Packit 857059
	if (! len) {
Packit 857059
		vs_log_output(sev, modid, function, vf, "%s: length is 0", prefix);
Packit 857059
		return;
Packit 857059
	}
Packit 857059
Packit 857059
	for (offset=0; offset < len; offset++ ) {
Packit 857059
		if ((offset & 15) == 0 && offset != 0 ) {
Packit 857059
			vs_log_output(sev, modid, function, vf, "%s: 0x%4.4x%s %s", prefix, offset-16, hex_buffer, char_buffer);
Packit 857059
			hex_offset = char_offset = 0;
Packit 857059
		}
Packit 857059
		hex_offset += sprintf(&hex_buffer[hex_offset], " %2.2x", p[offset]);
Packit 857059
		if (p[offset] >= ' ' && p[offset] <= '~')
Packit 857059
			char_offset += sprintf(&char_buffer[char_offset], "%c", p[offset]);
Packit 857059
		else
Packit 857059
			char_offset += sprintf(&char_buffer[char_offset], ".");
Packit 857059
	}
Packit 857059
	if (offset & 15) {
Packit 857059
		// output residual
Packit 857059
		uint32 pad = 16 - (offset & 15);
Packit 857059
		hex_offset += sprintf(&hex_buffer[hex_offset], "%*s", pad*3, "");
Packit 857059
		vs_log_output(sev, modid, function, vf, "%s: 0x%4.4x%s %s", prefix, offset&~15, hex_buffer, char_buffer);
Packit 857059
	}
Packit 857059
}
Packit 857059
Packit 857059
#if 0
Packit 857059
// --------------------------------------------------------------------
Packit 857059
// vs_log_time_get
Packit 857059
// --------------------------------------------------------------------
Packit 857059
// Return a 64 bit number of uSecs since some epoch.  This function
Packit 857059
// returns a monotonically increasing sequence.
Packit 857059
// 
Packit 857059
// INPUTS
Packit 857059
// loc Where to put the time value
Packit 857059
// 
Packit 857059
// RETURNS
Packit 857059
// VSTATUS_OK
Packit 857059
// VSTATUS_ILLPARM
Packit 857059
// --------------------------------------------------------------------
Packit 857059
Status_t
Packit 857059
vs_log_time_get(uint64_t * loc)
Packit 857059
{
Packit 857059
    struct timeval  tv;
Packit 857059
Packit 857059
    if (NULL == loc)
Packit 857059
      {
Packit 857059
	  return VSTATUS_ILLPARM;
Packit 857059
      }
Packit 857059
Packit 857059
    gettimeofday(&tv, NULL);
Packit 857059
    *loc = ((uint64_t) (tv.tv_sec) * 1000000L) + (uint64_t) tv.tv_usec;
Packit 857059
Packit 857059
    return (VSTATUS_OK);
Packit 857059
}
Packit 857059
#endif
Packit 857059
Packit 857059
Packit 857059
// --------------------------------------------------------------------
Packit 857059
// vs_log_thread_pid
Packit 857059
// --------------------------------------------------------------------
Packit 857059
// Return the PID for the current thread.
Packit 857059
// 
Packit 857059
// INPUTS
Packit 857059
// Pointer to PID
Packit 857059
// 
Packit 857059
// RETURNS
Packit 857059
// VSTATUS_OK
Packit 857059
// --------------------------------------------------------------------
Packit 857059
Status_t
Packit 857059
vs_log_thread_pid(uint32_t * pid)
Packit 857059
{
Packit 857059
Packit 857059
    if (pid == NULL)
Packit 857059
      {
Packit 857059
	  return (VSTATUS_ILLPARM);
Packit 857059
      }
Packit 857059
Packit 857059
    *pid = (uint32_t) getpid();
Packit 857059
    return (VSTATUS_OK);
Packit 857059
}
Packit 857059
Packit 857059
//--------------------------------------------------------------------
Packit 857059
// vs_fatal_error
Packit 857059
//--------------------------------------------------------------------
Packit 857059
//   This function will panic() the process and report through the trace
Packit 857059
// system a reason.  The trace log (if being used) will be preserved so
Packit 857059
// that perhaps a debugger can be connected to the system to figure out
Packit 857059
// what went wrong.
Packit 857059
//
Packit 857059
// INPUTS
Packit 857059
//      string      Pointer to string.  Truncated to 63 characters
Packit 857059
//
Packit 857059
// RETURNS
Packit 857059
//      NEVER RETURNS
Packit 857059
//--------------------------------------------------------------------
Packit 857059
void
Packit 857059
vs_fatal_error (uint8_t * string)
Packit 857059
{
Packit 857059
  	/* make sure we get an entry to syslog, */
Packit 857059
	/* just in case logging not fully initialzed */
Packit 857059
	openlog("FATAL:", (LOG_NDELAY | LOG_PID), LOG_USER);
Packit 857059
	syslog(LOG_CRIT, "%s", string);
Packit 857059
	closelog();
Packit 857059
Packit 857059
	abort();
Packit 857059
}
Packit 857059
Packit 857059
Packit 857059
#if 0
Packit 857059
/*
Packit 857059
 * vslog_time_cvt
Packit 857059
 *    Converts usec to hr:min:sec
Packit 857059
 * 
Packit 857059
 * INPUTS
Packit 857059
 * 
Packit 857059
 * RETURNS
Packit 857059
 * 
Packit 857059
 *   
Packit 857059
 */
Packit 857059
void
Packit 857059
vslog_time_cvt(uint64_t val,
Packit 857059
	       uint64_t * hh, uint64_t * mm, uint64_t * ss, uint64_t * us)
Packit 857059
{
Packit 857059
Packit 857059
    uint64_t        t,
Packit 857059
                    tmp_us = 1000000ull;
Packit 857059
Packit 857059
    *us = (val % tmp_us);
Packit 857059
    t = (val / (tmp_us));	/* get seconds */
Packit 857059
    *ss = (t % (60ull));
Packit 857059
    t = (t / 60ull);		/* get minutes */
Packit 857059
    *mm = ((t) % (60ull));
Packit 857059
    t = ((t) / (60ull));	/* get hrs */
Packit 857059
    *hh = (t % (24ull));
Packit 857059
}
Packit 857059
#endif
Packit 857059
Packit 857059
Packit 857059
/*
Packit 857059
 * vs_log_init
Packit 857059
 *
Packit 857059
 */
Packit 857059
Status_t
Packit 857059
vs_log_usr_init(void)
Packit 857059
{
Packit 857059
	if (strlen(vs_log_syslog_name) == 0)
Packit 857059
	 	sprintf(vs_log_syslog_name,"opafm");
Packit 857059
	//printf("openlog(%s, %x, %u)\n", vs_log_syslog_name, (LOG_CONS | LOG_PID), syslog_facility);
Packit 857059
	openlog(vs_log_syslog_name, (LOG_CONS | LOG_PID), syslog_facility);
Packit 857059
    vs_log_initialized = 1;
Packit 857059
    return VSTATUS_OK;
Packit 857059
}
Packit 857059
Packit 857059
/*
Packit 857059
 * vs_log_control
Packit 857059
 *    Function used to pass cmds to the logging subsystem. 
Packit 857059
 *
Packit 857059
 * INPUTS
Packit 857059
 *    cmd               Defines the action to carried out in the subsystem
Packit 857059
 *    arg1              First arg type               
Packit 857059
 *    arg2              Second arg 
Packit 857059
 *
Packit 857059
 * cmd == VS_LOG_STARTSYSLOG
Packit 857059
 *
Packit 857059
 *        arg1, arg2 and arg3 is NULL.
Packit 857059
 *
Packit 857059
 * cmd == VS_LOG_SETFACILITY
Packit 857059
 *
Packit 857059
 *        arg1 Contains facility
Packit 857059
 *        arg2 and arg3 is NULL.
Packit 857059
 *
Packit 857059
 * cmd == VS_LOG_SETMASK
Packit 857059
 *
Packit 857059
 *        arg1 Contains a new log_masks array
Packit 857059
 *        arg2 log_level
Packit 857059
 *        arg3 kernel module filter mask.
Packit 857059
 *      
Packit 857059
 * RETURNS
Packit 857059
 *      VSTATUS_OK
Packit 857059
 *      VSTATUS_BAD
Packit 857059
 */
Packit 857059
Packit 857059
Status_t
Packit 857059
vs_log_control(int cmd, void *arg1, void *arg2, void *arg3)
Packit 857059
{
Packit 857059
	Status_t status;
Packit 857059
	FILE *old_log_file, *temp_file;
Packit 857059
	int old_output_fd, temp_fd;
Packit 857059
Packit 857059
    status = VSTATUS_BAD;
Packit 857059
Packit 857059
	switch (cmd)
Packit 857059
		 {
Packit 857059
		 case VS_LOG_STARTSYSLOG:
Packit 857059
		 {
Packit 857059
			if (! vs_log_initialized)
Packit 857059
				(void) vs_log_usr_init();
Packit 857059
			if (vs_log_initialized)
Packit 857059
				status = VSTATUS_OK;
Packit 857059
			else
Packit 857059
				return VSTATUS_BAD;
Packit 857059
		 }
Packit 857059
		 break;
Packit 857059
		 case VS_LOG_SETFACILITY:
Packit 857059
		 {
Packit 857059
			syslog_facility = (uint32_t) (unint)arg1;
Packit 857059
		 }
Packit 857059
		 break;
Packit 857059
		 case VS_LOG_SETMASK:
Packit 857059
		 {
Packit 857059
Packit 857059
             if (arg1)
Packit 857059
                 memcpy(cs_log_masks, (uint32_t*)arg1, sizeof(cs_log_masks));
Packit 857059
			 logLevel = (uint32_t) (unint)arg2;
Packit 857059
			 log_to_console = (int)(unint)arg3;
Packit 857059
Packit 857059
			 status = VSTATUS_OK;
Packit 857059
		 }
Packit 857059
		 break;
Packit 857059
		 case  VS_LOG_SETOUTPUTFILE:
Packit 857059
		 {
Packit 857059
		     old_log_file = log_file;
Packit 857059
			 old_output_fd = output_fd;
Packit 857059
Packit 857059
			 if((arg1 != NULL) && (strlen(arg1) > 0))
Packit 857059
			 {
Packit 857059
                  
Packit 857059
				 temp_fd = open((char*)arg1, 
Packit 857059
                                   O_WRONLY | O_CREAT| O_APPEND,
Packit 857059
                                   S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
Packit 857059
				
Packit 857059
				 if(temp_fd == -1)
Packit 857059
				 {
Packit 857059
					 status = VSTATUS_BAD;
Packit 857059
				 }
Packit 857059
				 else
Packit 857059
				 {
Packit 857059
					status = VSTATUS_OK;
Packit 857059
					if((temp_file = fdopen(temp_fd, (void *)"a")) == NULL)
Packit 857059
					{
Packit 857059
						close(temp_fd);
Packit 857059
						temp_fd = -1;
Packit 857059
						status = VSTATUS_BAD;
Packit 857059
					}
Packit 857059
Packit 857059
Packit 857059
				 }
Packit 857059
				 if(status != VSTATUS_OK)
Packit 857059
  			     {
Packit 857059
				   	  syslog(LOG_ERR,"Failed to open output log file: %s\n",(char*)arg1);
Packit 857059
					  printf("Failed to open output log file: %s\n",(char*)arg1);
Packit 857059
Packit 857059
				 } else	
Packit 857059
				 {
Packit 857059
					FILE *tempf;
Packit 857059
				 
Packit 857059
					// Remap stdout and stderr to our logfile to catch lower level messages
Packit 857059
					tempf = freopen((char*)arg1, (void *)"a", stdout);
Packit 857059
					if (!tempf) {
Packit 857059
				   	  syslog(LOG_ERR,"Failed to redirect stdout to %s\n",(char*)arg1);
Packit 857059
					  printf("Failed to redirect stdout to %s\n",(char*)arg1);
Packit 857059
					}
Packit 857059
					tempf = freopen((char*)arg1, (void *)"a", stderr);
Packit 857059
					if (!tempf) {
Packit 857059
				   	  syslog(LOG_ERR,"Failed to redirect stderr to %s\n",(char*)arg1);
Packit 857059
					  printf("Failed to redirect stderr to %s\n",(char*)arg1);
Packit 857059
					}
Packit 857059
Packit 857059
					output_fd = temp_fd;
Packit 857059
Packit 857059
					log_file = temp_file;
Packit 857059
					if(old_output_fd != -1)
Packit 857059
					{
Packit 857059
						if(old_log_file != NULL)
Packit 857059
							fclose(log_file);
Packit 857059
						log_file = NULL;
Packit 857059
						close(old_output_fd);
Packit 857059
						old_output_fd = -1;
Packit 857059
					}
Packit 857059
				 }
Packit 857059
			}
Packit 857059
Packit 857059
		 }
Packit 857059
		 break;
Packit 857059
		 case VS_LOG_SETSYSLOGNAME:
Packit 857059
		 {
Packit 857059
			if((arg1 != NULL) && (strlen((char*)arg1) <= MAX_SYSLOG_NAME))
Packit 857059
			{
Packit 857059
				snprintf(vs_log_syslog_name, sizeof(vs_log_syslog_name), "%s",(char *)arg1);
Packit 857059
			}
Packit 857059
			else
Packit 857059
			{
Packit 857059
				return VSTATUS_BAD;
Packit 857059
			}
Packit 857059
		 }
Packit 857059
		 break;
Packit 857059
		 default:
Packit 857059
		 return VSTATUS_BAD;
Packit 857059
		 }
Packit 857059
    return status;
Packit 857059
}
Packit 857059
Packit 857059
FILE* vs_log_get_logfile_fd(void)
Packit 857059
{
Packit 857059
	return log_file;
Packit 857059
}
Packit 857059