1 /* $NetBSD: libaltq2.c,v 1.5 2002/03/05 04:11:51 itojun Exp $ */
2 /* $KAME: libaltq2.c,v 1.6 2002/02/20 10:43:35 kjc Exp $ */
4 * Copyright (C) 1997-2000
5 * Sony Computer Science Laboratories, Inc. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * this file contains functions and variables needed to use libaltq.
31 * since these are defined in rsvpd, they should be separated in order
32 * to link libaltq to rsvpd.
34 #include <sys/param.h>
36 #include <altq/altq.h>
46 /* from rsvp_main.c */
47 const char *altqconfigfile
= "/etc/altq.conf";
49 /* from rsvp_global.h */
50 int if_num
; /* number of phyints */
51 int m_debug
; /* Debug output control bits */
52 int l_debug
; /* Logging severity level */
56 /* taken from rsvp_debug.c and modified. */
58 log_write(int severity
, int syserr
, const char *format
, ...)
64 if (severity
<= l_debug
) {
66 vfprintf(stderr
, format
, ap
);
68 fprintf(stderr
, ": %s", strerror(syserr
));
69 fprintf(stderr
, "\n");
72 vsyslog(severity
, format
, ap
);
76 strlcpy(buf
, format
, sizeof(buf
));
77 strlcat(buf
, ": %m", sizeof(buf
));
78 vsyslog(severity
, buf
, ap
);