nislog.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
* Copyright 2001 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* nislog.c
*
* This module simply reads the internal format of the log and prints
* it out for the user to stdout. The format of the transaction log
* is an *INTERNAL* interface and will change from time to time. The
* service uses the log specific functions defined in the nis_log.c
* module. They are reproduced here for this test code.
*
*/
#include <stdio.h>
#include <syslog.h>
#include <values.h> /* MAXINT define */
#include <unistd.h>
#include <signal.h>
#include "log.h"
/*
* nislog(1M) doesn't use 'cons', but we need it defined following the
* code rearrangements for the MT rpc.nisd.
*/
extern unsigned long __maxloglen;
extern char *optarg;
int verbose = 0;
/*
* This macro returns true if the two objects have identical OIDs
*/
int
int xid;
{
return (0);
}
void
int num;
{
printf("@@@@@@@@@@@@@@@@ Transaction @@@@@@@@@@@@@@@@@@\n");
printf("Entry type : ");
case ADD_NAME :
printf("ADD Name\n");
break;
case REM_NAME :
printf("REMOVE Name\n");
break;
case ADD_IBASE :
printf("ADD Entry\n");
break;
case REM_IBASE :
printf("REMOVE Entry\n");
break;
case MOD_NAME_OLD :
printf("MODIFY (Original Value)\n");
break;
case MOD_NAME_NEW :
printf("MODIFY (New Value)\n");
break;
case UPD_STAMP :
printf("UPDATE time stamp.\n");
break;
default:
break;
}
printf(".................. Object .....................\n");
printf("...............................................\n");
}
static
void
{
printf("Transaction log checkpointed while reading.\n");
exit(0);
}
usage(s)
char *s;
{
else
exit(1);
}
char *directories[128];
int argc;
char *argv[];
{
char **dir;
char *cmd;
int i, c;
int tail_only = 0;
char logname[NIS_MAXNAMELEN];
exit(1);
}
printf("NIS Log printing facility.\n");
opterr = 0;
/*
* if the cmdname is "logtail" or "loghead" change the
* arguments a bit, any other name and we default to
* "nislog" behaviour.
*/
if (! cmd)
tail_only = 1;
switch (c) {
case 'v' :
verbose = 1;
break;
case '?' :
break;
}
}
optind++;
}
i = 0;
} else {
switch (c) {
case 'h' :
break;
case 't' :
tail_only = 1;
break;
case 'v' :
verbose = 1;
break;
case '?' :
break;
}
}
i = 0;
}
/*
* If we have a long transaction log mmapped and rpc.nisd
* truncates the log before we have hit all of the pages,
* then when we hit a page past the current end of file for
* the first time, we will get a SIGBUS. We simple set a
* signal handler to catch the signal and exit with status 0.
*/
exit(1);
}
printf("NIS Log dump :\n");
printf("\tLog state : ");
case LOG_STABLE :
printf("STABLE.\n");
break;
case LOG_RESYNC :
printf("RESYNCING.\n");
break;
case LOG_UPDATE :
printf("UPDATING.\n");
break;
case LOG_CHECKPOINT :
printf("CHECKPOINTING.\n");
break;
}
printf("Size of Log in bytes : %d\n",
printf("*** UPDATES ***\n");
printf("--None--\n");
exit(0);
}
dir = directories;
do {
if (tail_only) {
if ((*dir) &&
!= SAME_NAME))
continue;
i++;
}
} else {
if ((*dir) &&
!= SAME_NAME))
continue;
print_transaction(cur, i);
i++;
}
}
dir++;
exit(0);
}