1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License").  You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
23 * Copyright 1998-2003 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#ifndef	_SORT_STREAMS_H
28#define	_SORT_STREAMS_H
29
30#pragma ident	"%Z%%M%	%I%	%E% SMI"
31
32#ifdef	__cplusplus
33extern "C" {
34#endif
35
36#include <sys/mman.h>
37#include <sys/param.h>
38#include <sys/types.h>
39#include <sys/stat.h>
40
41#include <fcntl.h>
42#include <stdio.h>
43#include <stdlib.h>
44#include <string.h>
45#include <unistd.h>
46
47#include "fields.h"
48#include "types.h"
49#include "streams_array.h"
50#include "streams_common.h"
51#include "streams_mmap.h"
52#include "streams_stdio.h"
53#include "streams_wide.h"
54#include "utility.h"
55
56#define	ST_MEM_FILLED	0x0	/* no memory left; proceed to internal sort */
57#define	ST_MEM_AVAIL	0x1	/* memory left for sort; take add'l input */
58
59#define	ST_NOCACHE	0x0	/* write sorted array to temporary file */
60#define	ST_CACHE	0x1	/* keep sorted array in memory */
61#define	ST_OPEN		0x2	/* create open temporary file */
62#define	ST_WIDE		0x4	/* write multibyte chars to temporary file */
63
64extern void stream_add_file_to_chain(stream_t **, char *);
65extern void stream_clear(stream_t *);
66extern void stream_close_all_previous(stream_t *);
67extern uint_t stream_count_chain(stream_t *);
68extern int stream_insert(sort_t *, stream_t *, stream_t *);
69extern stream_t *stream_new(int);
70extern int stream_open_for_read(sort_t *, stream_t *);
71extern void stream_push_to_chain(stream_t **, stream_t *);
72extern stream_t *stream_push_to_temporary(stream_t **, stream_t *, int);
73extern void stream_set_size(stream_t *, size_t);
74extern void stream_stat_chain(stream_t *);
75extern void stream_swap_buffer(stream_t *, char **, size_t *);
76extern void stream_unlink_temporary(stream_t *streamp);
77
78#ifdef	__cplusplus
79}
80#endif
81
82#endif	/* _SORT_STREAMS_H */
83