/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "lint.h"
#include "thr_uberdata.h"
#include "asyncio.h"
/*
* The aio subsystem memory allocation strategy:
*
* (aio_worker_t, aio_req_t, aio_lio_t), we use mmap() to allocate
* chunks of memory which are then subdivided into individual
* elements which are put into a free list from which allocations
* are made and to which frees are returned.
*
* Chunks start small (8 Kbytes) and get larger (size doubling)
* as more chunks are needed. This keeps memory usage small for
* light use and fragmentation small for heavy use.
*
* Chunks are never unmapped except as an aftermath of fork()
* in the child process, when they are all unmapped (because
* all of the worker threads disappear in the child).
*/
/*
* The header structure for each chunk.
* A pointer and a size_t ensures proper alignment for whatever follows.
*/
typedef struct chunk {
} chunk_t;
chunk_t *
{
void *ptr;
if (ptr != MAP_FAILED) {
chunk_list = chp;
}
return (chp);
}
/*
* Allocate a worker control block.
*/
_aio_worker_alloc(void)
{
int nelem;
int i;
return (NULL);
}
}
return (aiowp);
}
/*
* Free a worker control block.
* Declared with void *arg so it can be a pthread_key_create() destructor.
*/
void
{
if (worker_freelast == NULL) {
} else {
}
}
int _aio_freelist_cnt = 0;
int _aio_allocated_cnt = 0;
/*
* Allocate an aio request structure.
*/
_aio_req_alloc(void)
{
int nelem;
int i;
return (NULL);
}
}
}
return (reqp);
}
/*
* Free an aio request structure.
*/
void
{
if (_aio_freelast == NULL) {
} else {
}
}
int _lio_alloc = 0;
int _lio_free = 0;
/*
* Allocate a listio head structure.
*/
_aio_lio_alloc(void)
{
int nelem;
int i;
return (NULL);
}
_lio_alloc += nelem;
}
_lio_free--;
return (head);
}
/*
* Free a listio head structure.
*/
void
{
if (_lio_head_freelast == NULL) {
} else {
}
_lio_free++;
}
void
postfork1_child_aio(void)
{
/*
* All of the workers are gone; free their structures.
*/
if (_kaio_supported != NULL) {
(void) munmap((void *)_kaio_supported,
MAX_KAIO_FDARRAY_SIZE * sizeof (uint32_t));
}
}
}
/*
* Reinitialize global variables
*/
worker_chunksize = 0;
request_chunksize = 0;
_aio_freelist_cnt = 0;
_aio_allocated_cnt = 0;
lio_head_chunksize = 0;
_lio_alloc = 0;
_lio_free = 0;
__aio_initbusy = 0;
_kaio_ok = 0;
__uaio_ok = 0;
__workers_rw = NULL;
__rw_workerscnt = 0;
__workers_no = NULL;
__no_workerscnt = 0;
_aio_worker_cnt = 0;
_aio_donecnt = 0;
_aio_doneq = NULL;
_aio_doneq_cnt = 0;
_aio_waitncnt = 0;
_aio_outstand_cnt = 0;
_kaio_outstand_cnt = 0;
_aio_req_done_cnt = 0;
_aio_kernel_suspend = 0;
_aio_suscv_cnt = 0;
_aiowait_flag = 0;
_aio_flags = 0;
}
static void
_aio_exit_info(void)
{
return;
}
void
init_aio(void)
{
char *str;
_min_workers = 4;
}
_max_workers = 256;
}
(void) atexit(_aio_exit_info);
}