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