nis_cleanup.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 (c) 2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* The functions in this file used to reside in nis_subr_proc.c. In order
* to simplify building nislog(1M) (which links in some but not all of the
* rpc.nisd object files), it was convenient to move the functions to their
* own file.
*/
#include <syslog.h>
#include "nis_proc.h"
void
free_abort(p)
char *p;
{
abort();
}
/*
* These functions are used to clean up after ourselves when we return
* a result. The primary client are the svc functions which malloc
* their data and then put it on the cleanup list when they return.
* this allows them to be reentrant.
*/
void
{
if (stuff == 0)
return;
tsd = __nis_get_tsd();
#ifdef DEBUG
#endif
}
}
/*
* The non-MT code allocates space for 1024 rags. Because the auto-MT
* mode of RPC usually creates a new thread for every RPC request,
* and since each thread has its own rags list, we only need enough
* for one NIS+ operation. Testing showed that handling a nis_list()
* (without callback) used seven rags, so 16 seems a good choice,
* making it unlikely that a thread will need to allocate rags more
* than once.
*/
#define RAGCHUNK 16
void
void (*clean_func)();
void *clean_data;
char *ragtag;
{
int i;
if ((! clean_func) || (! clean_data)) {
if (cons)
return;
}
tsd = __nis_get_tsd();
if (verbose)
"add_cleanup: Low on rags, allocating some more.");
/* Allocate extra space to keep track of the newrag block */
sizeof (cleanup));
if (! newrag) {
"add_cleanup: Can't allocate more rags.");
return;
}
/*
* Use the first 'newragoffset' element(s) of the 'newrag'
* array for housekeeping that enables us to free the array
* on thread exit.
*/
{
n->next = *b;
*b = n;
#ifdef NIS_MT_DEBUG
printf("%d: newrag 0x%x (%d bytes)\n",
pthread_self(), n,
#endif /* NIS_MT_DEBUG */
}
}
}
#ifdef DEBUG
if (verbose)
#endif /* DEBUG */
tsd->cleanup_tag++;
}
void
{
if (! data)
return;
}
void
char *data;
char *t;
{
if (! dat)
return;
}