home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-06-26 | 33.2 KB | 1,262 lines |
- Newsgroups: comp.sources.unix
- From: panos@cs.colorado.edu (Panos Tsirigotis)
- Subject: v26i247: xinetd-2.1.1 - inetd replacement with access control and logging, Part03/31
- Sender: unix-sources-moderator@gw.home.vix.com
- Approved: vixie@gw.home.vix.com
-
- Submitted-By: panos@cs.colorado.edu (Panos Tsirigotis)
- Posting-Number: Volume 26, Issue 247
- Archive-Name: xinetd-2.1.1/part03
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 3 (of 31)."
- # Contents: libs/src/pq/hpq.h libs/src/pset/psi.3
- # libs/src/sio/suite/README libs/src/str/ss_bmh.c
- # libs/src/str/ss_sbm.c libs/src/str/strparse.h
- # libs/src/timer/impl.h libs/src/timer/ostimer.h
- # libs/src/timer/timer.h libs/src/xlog/xlog.h xinetd/attr.h
- # xinetd/flags.c xinetd/int.h xinetd/state.h
- # Wrapped by panos@mystique on Mon Jun 21 14:51:20 1993
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'libs/src/pq/hpq.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libs/src/pq/hpq.h'\"
- else
- echo shar: Extracting \"'libs/src/pq/hpq.h'\" \(1635 characters\)
- sed "s/^X//" >'libs/src/pq/hpq.h' <<'END_OF_FILE'
- X/*
- X * (c) Copyright 1993 by Panagiotis Tsirigotis
- X * All rights reserved. The file named COPYRIGHT specifies the terms
- X * and conditions for redistribution.
- X */
- X
- X#ifndef __HPQ_H
- X#define __HPQ_H
- X
- X/*
- X * $Id: hpq.h,v 1.2 1993/04/01 02:15:32 panos Exp $
- X */
- X
- X/*
- X * Implementation of the PQ interface
- X */
- X
- X#define pq_create __hpq_create
- X#define pq_destroy __hpq_destroy
- X#define pq_insert __hpq_insert
- X#define pq_delete __hpq_delete
- X#define pq_head __hpq_head
- X#define pq_extract_head __hpq_extract_head
- X
- X/*
- X * The is_better function takes 2 arguments which are pointers to objects
- X * and returns:
- X * 1 if the first object is "better" than the second
- X * 0 otherwise
- X */
- X
- Xstruct __hpq_header
- X{
- X int (*is_better)() ;
- X int *errnop ;
- X int flags ;
- X pq_obj *objects ; /* array of objects */
- X unsigned cur_size ; /* # of objects in array */
- X unsigned max_size ; /* max # of objects that can fit in array */
- X} ;
- X
- X
- X#ifndef __ARGS
- X# ifdef PROTOTYPES
- X# define __ARGS( s ) s
- X# else
- X# define __ARGS( s ) ()
- X# endif
- X#endif
- X
- Xpq_h __hpq_create __ARGS( ( int (*func)(), int flags, int *errnop ) ) ;
- Xvoid __hpq_destroy __ARGS( ( pq_h handle ) ) ;
- Xint __hpq_insert __ARGS( ( pq_h handle, pq_obj object ) ) ;
- Xpq_obj __hpq_extract_head __ARGS( ( pq_h handle ) ) ;
- Xint __hpq_delete __ARGS( ( pq_h handle, pq_obj object ) ) ;
- X
- X#define __hpq_head( handle ) \
- X ( \
- X ((struct __hpq_header *)(handle))->cur_size \
- X ? ((struct __hpq_header *)(handle))->objects[ 0 ] \
- X : (pq_obj) 0 \
- X )
- X
- X#endif __HPQ_H
- X
- END_OF_FILE
- if test 1635 -ne `wc -c <'libs/src/pq/hpq.h'`; then
- echo shar: \"'libs/src/pq/hpq.h'\" unpacked with wrong size!
- fi
- # end of 'libs/src/pq/hpq.h'
- fi
- if test -f 'libs/src/pset/psi.3' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libs/src/pset/psi.3'\"
- else
- echo shar: Extracting \"'libs/src/pset/psi.3'\" \(1812 characters\)
- sed "s/^X//" >'libs/src/pset/psi.3' <<'END_OF_FILE'
- X.\"(c) Copyright 1992, 1993 by Panagiotis Tsirigotis
- X.\"All rights reserved. The file named COPYRIGHT specifies the terms
- X.\"and conditions for redistribution.
- X.\"
- X.\" $Id: psi.3,v 3.1 1993/03/06 18:46:38 panos Exp $
- X.TH PSET 3X "25 September 1992"
- X.SH NAME
- Xpsi_create, psi_destroy, psi_reset, psi_start, psi_next, psi_remove - pointer set iterator functions
- X.SH SYNOPSIS
- X.LP
- X.nf
- X.ft B
- X#include "pset.h"
- X.LP
- X.ft B
- Xpsi_h psi_create( pset )
- Xpset_h pset ;
- X.LP
- X.ft B
- Xvoid psi_destroy( iter )
- Xpsi_h iter ;
- X.LP
- X.ft B
- Xvoid psi_reset( iter, pset )
- Xpsi_h iter ;
- Xpset_h pset ;
- X.LP
- X.ft B
- Xvoid *psi_start( iter )
- Xpsi_h iter ;
- X.LP
- X.ft B
- Xvoid *psi_next( iter )
- Xpsi_h iter ;
- X.LP
- X.ft B
- Xvoid psi_remove( iter )
- Xpsi_h iter ;
- X.SH DESCRIPTION
- XThese functions provide a means to iterate over psets (pointer sets).
- X.LP
- X.B psi_create()
- Xcreates an iterator. The only operation that should be applied to
- Xan iterator after it is created is
- X.B psi_start().
- X.LP
- X.B psi_destroy()
- Xdestroys the iterator.
- X.LP
- X.B psi_reset()
- Xchanges the pset that is being iterated to
- X.I pset.
- X.LP
- X.B psi_start()
- Xstarts an iteration and returns the first pointer
- Xin the pointer set.
- X.LP
- X.B psi_next()
- Xreturns the next pointer in the set.
- X.LP
- X.B psi_remove()
- Xremoves the current pointer from the set. The current pointer is
- Xthe one returned most recently from either
- X.B psi_start()
- Xor
- X.B psi_next().
- X.SH "RETURN VALUES"
- X.LP
- X.B psi_create()
- Xreturns an iterator handle on success or
- X.SM NULL
- Xon failure.
- X.LP
- X.B psi_start()
- Xreturns the first pointer from the set or
- X.SM NULL
- Xif the set is empty.
- X.LP
- X.B psi_next()
- Xreturns a pointer or
- X.SM NULL
- Xif the end of the set is reached.
- X.SH WARNINGS
- X.B psi_create()
- Xis the only function in this library. The rest of the interface is macros.
- X.LP
- XThis interface may be eliminated in a future release of the
- X.I pset
- Xlibrary.
- END_OF_FILE
- if test 1812 -ne `wc -c <'libs/src/pset/psi.3'`; then
- echo shar: \"'libs/src/pset/psi.3'\" unpacked with wrong size!
- fi
- # end of 'libs/src/pset/psi.3'
- fi
- if test -f 'libs/src/sio/suite/README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libs/src/sio/suite/README'\"
- else
- echo shar: Extracting \"'libs/src/sio/suite/README'\" \(1753 characters\)
- sed "s/^X//" >'libs/src/sio/suite/README' <<'END_OF_FILE'
- X
- XThe 'testlib' script will exercise most of the functions in the SIO
- Xlibrary. It invokes the 'tester' script which does the real work.
- X'tester' is a Bourne shell script. However, it expects that the shell
- Xsupports functions and /bin/sh does not support functions on all
- Xoperating systems. Therefore, 'testlib' decides what shell to use to
- Xexecute 'tester'. On Suns, it uses /bin/sh. On DECstations, it uses
- X/usr/bin/ksh. The decision is made by checking the ARCH environment
- Xvariable.
- X
- XExercising some of the SIO functions in an automatic fashion is a
- Xdifficult task, so you will have to do it manually by visually
- Xinspecting the results of programs that exercise them. The following
- Xis a list of functions and programs testing them (with a description of
- Xthe expected behavior):
- X
- X1. Sbuftype
- X
- X PROGRAM: buftest.c
- X DESCRIPTION:
- X This program prints two groups of lines. The first group is printed
- X using line-buffering while the second group is printed using
- X full-buffering.
- X The first group of lines should appear one line at a time every
- X 3 seconds. The second group of lines should appear all lines together
- X after about 10 seconds.
- X
- X2. Stie, Suntie
- X
- X PROGRAM: tietest.c
- X DESCRIPTION:
- X This program ties stdin to stdout and then prompts for input.
- X The prompts do *not* include a NEWLINE. Since the stdout is
- X *line buffered* when connected to a terminal, the Stie call
- X is what causes the prompt to appear.
- X The first 2 prompts happen with tied stdin, stdout. For the
- X 3rd prompt, stdin is untied from stdout. This will cause
- X the prompt to appear *after* you type something and hit RETURN.
- X
- X
- X
- XPS. If you can make testing of these functions automatic, please send
- X me your code so that I can include in a future SIO distribution.
- X
- END_OF_FILE
- if test 1753 -ne `wc -c <'libs/src/sio/suite/README'`; then
- echo shar: \"'libs/src/sio/suite/README'\" unpacked with wrong size!
- fi
- # end of 'libs/src/sio/suite/README'
- fi
- if test -f 'libs/src/str/ss_bmh.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libs/src/str/ss_bmh.c'\"
- else
- echo shar: Extracting \"'libs/src/str/ss_bmh.c'\" \(1721 characters\)
- sed "s/^X//" >'libs/src/str/ss_bmh.c' <<'END_OF_FILE'
- X/*
- X * (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
- X * All rights reserved. The file named COPYRIGHT specifies the terms
- X * and conditions for redistribution.
- X */
- X
- Xstatic char RCSid[] = "$Id" ;
- X
- Xchar *malloc() ;
- X
- X#include "ss_impl.h"
- X
- XPRIVATE int bmh_setup() ;
- XPRIVATE char *bmh_match() ;
- XPRIVATE void bmh_done() ;
- X
- Xstruct ss_ops __strs_bmhops = { bmh_setup, bmh_match, bmh_done } ;
- X
- X
- XPRIVATE int bmh_setup( hp )
- X header_s *hp ;
- X{
- X register int patlen = SS_PATLEN( hp ) ;
- X register int limit = patlen - 1 ; /* patlen is > 0 */
- X register char *pattern = SS_PATTERN( hp ) ;
- X register int i ;
- X shift_int *shift ;
- X
- X shift = (shift_int *) malloc( ALPHABET_SIZE * sizeof( shift_int ) ) ;
- X if ( shift == (shift_int *)NULL )
- X return( SS_ERR ) ;
- X
- X for ( i = 0 ; i < ALPHABET_SIZE ; i++ )
- X shift[ i ] = patlen ;
- X
- X for ( i = 0 ; i < limit ; i++ )
- X shift[ (unsigned char) pattern[ i ] ] = limit - i ;
- X
- X BMH_HEADER( hp )->shift = shift ;
- X return( SS_OK ) ;
- X}
- X
- X
- XPRIVATE char *bmh_match( hp, str, len )
- X header_s *hp ;
- X register char *str ;
- X int len ;
- X{
- X register int i ;
- X int patlen = SS_PATLEN( hp ) ;
- X char *pattern = SS_PATTERN( hp ) ;
- X register char lpc = pattern[ patlen-1 ] ; /* last pattern character */
- X shift_int *shift = BMH_HEADER( hp )->shift ;
- X
- X i = patlen - 1 ;
- X while ( i < len )
- X {
- X char c = SS_MAP( hp, str[ i ] ) ;
- X
- X if ( c == lpc )
- X {
- X int j, k ;
- X
- X for ( j = patlen-1, k = i ;; )
- X {
- X if ( j == 0 )
- X return( &str[ k ] ) ;
- X j--, k-- ;
- X if ( pattern[ j ] != SS_MAP( hp, str[ k ] ) )
- X break ;
- X }
- X }
- X i += shift[ (unsigned char) c ] ;
- X }
- X return( CHAR_NULL ) ;
- X}
- X
- X
- XPRIVATE void bmh_done( hp )
- X header_s *hp ;
- X{
- X (void) free( (char *)BMH_HEADER( hp )->shift ) ;
- X}
- X
- END_OF_FILE
- if test 1721 -ne `wc -c <'libs/src/str/ss_bmh.c'`; then
- echo shar: \"'libs/src/str/ss_bmh.c'\" unpacked with wrong size!
- fi
- # end of 'libs/src/str/ss_bmh.c'
- fi
- if test -f 'libs/src/str/ss_sbm.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libs/src/str/ss_sbm.c'\"
- else
- echo shar: Extracting \"'libs/src/str/ss_sbm.c'\" \(1825 characters\)
- sed "s/^X//" >'libs/src/str/ss_sbm.c' <<'END_OF_FILE'
- X/*
- X * (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
- X * All rights reserved. The file named COPYRIGHT specifies the terms
- X * and conditions for redistribution.
- X */
- X
- Xstatic char RCSid[] = "$Id: ss_sbm.c,v 3.1 1993/06/13 02:45:45 panos Exp $" ;
- X
- Xchar *malloc() ;
- X
- X#include "ss_impl.h"
- X#include "ss_sbm.h"
- X
- XPRIVATE int sbm_setup() ;
- XPRIVATE char *sbm_match() ;
- XPRIVATE void sbm_done() ;
- X
- X
- Xstruct ss_ops __strs_sbmops = { sbm_setup, sbm_match, sbm_done } ;
- X
- X
- XPRIVATE int sbm_setup( hp )
- X header_s *hp ;
- X{
- X last_int *last_occurrence ;
- X register int i ;
- X int patlen = SS_PATLEN( hp ) ;
- X char *pattern = SS_PATTERN( hp ) ;
- X
- X last_occurrence = (last_int *) malloc( ALPHABET_SIZE * sizeof( last_int ) ) ;
- X if ( last_occurrence == (last_int *)0 )
- X return( SS_ERR ) ;
- X
- X for ( i = 0 ; i < ALPHABET_SIZE ; i++ )
- X last_occurrence[ i ] = -1 ;
- X for ( i = 0 ; i < patlen ; i++ )
- X last_occurrence[ (unsigned char) pattern[ i ] ] = i ;
- X
- X SBM_HEADER( hp )->last_occurrence = last_occurrence ;
- X return( SS_OK ) ;
- X}
- X
- X
- X
- XPRIVATE char *sbm_match( hp, str, len )
- X header_s *hp ;
- X char *str ;
- X int len ;
- X{
- X register int j ;
- X register int s = 0 ;
- X char *pattern = SS_PATTERN( hp ) ;
- X int patlen = SS_PATLEN( hp ) ;
- X last_int *last_occurrence = SBM_HEADER( hp )->last_occurrence ;
- X
- X while ( s <= len - patlen )
- X {
- X register char c ;
- X last_int lo ;
- X
- X /*
- X * Try matching pattern right-to-left
- X */
- X for ( j = patlen-1 ;; )
- X {
- X c = SS_MAP( hp, str[ s+j ] ) ;
- X if ( pattern[ j ] == c )
- X if ( j )
- X j-- ;
- X else
- X return( &str[ s ] ) ;
- X else
- X break ;
- X }
- X lo = last_occurrence[ (unsigned char) c ] ;
- X if ( j > lo )
- X s += j - lo ;
- X else
- X s++ ;
- X }
- X return( CHAR_NULL ) ;
- X}
- X
- X
- XPRIVATE void sbm_done( hp )
- X header_s *hp ;
- X{
- X (void) free( (char *) SBM_HEADER( hp )->last_occurrence ) ;
- X}
- X
- END_OF_FILE
- if test 1825 -ne `wc -c <'libs/src/str/ss_sbm.c'`; then
- echo shar: \"'libs/src/str/ss_sbm.c'\" unpacked with wrong size!
- fi
- # end of 'libs/src/str/ss_sbm.c'
- fi
- if test -f 'libs/src/str/strparse.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libs/src/str/strparse.h'\"
- else
- echo shar: Extracting \"'libs/src/str/strparse.h'\" \(1514 characters\)
- sed "s/^X//" >'libs/src/str/strparse.h' <<'END_OF_FILE'
- X/*
- X * (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
- X * All rights reserved. The file named COPYRIGHT specifies the terms
- X * and conditions for redistribution.
- X */
- X
- X
- X/*
- X * $Id: strparse.h,v 3.1 1993/06/13 02:48:35 panos Exp $
- X */
- X
- Xstruct str_handle
- X{
- X char *string ;
- X char *separator ;
- X char *pos ;
- X int flags ;
- X int *errnop ;
- X int no_more ;
- X} ;
- X
- Xint str_errno ;
- X
- X#ifndef NULL
- X#define NULL 0
- X#endif
- X
- X#ifndef FALSE
- X#define FALSE 0
- X#define TRUE 1
- X#endif
- X
- X#define PRIVATE static
- X
- X#define TERMINATE( msg ) { \
- X char *s = msg ; \
- X \
- X (void) write( 2, s, strlen( s ) ) ; \
- X (void) abort() ; \
- X _exit( 1 ) ; \
- X /* NOTREACHED */ \
- X }
- X
- X
- X#define HANDLE_ERROR( flags, retval, errp, errval, msg ) \
- X if ( flags & STR_RETURN_ERROR ) \
- X { \
- X *errp = errval ; \
- X return( retval ) ; \
- X } \
- X else \
- X TERMINATE( msg )
- X
- X
- END_OF_FILE
- if test 1514 -ne `wc -c <'libs/src/str/strparse.h'`; then
- echo shar: \"'libs/src/str/strparse.h'\" unpacked with wrong size!
- fi
- # end of 'libs/src/str/strparse.h'
- fi
- if test -f 'libs/src/timer/impl.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libs/src/timer/impl.h'\"
- else
- echo shar: Extracting \"'libs/src/timer/impl.h'\" \(1738 characters\)
- sed "s/^X//" >'libs/src/timer/impl.h' <<'END_OF_FILE'
- X/*
- X * (c) Copyright 1993 by Panagiotis Tsirigotis
- X * All rights reserved. The file named COPYRIGHT specifies the terms
- X * and conditions for redistribution.
- X */
- X
- X#ifndef IMPL_H
- X#define IMPL_H
- X
- X/*
- X * $Id: impl.h,v 4.2 1993/05/06 06:47:03 panos Exp $
- X */
- X
- X#include <sys/time.h>
- X#include <setjmp.h>
- X
- X#include "pq.h"
- X#include "timer.h"
- X#include "ostimer.h"
- X
- Xenum timer_state { INACTIVE, TICKING, DESTROYED } ;
- Xenum action_state { IDLE, PENDING, SCHEDULED, INVOKED } ;
- X
- X
- Xstruct timer
- X{
- X enum timer_state t_state ;
- X enum action_state t_act ;
- X int t_blocked ;
- X
- X int t_flags ;
- X int *t_errnop ;
- X struct os_timer *t_ostimer ;
- X struct timer_action t_action ;
- X
- X /*
- X * The following fields are managed by the ostimer code.
- X * t_expiration is the (absolute) time when the timer will expire.
- X * t_interval is the repeat interval for the timer.
- X * t_expirations is the number of expirations of the timer when
- X * the function associated with the timer is invoked.
- X * t_count is the number of times that the timer has expired before
- X * the function was invoked.
- X */
- X struct timeval t_expiration ;
- X struct timeval t_interval ;
- X unsigned t_count ;
- X unsigned t_expirations ;
- X} ;
- X
- Xtypedef struct timer timer_s ;
- X
- X#define TP( p ) ( (struct timer *) (p) )
- X
- Xchar *malloc() ;
- X
- X#define TIMER_ALLOC() TP( malloc( sizeof( timer_s ) ) )
- X#define TIMER_FREE( tp ) (void) free( (char *)(tp) )
- X
- X/*
- X * The following are masks for the expected flags of timer_create and
- X * timer_start
- X */
- X#define TIMER_CREATE_FLAGS TIMER_RETURN_ERROR
- X#define TIMER_START_FLAGS \
- X ( TIMER_INC_VAR + TIMER_BLOCK_SAME + TIMER_BLOCK_ALL + TIMER_LONGJMP )
- X
- X
- Xenum timer_state __timer_invoke() ;
- Xvoid __timer_terminate() ;
- X
- X#endif /* IMPL_H */
- X
- END_OF_FILE
- if test 1738 -ne `wc -c <'libs/src/timer/impl.h'`; then
- echo shar: \"'libs/src/timer/impl.h'\" unpacked with wrong size!
- fi
- # end of 'libs/src/timer/impl.h'
- fi
- if test -f 'libs/src/timer/ostimer.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libs/src/timer/ostimer.h'\"
- else
- echo shar: Extracting \"'libs/src/timer/ostimer.h'\" \(1998 characters\)
- sed "s/^X//" >'libs/src/timer/ostimer.h' <<'END_OF_FILE'
- X/*
- X * (c) Copyright 1993 by Panagiotis Tsirigotis
- X * All rights reserved. The file named COPYRIGHT specifies the terms
- X * and conditions for redistribution.
- X */
- X
- X#ifndef OSTIMER_H
- X#define OSTIMER_H
- X
- X/*
- X * Include signal.h to get sigset_t
- X */
- X#ifndef NO_POSIX_SIGS
- X#include <signal.h>
- X#endif
- X
- X#include "pq.h"
- X
- X/*
- X * Holds a list of timers ordered by expiration time (the one at the
- X * head of the list is the one that will expire first).
- X */
- Xstruct timer_q
- X{
- X pq_h tq_handle ;
- X int tq_errno ;
- X} ;
- X
- X/*
- X * Macros to handle the priority queue
- X */
- X#define timer_pq_insert( tpq, tp ) pq_insert( tpq, (char *) tp )
- X#define timer_pq_head( tpq ) (struct timer *) pq_head( tpq )
- X#define timer_pq_extract_head( tpq ) (struct timer *) pq_extract_head( tpq )
- X#define timer_pq_delete( tpq, tp ) pq_delete( tpq, (char *) tp )
- X
- X
- Xtypedef enum { AVAILABLE, UNAVAILABLE } availability_e ;
- X
- X/*
- X * Description of a timer provided by the operating system
- X */
- Xstruct os_timer
- X{
- X availability_e ost_availability ;
- X int ost_systype ; /* e.g. ITIMER_REAL */
- X enum timer_types ost_timertype ; /* e.g. TIMER_REAL */
- X int ost_signal ; /* what signal is generated */
- X /* upon expiration */
- X void (*ost_handler)() ; /* what function to invoke */
- X void (*ost_get_current_time)() ;
- X /* how to find the current time */
- X struct timer_q ost_timerq ; /* list of timers of this type */
- X#ifndef NO_POSIX_SIGS
- X sigset_t ost_block_mask ; /* signal mask to blocks this timer */
- X#else
- X int ost_block_mask ;
- X#endif
- X} ;
- X
- Xtypedef struct os_timer ostimer_s ;
- X
- X#define OSTIMER_NULL ((ostimer_s *)0)
- X
- X#define SIGSET_NULL ((sigset_t *)0)
- X
- X/*
- X * Public functions
- X */
- Xostimer_s *__ostimer_init() ;
- Xint __ostimer_newtimer() ;
- Xint __ostimer_add() ;
- Xvoid __ostimer_interrupt() ;
- Xvoid __ostimer_remove() ;
- Xvoid __ostimer_blockall() ;
- Xvoid __ostimer_unblockall() ;
- Xvoid __ostimer_unblockall_except() ;
- X
- X#endif /* OSTIMER_H */
- X
- END_OF_FILE
- if test 1998 -ne `wc -c <'libs/src/timer/ostimer.h'`; then
- echo shar: \"'libs/src/timer/ostimer.h'\" unpacked with wrong size!
- fi
- # end of 'libs/src/timer/ostimer.h'
- fi
- if test -f 'libs/src/timer/timer.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libs/src/timer/timer.h'\"
- else
- echo shar: Extracting \"'libs/src/timer/timer.h'\" \(1983 characters\)
- sed "s/^X//" >'libs/src/timer/timer.h' <<'END_OF_FILE'
- X/*
- X * (c) Copyright 1993 by Panagiotis Tsirigotis
- X * All rights reserved. The file named COPYRIGHT specifies the terms
- X * and conditions for redistribution.
- X */
- X
- X#ifndef __TIMER_H
- X#define __TIMER_H
- X
- X/*
- X * $Id: timer.h,v 4.2 1993/05/06 06:43:55 panos Exp $
- X */
- X
- X#include <sys/time.h>
- X#include <setjmp.h>
- X
- X/*
- X * Return values
- X */
- X#define TIMER_OK 0
- X#define TIMER_ERR (-1)
- X
- X/*
- X * errno values
- X */
- X#define TIMER_ENOMEM 1
- X#define TIMER_EBADTYPE 2
- X#define TIMER_EBADSTATE 3
- X#define TIMER_EBADTIME 4
- X#define TIMER_ESIGPROBLEM 5
- X#define TIMER_ECANTINSERT 6
- X#define TIMER_ENOTAVAILABLE 7
- X
- X/*
- X * flags
- X */
- X#define TIMER_NOFLAGS 0x0
- X#define TIMER_RETURN_ERROR 0x1
- X#define TIMER_INC_VAR 0x2
- X#define TIMER_BLOCK_SAME 0x4
- X#define TIMER_BLOCK_ALL 0x8
- X#define TIMER_LONGJMP 0x10
- X
- Xenum timer_types { TIMER_REAL, TIMER_VIRTUAL, TIMER_PROF } ;
- Xenum timer_timetypes { TIMER_ABSOLUTE, TIMER_RELATIVE } ;
- X
- Xstruct timer_action
- X{
- X int ta_flags ;
- X void (*ta_func)() ;
- X void *ta_arg ;
- X jmp_buf ta_env ;
- X} ;
- X
- X#ifdef __ARGS
- X#undef __ARGS
- X#endif
- X
- X#ifdef PROTOTYPES
- X# define __ARGS( s ) s
- X#else
- X# define __ARGS( s ) ()
- X#endif
- X
- Xtypedef void *timer_h ;
- X
- Xtimer_h timer_create __ARGS( (
- X enum timer_types type,
- X int flags,
- X int *errnop
- X ) ) ;
- Xvoid timer_destroy __ARGS( ( timer_h handle ) ) ;
- X
- Xint timer_start __ARGS( (
- X timer_h handle,
- X struct itimerval *itvp,
- X enum timer_times time_type,
- X struct timer_action *ap
- X ) ) ;
- Xvoid timer_stop __ARGS( ( timer_h handle ) ) ;
- X
- Xvoid timer_block __ARGS( ( timer_h handle ) ) ;
- Xvoid timer_unblock __ARGS( ( timer_h handle ) ) ;
- X
- Xunsigned timer_expirations __ARGS( ( timer_h handle ) ) ;
- X
- Xvoid timer_block_all __ARGS( ( enum timer_types type ) ) ;
- Xvoid timer_unblock_all __ARGS( ( enum timer_types type ) ) ;
- X
- Xchar *timer_strerr __ARGS( ( timer_h handle ) ) ;
- X
- Xextern int timer_errno ;
- X
- X#endif /* __TIMER_H */
- X
- END_OF_FILE
- if test 1983 -ne `wc -c <'libs/src/timer/timer.h'`; then
- echo shar: \"'libs/src/timer/timer.h'\" unpacked with wrong size!
- fi
- # end of 'libs/src/timer/timer.h'
- fi
- if test -f 'libs/src/xlog/xlog.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libs/src/xlog/xlog.h'\"
- else
- echo shar: Extracting \"'libs/src/xlog/xlog.h'\" \(1967 characters\)
- sed "s/^X//" >'libs/src/xlog/xlog.h' <<'END_OF_FILE'
- X/*
- X * (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
- X * All rights reserved. The file named COPYRIGHT specifies the terms
- X * and conditions for redistribution.
- X */
- X
- X#ifndef __XLOG_H
- X#define __XLOG_H
- X
- X/*
- X * $Id: xlog.h,v 2.2 1993/06/15 18:07:48 panos Exp $
- X */
- X
- X/*
- X * Flags
- X */
- X#define XLOG_NOFLAGS 0x0
- X#define XLOG_SET_LEVEL 0x1
- X#define XLOG_NO_SIZECHECK 0x2
- X#define XLOG_NO_ERRNO 0x4
- X/* #define XLOG_PRINT_TIMESTAMP 0x8 */
- X#define XLOG_PRINT_ID 0x10
- X#define XLOG_PRINT_PID 0x20
- X
- X/*
- X * Errors
- X */
- X#define XLOG_ENOERROR 0
- X#define XLOG_ESIZE 1
- X#define XLOG_EOPEN 2
- X#define XLOG_EFSTAT 3
- X#define XLOG_ENOMEM 4
- X#define XLOG_EBADOP 5
- X
- X/*
- X * Interface
- X */
- X
- X#ifdef __ARGS
- X#undef __ARGS
- X#endif
- X
- X#ifdef PROTOTYPES
- X# define __ARGS( s ) s
- X#else
- X# define __ARGS( s ) ()
- X#endif
- X
- Xtypedef enum { XLOG_SYSLOG, XLOG_FILELOG } xlog_e ;
- X
- Xtypedef enum
- X {
- X XLOG_LINK, /* generic: link this log to another log */
- X XLOG_CALLBACK, /* generic: call this function in case of error */
- X XLOG_GETFLAG, /* generic: get value of specified flag */
- X XLOG_SETFLAG, /* generic: set value of specified flag */
- X XLOG_LEVEL, /* syslog: set the default syslog level */
- X XLOG_FACILITY, /* syslog: set the default syslog facility */
- X XLOG_PREEXEC, /* syslog: prepare the log for an exec(2) */
- X XLOG_POSTEXEC, /* syslog: exec(2) failed */
- X XLOG_SIZECHECK, /* filelog: check file size */
- X XLOG_GETFD, /* filelog: get file descriptor of log file */
- X XLOG_LIMITS /* filelog: set (new) soft/hard limits */
- X } xlog_cmd_e ;
- X
- Xtypedef void *xlog_h ;
- X
- Xxlog_h xlog_create __ARGS( ( xlog_e type, char *id, int flags, ... ) ) ;
- Xvoid xlog_destroy __ARGS( ( xlog_h ) ) ;
- Xvoid xlog_write __ARGS( ( xlog_h, char *buf, int len, int flags, ... ) ) ;
- Xint xlog_control __ARGS( ( xlog_h, xlog_cmd_e, ... ) ) ;
- Xint xlog_parms __ARGS( ( xlog_e type, ... ) ) ;
- X
- X#endif /* __XLOG_H */
- END_OF_FILE
- if test 1967 -ne `wc -c <'libs/src/xlog/xlog.h'`; then
- echo shar: \"'libs/src/xlog/xlog.h'\" unpacked with wrong size!
- fi
- # end of 'libs/src/xlog/xlog.h'
- fi
- if test -f 'xinetd/attr.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'xinetd/attr.h'\"
- else
- echo shar: Extracting \"'xinetd/attr.h'\" \(1594 characters\)
- sed "s/^X//" >'xinetd/attr.h' <<'END_OF_FILE'
- X/*
- X * (c) Copyright 1992 by Panagiotis Tsirigotis
- X * All rights reserved. The file named COPYRIGHT specifies the terms
- X * and conditions for redistribution.
- X */
- X
- X#ifndef ATTR_H
- X#define ATTR_H
- X
- X/*
- X * $Id: attr.h,v 6.2 1993/04/22 23:27:03 panos Exp $
- X */
- X
- X/*
- X * Attribute IDs
- X */
- X#define A_NONE 0
- X#define A_WAIT 1
- X#define A_SOCKET_TYPE 2
- X#define A_PROTOCOL 3
- X#define A_USER 4
- X#define A_GROUP 5
- X#define A_SERVER 6
- X#define A_SERVER_ARGS 7
- X#define A_INSTANCES 8
- X#define A_ID 9
- X#define A_ONLY_FROM 10
- X#define A_ACCESS_TIMES 11
- X#define A_RPC_VERSION 12
- X#define A_LOG_TYPE 13
- X#define A_NO_ACCESS 14
- X#define A_TYPE 15
- X#define A_LOG_ON_FAILURE 16
- X#define A_LOG_ON_SUCCESS 17
- X#define A_ENV 18
- X#define A_PORT 19
- X#define A_PASSENV 20
- X#define A_FLAGS 21
- X#define A_RPC_NUMBER 22
- X#define A_NICE 23
- X
- X/*
- X * SERVICE_ATTRIBUTES is the number of service attributes and also
- X * the number from which defaults-only attributes start.
- X */
- X#define SERVICE_ATTRIBUTES ( A_NICE + 1 )
- X
- X#define A_DISABLED ( SERVICE_ATTRIBUTES )
- X
- X
- X/*
- X * Mask of attributes that must be specified.
- X */
- X#define NECESSARY_ATTRS ( MASK( A_SOCKET_TYPE ) + MASK( A_WAIT ) )
- X
- X#define NECESSARY_ATTRS_EXTERNAL MASK( A_SERVER )
- X#define NECESSARY_ATTRS_RPC_LISTED MASK( A_PROTOCOL )
- X#define NECESSARY_ATTRS_RPC_UNLISTED MASK( A_PROTOCOL ) + MASK( A_RPC_NUMBER )
- X#define NECESSARY_ATTRS_LISTED MASK( A_USER )
- X#define NECESSARY_ATTRS_UNLISTED ( MASK( A_PROTOCOL ) + MASK( A_PORT ) )
- X
- X#endif /* ATTR_H */
- END_OF_FILE
- if test 1594 -ne `wc -c <'xinetd/attr.h'`; then
- echo shar: \"'xinetd/attr.h'\" unpacked with wrong size!
- fi
- # end of 'xinetd/attr.h'
- fi
- if test -f 'xinetd/flags.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'xinetd/flags.c'\"
- else
- echo shar: Extracting \"'xinetd/flags.c'\" \(1985 characters\)
- sed "s/^X//" >'xinetd/flags.c' <<'END_OF_FILE'
- X/*
- X * (c) Copyright 1992 by Panagiotis Tsirigotis
- X * All rights reserved. The file named COPYRIGHT specifies the terms
- X * and conditions for redistribution.
- X */
- X
- Xstatic char RCSid[] = "$Id: flags.c,v 6.3 1993/06/15 23:25:57 panos Exp $" ;
- X
- X#include "flags.h"
- X#include "state.h"
- X#include "defs.h"
- X
- X/*
- X * Control flags
- X *
- X * NOENV means that the setjmp buffer should be disabled while the
- X * flag action is running (so if something goes wrong in the flag
- X * action the program will be terminated).
- X */
- X#define CF_NONE 0x0
- X#define CF_NOENV 0x1
- X
- Xstruct flag_action
- X{
- X int fa_value ;
- X voidfunc fa_action ;
- X int fa_control_flags ;
- X} ;
- X
- X
- Xvoid soft_reconfig() ;
- Xvoid hard_reconfig() ;
- Xvoid dump_internal_state() ;
- Xvoid periodic_check() ;
- Xvoid user_requested_check() ;
- Xvoid child_exit() ;
- Xvoid server_retry() ;
- Xvoid quit_program() ;
- Xvoid terminate_program() ;
- X
- X
- Xstatic struct flag_action flag_actions[] =
- X{
- X { SOFT_RECONFIG_FLAG, soft_reconfig, CF_NOENV },
- X { HARD_RECONFIG_FLAG, hard_reconfig, CF_NOENV },
- X { RETRY_FLAG, server_retry, CF_NONE },
- X { DUMP_FLAG, dump_internal_state, CF_NONE },
- X { TERMINATE_FLAG, terminate_program, CF_NONE },
- X { CONSISTENCY_FLAG, user_requested_check, CF_NONE },
- X { CHILD_FLAG, child_exit, CF_NONE },
- X { QUIT_FLAG, quit_program, CF_NONE },
- X { PERIODIC_CHECK_FLAG, periodic_check, CF_NONE },
- X { 0, 0, 0 }
- X} ;
- X
- X
- X/*
- X * Returns after all flags are clear
- X */
- Xvoid check_flags()
- X{
- X bool_int valid_env = ps.rws.env_is_valid ;
- X
- X while ( ! M_ARE_ALL_CLEAR( ps.flags ) )
- X {
- X register struct flag_action *fap ;
- X
- X for ( fap = flag_actions ; fap->fa_value != 0 ; fap++ )
- X if ( M_IS_SET( ps.flags, fap->fa_value ) )
- X {
- X M_CLEAR( ps.flags, fap->fa_value ) ;
- X
- X if ( fap->fa_control_flags & CF_NOENV )
- X ps.rws.env_is_valid = FALSE ;
- X else
- X ps.rws.env_is_valid = valid_env ;
- X
- X (*fap->fa_action)() ;
- X
- X break ;
- X }
- X }
- X
- X ps.rws.env_is_valid = valid_env ;
- X}
- X
- X
- END_OF_FILE
- if test 1985 -ne `wc -c <'xinetd/flags.c'`; then
- echo shar: \"'xinetd/flags.c'\" unpacked with wrong size!
- fi
- # end of 'xinetd/flags.c'
- fi
- if test -f 'xinetd/int.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'xinetd/int.h'\"
- else
- echo shar: Extracting \"'xinetd/int.h'\" \(1858 characters\)
- sed "s/^X//" >'xinetd/int.h' <<'END_OF_FILE'
- X/*
- X * (c) Copyright 1992 by Panagiotis Tsirigotis
- X * All rights reserved. The file named COPYRIGHT specifies the terms
- X * and conditions for redistribution.
- X */
- X
- X#ifndef INT_H
- X#define INT_H
- X
- X/*
- X * $Id: int.h,v 6.5 1993/06/06 00:06:43 panos Exp $
- X */
- X
- X#include <sys/types.h>
- X#include <netinet/in.h>
- X
- X#include "pset.h"
- X
- X#include "defs.h"
- X#include "server.h"
- X
- Xtypedef enum { GOOD_CHANNEL, BAD_CHANNEL } channel_state_e ;
- X
- Xstruct channel
- X{
- X channel_state_e ch_state ;
- X struct sockaddr_in ch_from ;
- X int ch_local_socket ;
- X int ch_remote_socket ;
- X} ;
- X
- Xtypedef struct channel channel_s ;
- X
- X#define CHP( p ) ((struct channel *)(p))
- X
- X#define CHANNEL_NULL CHP( NULL )
- X
- Xchar *malloc() ;
- X
- X#define NEW_CHANNEL() NEW( channel_s )
- X#define FREE_CHANNEL( chp ) FREE( chp )
- X
- X
- Xchannel_s *int_lookupconn() ;
- Xchannel_s *int_newconn() ;
- X
- X
- Xstruct intercept_common
- X{
- X bool_int ic_intercept ;
- X int ic_remote_socket ;
- X struct sockaddr_in ic_local_addr ;
- X pset_h ic_connections ;
- X struct server ic_server ;
- X} ;
- X
- X
- Xstruct intercept_ops
- X{
- X void (*mux)() ;
- X void (*exit)() ;
- X} ;
- X
- X
- Xstruct intercept
- X{
- X int int_socket_type ;
- X struct intercept_common int_common ;
- X void *int_priv ;
- X struct intercept_ops *int_ops ;
- X} ;
- X
- X#define INT_TYPE( p ) ((p)->int_socket_type)
- X#define INT_SERVER( p ) (&(p)->int_common.ic_server)
- X#define INT_LOCALADDR( p ) (&(p)->int_common.ic_local_addr)
- X#define INT_REMOTE( p ) ((p)->int_common.ic_remote_socket)
- X#define INT_ALLOCATOR( p ) ((p)->int_common.ic_channel_allocator)
- X#define INT_CONNECTIONS( p ) ((p)->int_common.ic_connections)
- X#define INTERCEPT( p ) ((p)->int_common.ic_intercept)
- X
- Xvoid int_fail() ;
- Xint int_select() ;
- Xvoid int_exit() ;
- Xvoid int_init() ;
- Xchannel_s *int_newconn() ;
- Xchannel_s *int_lookupconn() ;
- X
- X#endif /* INT_H */
- END_OF_FILE
- if test 1858 -ne `wc -c <'xinetd/int.h'`; then
- echo shar: \"'xinetd/int.h'\" unpacked with wrong size!
- fi
- # end of 'xinetd/int.h'
- fi
- if test -f 'xinetd/state.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'xinetd/state.h'\"
- else
- echo shar: Extracting \"'xinetd/state.h'\" \(1988 characters\)
- sed "s/^X//" >'xinetd/state.h' <<'END_OF_FILE'
- X/*
- X * (c) Copyright 1992 by Panagiotis Tsirigotis
- X * All rights reserved. The file named COPYRIGHT specifies the terms
- X * and conditions for redistribution.
- X */
- X
- X#ifndef STATE_H
- X#define STATE_H
- X
- X/*
- X * $Id: state.h,v 6.2 1993/06/04 23:23:47 panos Exp $
- X */
- X
- X#include <setjmp.h>
- X
- X#include "pset.h"
- X#include "xlog.h"
- X
- X#include "mask.h"
- X#include "service.h"
- X
- Xstruct read_only_state
- X{
- X int orig_max_descriptors ; /* before we change the resource limit */
- X int max_descriptors ; /* as returned by getdtablesize() */
- X int process_limit ; /* if 0, there is no limit */
- X unsigned loop_rate ;
- X char *config_file ;
- X int is_superuser ;
- X char **Argv ;
- X int Argc ;
- X} ;
- X
- X
- Xstruct defaults
- X{
- X struct service_config *def_settings ;
- X xlog_h def_log ;
- X bool_int def_log_creation_failed ;
- X} ;
- X
- X
- Xstruct read_write_state
- X{
- X int descriptors_free ;
- X int available_services ; /* # of available services */
- X int active_services ; /* services with descriptors set */
- X /* in socket mask */
- X fd_set socket_mask ;
- X int mask_max ;
- X pset_h servers ; /* table of running servers */
- X pset_h retries ; /* table of servers to retry */
- X pset_h services ; /* table of services */
- X struct service *logging ;
- X struct service *shutdown ;
- X struct defaults defs ;
- X xlog_h program_log ;
- X jmp_buf env ;
- X bool_int env_is_valid ;
- X} ;
- X
- Xstruct program_state
- X{
- X mask_t flags ;
- X struct read_only_state ros ;
- X struct read_write_state rws ;
- X} ;
- X
- X#define DEFAULTS( ps ) (ps).rws.defs.def_settings
- X#define DEFAULT_LOG( ps ) (ps).rws.defs.def_log
- X#define DEFAULT_LOG_ERROR( ps ) (ps).rws.defs.def_log_creation_failed
- X#define LOG_SERVICE( ps ) (ps).rws.logging
- X#define SHUTDOWN_SERVICE( ps ) (ps).rws.shutdown
- X#define SERVICES( ps ) (ps).rws.services
- X#define SERVERS( ps ) (ps).rws.servers
- X#define RETRIES( ps ) (ps).rws.retries
- X
- Xextern struct program_state ps ;
- X
- X#endif /* STATE_H */
- END_OF_FILE
- if test 1988 -ne `wc -c <'xinetd/state.h'`; then
- echo shar: \"'xinetd/state.h'\" unpacked with wrong size!
- fi
- # end of 'xinetd/state.h'
- fi
- echo shar: End of archive 3 \(of 31\).
- cp /dev/null ark3isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 31 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-