10bb2aabfSGleb Kurtsou /*- 28a16b7a1SPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause 38a16b7a1SPedro F. Giffuni * 40bb2aabfSGleb Kurtsou * Copyright (c) 1989, 1993 50bb2aabfSGleb Kurtsou * The Regents of the University of California. All rights reserved. 60bb2aabfSGleb Kurtsou * 70bb2aabfSGleb Kurtsou * Redistribution and use in source and binary forms, with or without 80bb2aabfSGleb Kurtsou * modification, are permitted provided that the following conditions 90bb2aabfSGleb Kurtsou * are met: 100bb2aabfSGleb Kurtsou * 1. Redistributions of source code must retain the above copyright 110bb2aabfSGleb Kurtsou * notice, this list of conditions and the following disclaimer. 120bb2aabfSGleb Kurtsou * 2. Redistributions in binary form must reproduce the above copyright 130bb2aabfSGleb Kurtsou * notice, this list of conditions and the following disclaimer in the 140bb2aabfSGleb Kurtsou * documentation and/or other materials provided with the distribution. 150bb2aabfSGleb Kurtsou * 3. Neither the name of the University nor the names of its contributors 160bb2aabfSGleb Kurtsou * may be used to endorse or promote products derived from this software 170bb2aabfSGleb Kurtsou * without specific prior written permission. 180bb2aabfSGleb Kurtsou * 190bb2aabfSGleb Kurtsou * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 200bb2aabfSGleb Kurtsou * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 210bb2aabfSGleb Kurtsou * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 220bb2aabfSGleb Kurtsou * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 230bb2aabfSGleb Kurtsou * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 240bb2aabfSGleb Kurtsou * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 250bb2aabfSGleb Kurtsou * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 260bb2aabfSGleb Kurtsou * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 270bb2aabfSGleb Kurtsou * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 280bb2aabfSGleb Kurtsou * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 290bb2aabfSGleb Kurtsou * SUCH DAMAGE. 300bb2aabfSGleb Kurtsou */ 310bb2aabfSGleb Kurtsou 320bb2aabfSGleb Kurtsou #ifndef _GEN_PRIVATE_H_ 330bb2aabfSGleb Kurtsou #define _GEN_PRIVATE_H_ 340bb2aabfSGleb Kurtsou 350bb2aabfSGleb Kurtsou struct _telldir; /* see telldir.h */ 360bb2aabfSGleb Kurtsou struct pthread_mutex; 370bb2aabfSGleb Kurtsou 380bb2aabfSGleb Kurtsou /* 390bb2aabfSGleb Kurtsou * Structure describing an open directory. 400bb2aabfSGleb Kurtsou * 410bb2aabfSGleb Kurtsou * NOTE. Change structure layout with care, at least dd_fd field has to 420bb2aabfSGleb Kurtsou * remain unchanged to guarantee backward compatibility. 430bb2aabfSGleb Kurtsou */ 440bb2aabfSGleb Kurtsou struct _dirdesc { 450bb2aabfSGleb Kurtsou int dd_fd; /* file descriptor associated with directory */ 46*42e61301SDag-Erling Smørgrav size_t dd_loc; /* offset in current buffer */ 47*42e61301SDag-Erling Smørgrav size_t dd_size; /* amount of data returned by getdirentries */ 480bb2aabfSGleb Kurtsou char *dd_buf; /* data buffer */ 490bb2aabfSGleb Kurtsou int dd_len; /* size of data buffer */ 5069921123SKonstantin Belousov off_t dd_seek; /* magic cookie returned by getdirentries */ 510bb2aabfSGleb Kurtsou int dd_flags; /* flags for readdir */ 52b54a59f3SAlex Richardson #ifndef IN_RTLD 530bb2aabfSGleb Kurtsou struct pthread_mutex *dd_lock; /* lock */ 54b54a59f3SAlex Richardson #else 55b54a59f3SAlex Richardson struct _donotuse *dd_lock; /* unused in rtld, keep same layout */ 56b54a59f3SAlex Richardson #endif 570bb2aabfSGleb Kurtsou struct _telldir *dd_td; /* telldir position recording */ 5869921123SKonstantin Belousov void *dd_compat_de; /* compat dirent */ 590bb2aabfSGleb Kurtsou }; 600bb2aabfSGleb Kurtsou 610bb2aabfSGleb Kurtsou #define _dirfd(dirp) ((dirp)->dd_fd) 620bb2aabfSGleb Kurtsou 6369921123SKonstantin Belousov struct dirent; 6469921123SKonstantin Belousov int __readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result); 6569921123SKonstantin Belousov 660bb2aabfSGleb Kurtsou #endif /* !_GEN_PRIVATE_H_ */ 67