stat.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #ifndef _SYS_STAT_H_
  2. #define _SYS_STAT_H_
  3. /*
  4. * Copyright (C) 2004-2005 by egnite Software GmbH. All rights reserved.
  5. *
  6. * Copyright (c) 1982, 1986, 1989, 1993
  7. * The Regents of the University of California. All rights reserved.
  8. * (c) UNIX System Laboratories, Inc.
  9. * All or some portions of this file are derived from material licensed
  10. * to the University of California by American Telephone and Telegraph
  11. * Co. or Unix System Laboratories, Inc. and are reproduced herein with
  12. * the permission of UNIX System Laboratories, Inc.
  13. *
  14. * Redistribution and use in source and binary forms, with or without
  15. * modification, are permitted provided that the following conditions
  16. * are met:
  17. * 1. Redistributions of source code must retain the above copyright
  18. * notice, this list of conditions and the following disclaimer.
  19. * 2. Redistributions in binary form must reproduce the above copyright
  20. * notice, this list of conditions and the following disclaimer in the
  21. * documentation and/or other materials provided with the distribution.
  22. * 3. Neither the name of the University nor the names of its contributors
  23. * may be used to endorse or promote products derived from this software
  24. * without specific prior written permission.
  25. *
  26. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  27. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  30. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  31. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  32. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  33. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  34. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  35. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  36. * SUCH DAMAGE.
  37. */
  38. /*!
  39. * \file sys/stat.h
  40. * \brief File system status declarations.
  41. *
  42. * \verbatim
  43. *
  44. * $Log$
  45. * Revision 1.3 2008/08/11 07:00:27 haraldkipp
  46. * BSD types replaced by stdint types (feature request #1282721).
  47. *
  48. * Revision 1.2 2008/04/01 10:16:35 haraldkipp
  49. * Added S_ISDIR and S_ISREG macro.
  50. *
  51. * Revision 1.1 2005/02/05 20:37:18 haraldkipp
  52. * Peanut added
  53. *
  54. *
  55. * \endverbatim
  56. */
  57. #include <stdint.h>
  58. #include <time.h>
  59. /*!
  60. * \addtogroup xgFS
  61. */
  62. /*@{*/
  63. /*!
  64. * \brief File status structure.
  65. */
  66. struct stat {
  67. short st_ino; /*!< \brief Block number */
  68. uint8_t st_mode; /*!< \brief Mode flags */
  69. uint16_t st_nlink; /*!< \brief Number of links */
  70. uint32_t st_size; /*!< \brief Size */
  71. time_t st_mtime; /*!< \brief Time of last modification */
  72. };
  73. #define S_ISDIR(m) ((m) != 0) /*!< \brief Check for directory. */
  74. #define S_ISREG(m) ((m) == 0) /*!< \brief Check for regular file. */
  75. /*@}*/
  76. extern int stat(const char *path, struct stat *s);
  77. extern int fstat(int fh, struct stat *s);
  78. extern int mkdir(const char *path, int mode);
  79. #endif