Blame sysdeps/posix/dirstream.h

Packit 6c4009
/* Copyright (C) 1993-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef	_DIRSTREAM_H
Packit 6c4009
#define	_DIRSTREAM_H	1
Packit 6c4009
Packit 6c4009
#include <sys/types.h>
Packit 6c4009
Packit 6c4009
#include <libc-lock.h>
Packit 6c4009
Packit 6c4009
/* Directory stream type.
Packit 6c4009
Packit 6c4009
   The miscellaneous Unix `readdir' implementations read directory data
Packit 6c4009
   into a buffer and return `struct dirent *' pointers into it.  */
Packit 6c4009
Packit 6c4009
struct __dirstream
Packit 6c4009
  {
Packit 6c4009
    int fd;			/* File descriptor.  */
Packit 6c4009
Packit 6c4009
    __libc_lock_define (, lock) /* Mutex lock for this structure.  */
Packit 6c4009
Packit 6c4009
    size_t allocation;		/* Space allocated for the block.  */
Packit 6c4009
    size_t size;		/* Total valid data in the block.  */
Packit 6c4009
    size_t offset;		/* Current offset into the block.  */
Packit 6c4009
Packit 6c4009
    off_t filepos;		/* Position of next entry to read.  */
Packit 6c4009
Packit 6c4009
    int errcode;		/* Delayed error code.  */
Packit 6c4009
Packit 6c4009
    /* Directory block.  We must make sure that this block starts
Packit 6c4009
       at an address that is aligned adequately enough to store
Packit 6c4009
       dirent entries.  Using the alignment of "void *" is not
Packit 6c4009
       sufficient because dirents on 32-bit platforms can require
Packit 6c4009
       64-bit alignment.  We use "long double" here to be consistent
Packit 6c4009
       with what malloc uses.  */
Packit 6c4009
    char data[0] __attribute__ ((aligned (__alignof__ (long double))));
Packit 6c4009
  };
Packit 6c4009
Packit 6c4009
#define _DIR_dirfd(dirp)	((dirp)->fd)
Packit 6c4009
Packit 6c4009
#endif	/* dirstream.h */