home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue4 / SDL / gcc346 / !gcc / include / unixlib / h / grp < prev    next >
Encoding:
Text File  |  2006-09-17  |  3.9 KB  |  130 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /usr/local/cvsroot/gccsdk/unixlib/source/clib/grp.h,v $
  4.  * $Date: 2005/04/14 12:13:09 $
  5.  * $Revision: 1.8 $
  6.  * $State: Exp $
  7.  * $Author: nick $
  8.  *
  9.  ***************************************************************************/
  10.  
  11. #ifndef __GRP_H
  12. #define __GRP_H 1
  13.  
  14. #ifndef __UNIXLIB_FEATURES_H
  15. #include <features.h>
  16. #endif
  17.  
  18. #include <sys/types.h>
  19.  
  20. #define __need_size_t
  21. #include <stddef.h>
  22.  
  23. #if (defined __USE_XOPEN || defined __USE_XOPEN2K) && !defined __gid_t_defined
  24. typedef __gid_t gid_t;
  25. #define __gid_t_defined
  26. #endif
  27.  
  28. __BEGIN_DECLS
  29.  
  30. #if defined __USE_SVID || defined __USE_GNU
  31. #define __need_FILE
  32. #include <stdio.h>
  33. #endif
  34.  
  35. struct group
  36. {
  37.   char *gr_name; /* Group name.  */
  38.   char *gr_passwd; /* Group password.  */
  39.   __gid_t gr_gid; /* Group ID.  */
  40.   char **gr_mem; /* Group members.  */
  41. };
  42.  
  43. /* Search for an entry with a matching group ID.
  44.    This function is a cancellation point.  */
  45. extern struct group *getgrgid (gid_t __gid) __wur;
  46.  
  47. /* Search for an entry with a matching group name.
  48.    This function is a cancellation point.  */
  49. extern struct group *getgrnam (const char *__name) __nonnull ((1)) __wur;
  50.  
  51. #if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
  52. /* Rewind the group-file stream.
  53.    This function is a cancellation point.  */
  54. extern void setgrent (void);
  55.  
  56. /* Close the group-file stream.
  57.    This function is a cancellation point.  */
  58. extern void endgrent (void);
  59.  
  60. /* Read an entry from the group-file stream, opening it if necessary.
  61.    This function is a cancellation point.  */
  62. extern struct group *getgrent (void) __wur;
  63. #endif
  64.  
  65. #ifdef __USE_SVID
  66. /* Read an entry from stream.  This function is a cancellation point.  */
  67. extern struct group *fgetgrent (FILE *__stream) __nonnull ((1)) __wur;
  68.  
  69. /* Read an entry from stream (re-entrant version).
  70.    This function is a cancellation point.  */
  71. extern int fgetgrent_r (FILE *__restrict __stream,
  72.             struct group *__restrict __result_buf,
  73.             char *__restrict __buffer, size_t __buflen,
  74.             struct group **__restrict __result)
  75.      __nonnull ((1, 3, 5));
  76. #endif
  77.  
  78. #if defined __USE_POSIX || defined __USE_MISC
  79.  
  80. #ifdef __USE_GNU
  81. /* Read an entry from the password-file stream, opening it if
  82.    necessary (re-entrant version).  This is a cancellation point.  */
  83. extern int getgrent_r (struct group *__restrict __result_buf,
  84.                char *__restrict __buffer, size_t __buflen,
  85.                struct group **__restrict __result)
  86.      __nonnull ((1, 2, 4));
  87. #endif
  88.  
  89.  
  90. /* Search for an entry with a matching group ID (re-entrant version).
  91.    This function is a cancellation point.  */
  92. extern int getgrgid_r (gid_t __gid, struct group *__resbuf, char *__buffer,
  93.                size_t __buflen, struct group **__result)
  94.      __nonnull ((2, 3, 5));
  95.  
  96. /* Search for an entry with a matching group name (re-entrant version).
  97.    This function is a cancellation point.  */
  98. extern int getgrnam_r (const char *__restrict __name,
  99.                struct group *__restrict __result_buf,
  100.                char *__restrict __buffer, size_t __buflen,
  101.                struct group **__restrict __result)
  102.      __nonnull ((1, 2, 3, 5));
  103. #endif /* __USE_POSIX || __USE_MISC */
  104.  
  105. #ifdef __USE_BSD
  106. /* Get a list of all supplementary groups this user is in.
  107.    This function is a cancellation point.  */
  108. extern int getgroups (int __gidsetlen, gid_t *__gidset) __nonnull ((2));
  109.  
  110. /* Set the list of supplementary groups this user is in */
  111. extern int setgroups (int __ngroups, const gid_t *__gidset)
  112.      __THROW __nonnull ((2));
  113.  
  114. /* Build a list of all groups the user is in, then call setgroups on the list.
  115.    This function is a cancellation point.  */
  116. extern int initgroups (const char *__name, gid_t __basegid)
  117.      __nonnull ((1));
  118. #endif
  119.  
  120. #ifdef __UNIXLIB_INTERNALS
  121. /* UnixLib group implementation function.  */
  122. extern struct group *__grpread (FILE *__stream, struct group *__grp,
  123.                 char *__buf, size_t __buflen)
  124.      __nonnull ((1, 2, 3)) __wur;
  125. #endif
  126.  
  127. __END_DECLS
  128.  
  129. #endif
  130.