Blame pwd/pwd.h

Packit 6c4009
/* Copyright (C) 1991-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
/*
Packit 6c4009
 *	POSIX Standard: 9.2.2 User Database Access	<pwd.h>
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#ifndef	_PWD_H
Packit 6c4009
#define	_PWD_H	1
Packit 6c4009
Packit 6c4009
#include <features.h>
Packit 6c4009
Packit 6c4009
__BEGIN_DECLS
Packit 6c4009
Packit 6c4009
#include <bits/types.h>
Packit 6c4009
Packit 6c4009
#define __need_size_t
Packit 6c4009
#include <stddef.h>
Packit 6c4009
Packit 6c4009
#if defined __USE_XOPEN || defined __USE_XOPEN2K
Packit 6c4009
/* The Single Unix specification says that some more types are
Packit 6c4009
   available here.  */
Packit 6c4009
# ifndef __gid_t_defined
Packit 6c4009
typedef __gid_t gid_t;
Packit 6c4009
#  define __gid_t_defined
Packit 6c4009
# endif
Packit 6c4009
Packit 6c4009
# ifndef __uid_t_defined
Packit 6c4009
typedef __uid_t uid_t;
Packit 6c4009
#  define __uid_t_defined
Packit 6c4009
# endif
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* A record in the user database.  */
Packit 6c4009
struct passwd
Packit 6c4009
{
Packit 6c4009
  char *pw_name;		/* Username.  */
Packit 6c4009
  char *pw_passwd;		/* Hashed passphrase, if shadow database
Packit 6c4009
                                   not in use (see shadow.h).  */
Packit 6c4009
  __uid_t pw_uid;		/* User ID.  */
Packit 6c4009
  __gid_t pw_gid;		/* Group ID.  */
Packit 6c4009
  char *pw_gecos;		/* Real name.  */
Packit 6c4009
  char *pw_dir;			/* Home directory.  */
Packit 6c4009
  char *pw_shell;		/* Shell program.  */
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
Packit 6c4009
#ifdef __USE_MISC
Packit 6c4009
# include <bits/types/FILE.h>
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
Packit 6c4009
/* Rewind the user database stream.
Packit 6c4009
Packit 6c4009
   This function is a possible cancellation point and therefore not
Packit 6c4009
   marked with __THROW.  */
Packit 6c4009
extern void setpwent (void);
Packit 6c4009
Packit 6c4009
/* Close the user database stream.
Packit 6c4009
Packit 6c4009
   This function is a possible cancellation point and therefore not
Packit 6c4009
   marked with __THROW.  */
Packit 6c4009
extern void endpwent (void);
Packit 6c4009
Packit 6c4009
/* Read an entry from the user database stream, opening it if necessary.
Packit 6c4009
Packit 6c4009
   This function is a possible cancellation point and therefore not
Packit 6c4009
   marked with __THROW.  */
Packit 6c4009
extern struct passwd *getpwent (void);
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifdef	__USE_MISC
Packit 6c4009
/* Read a user database entry from STREAM.
Packit 6c4009
Packit 6c4009
   This function is not part of POSIX and therefore no official
Packit 6c4009
   cancellation point.  But due to similarity with an POSIX interface
Packit 6c4009
   or due to the implementation it is a cancellation point and
Packit 6c4009
   therefore not marked with __THROW.  */
Packit 6c4009
extern struct passwd *fgetpwent (FILE *__stream) __nonnull ((1));
Packit 6c4009
Packit 6c4009
/* Write a given user database entry onto the given stream.
Packit 6c4009
Packit 6c4009
   This function is not part of POSIX and therefore no official
Packit 6c4009
   cancellation point.  But due to similarity with an POSIX interface
Packit 6c4009
   or due to the implementation it is a cancellation point and
Packit 6c4009
   therefore not marked with __THROW.  */
Packit 6c4009
extern int putpwent (const struct passwd *__restrict __p,
Packit 6c4009
		     FILE *__restrict __f);
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Retrieve the user database entry for the given user ID.
Packit 6c4009
Packit 6c4009
   This function is a possible cancellation point and therefore not
Packit 6c4009
   marked with __THROW.  */
Packit 6c4009
extern struct passwd *getpwuid (__uid_t __uid);
Packit 6c4009
Packit 6c4009
/* Retrieve the user database entry for the given username.
Packit 6c4009
Packit 6c4009
   This function is a possible cancellation point and therefore not
Packit 6c4009
   marked with __THROW.  */
Packit 6c4009
extern struct passwd *getpwnam (const char *__name) __nonnull ((1));
Packit 6c4009
Packit 6c4009
#ifdef __USE_POSIX
Packit 6c4009
Packit 6c4009
# ifdef __USE_MISC
Packit 6c4009
/* Reasonable value for the buffer sized used in the reentrant
Packit 6c4009
   functions below.  But better use `sysconf'.  */
Packit 6c4009
#  define NSS_BUFLEN_PASSWD	1024
Packit 6c4009
# endif
Packit 6c4009
Packit 6c4009
/* Reentrant versions of some of the functions above.
Packit 6c4009
Packit 6c4009
   PLEASE NOTE: the `getpwent_r' function is not (yet) standardized.
Packit 6c4009
   The interface may change in later versions of this library.  But
Packit 6c4009
   the interface is designed following the principals used for the
Packit 6c4009
   other reentrant functions so the chances are good this is what the
Packit 6c4009
   POSIX people would choose.  */
Packit 6c4009
Packit 6c4009
# ifdef __USE_MISC
Packit 6c4009
/* This function is not part of POSIX and therefore no official
Packit 6c4009
   cancellation point.  But due to similarity with an POSIX interface
Packit 6c4009
   or due to the implementation it is a cancellation point and
Packit 6c4009
   therefore not marked with __THROW.  */
Packit 6c4009
extern int getpwent_r (struct passwd *__restrict __resultbuf,
Packit 6c4009
		       char *__restrict __buffer, size_t __buflen,
Packit 6c4009
		       struct passwd **__restrict __result)
Packit 6c4009
		       __nonnull ((1, 2, 4));
Packit 6c4009
# endif
Packit 6c4009
Packit 6c4009
extern int getpwuid_r (__uid_t __uid,
Packit 6c4009
		       struct passwd *__restrict __resultbuf,
Packit 6c4009
		       char *__restrict __buffer, size_t __buflen,
Packit 6c4009
		       struct passwd **__restrict __result)
Packit 6c4009
		       __nonnull ((2, 3, 5));
Packit 6c4009
Packit 6c4009
extern int getpwnam_r (const char *__restrict __name,
Packit 6c4009
		       struct passwd *__restrict __resultbuf,
Packit 6c4009
		       char *__restrict __buffer, size_t __buflen,
Packit 6c4009
		       struct passwd **__restrict __result)
Packit 6c4009
		       __nonnull ((1, 2, 3, 5));
Packit 6c4009
Packit 6c4009
Packit 6c4009
# ifdef	__USE_MISC
Packit 6c4009
/* Read a user database entry from STREAM.  This function is not
Packit 6c4009
   standardized and probably never will.
Packit 6c4009
Packit 6c4009
   This function is not part of POSIX and therefore no official
Packit 6c4009
   cancellation point.  But due to similarity with an POSIX interface
Packit 6c4009
   or due to the implementation it is a cancellation point and
Packit 6c4009
   therefore not marked with __THROW.  */
Packit 6c4009
extern int fgetpwent_r (FILE *__restrict __stream,
Packit 6c4009
			struct passwd *__restrict __resultbuf,
Packit 6c4009
			char *__restrict __buffer, size_t __buflen,
Packit 6c4009
			struct passwd **__restrict __result)
Packit 6c4009
			__nonnull ((1, 2, 3, 5));
Packit 6c4009
# endif
Packit 6c4009
Packit 6c4009
#endif	/* POSIX or reentrant */
Packit 6c4009
Packit 6c4009
#ifdef __USE_GNU
Packit 6c4009
/* Write a traditional /etc/passwd line, based on the user database
Packit 6c4009
   entry for the given UID, to BUFFER; space for BUFFER must be
Packit 6c4009
   allocated by the caller.
Packit 6c4009
Packit 6c4009
   This function is not part of POSIX and therefore no official
Packit 6c4009
   cancellation point.  But due to similarity with an POSIX interface
Packit 6c4009
   or due to the implementation it is a cancellation point and
Packit 6c4009
   therefore not marked with __THROW.  */
Packit 6c4009
extern int getpw (__uid_t __uid, char *__buffer);
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
__END_DECLS
Packit 6c4009
Packit 6c4009
#endif /* pwd.h  */