Blame pwd/pwd.h

Packit Service 82fcde
/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
Packit Service 82fcde
   This file is part of the GNU C Library.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 82fcde
   modify it under the terms of the GNU Lesser General Public
Packit Service 82fcde
   License as published by the Free Software Foundation; either
Packit Service 82fcde
   version 2.1 of the License, or (at your option) any later version.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 82fcde
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 82fcde
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 82fcde
   Lesser General Public License for more details.
Packit Service 82fcde
Packit Service 82fcde
   You should have received a copy of the GNU Lesser General Public
Packit Service 82fcde
   License along with the GNU C Library; if not, see
Packit Service 82fcde
   <http://www.gnu.org/licenses/>.  */
Packit Service 82fcde
Packit Service 82fcde
/*
Packit Service 82fcde
 *	POSIX Standard: 9.2.2 User Database Access	<pwd.h>
Packit Service 82fcde
 */
Packit Service 82fcde
Packit Service 82fcde
#ifndef	_PWD_H
Packit Service 82fcde
#define	_PWD_H	1
Packit Service 82fcde
Packit Service 82fcde
#include <features.h>
Packit Service 82fcde
Packit Service 82fcde
__BEGIN_DECLS
Packit Service 82fcde
Packit Service 82fcde
#include <bits/types.h>
Packit Service 82fcde
Packit Service 82fcde
#define __need_size_t
Packit Service 82fcde
#include <stddef.h>
Packit Service 82fcde
Packit Service 82fcde
#if defined __USE_XOPEN || defined __USE_XOPEN2K
Packit Service 82fcde
/* The Single Unix specification says that some more types are
Packit Service 82fcde
   available here.  */
Packit Service 82fcde
# ifndef __gid_t_defined
Packit Service 82fcde
typedef __gid_t gid_t;
Packit Service 82fcde
#  define __gid_t_defined
Packit Service 82fcde
# endif
Packit Service 82fcde
Packit Service 82fcde
# ifndef __uid_t_defined
Packit Service 82fcde
typedef __uid_t uid_t;
Packit Service 82fcde
#  define __uid_t_defined
Packit Service 82fcde
# endif
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
/* A record in the user database.  */
Packit Service 82fcde
struct passwd
Packit Service 82fcde
{
Packit Service 82fcde
  char *pw_name;		/* Username.  */
Packit Service 82fcde
  char *pw_passwd;		/* Hashed passphrase, if shadow database
Packit Service 82fcde
                                   not in use (see shadow.h).  */
Packit Service 82fcde
  __uid_t pw_uid;		/* User ID.  */
Packit Service 82fcde
  __gid_t pw_gid;		/* Group ID.  */
Packit Service 82fcde
  char *pw_gecos;		/* Real name.  */
Packit Service 82fcde
  char *pw_dir;			/* Home directory.  */
Packit Service 82fcde
  char *pw_shell;		/* Shell program.  */
Packit Service 82fcde
};
Packit Service 82fcde
Packit Service 82fcde
Packit Service 82fcde
#ifdef __USE_MISC
Packit Service 82fcde
# include <bits/types/FILE.h>
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
Packit Service 82fcde
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
Packit Service 82fcde
/* Rewind the user database stream.
Packit Service 82fcde
Packit Service 82fcde
   This function is a possible cancellation point and therefore not
Packit Service 82fcde
   marked with __THROW.  */
Packit Service 82fcde
extern void setpwent (void);
Packit Service 82fcde
Packit Service 82fcde
/* Close the user database stream.
Packit Service 82fcde
Packit Service 82fcde
   This function is a possible cancellation point and therefore not
Packit Service 82fcde
   marked with __THROW.  */
Packit Service 82fcde
extern void endpwent (void);
Packit Service 82fcde
Packit Service 82fcde
/* Read an entry from the user database stream, opening it if necessary.
Packit Service 82fcde
Packit Service 82fcde
   This function is a possible cancellation point and therefore not
Packit Service 82fcde
   marked with __THROW.  */
Packit Service 82fcde
extern struct passwd *getpwent (void);
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
#ifdef	__USE_MISC
Packit Service 82fcde
/* Read a user database entry from STREAM.
Packit Service 82fcde
Packit Service 82fcde
   This function is not part of POSIX and therefore no official
Packit Service 82fcde
   cancellation point.  But due to similarity with an POSIX interface
Packit Service 82fcde
   or due to the implementation it is a cancellation point and
Packit Service 82fcde
   therefore not marked with __THROW.  */
Packit Service 82fcde
extern struct passwd *fgetpwent (FILE *__stream) __nonnull ((1));
Packit Service 82fcde
Packit Service 82fcde
/* Write a given user database entry onto the given stream.
Packit Service 82fcde
Packit Service 82fcde
   This function is not part of POSIX and therefore no official
Packit Service 82fcde
   cancellation point.  But due to similarity with an POSIX interface
Packit Service 82fcde
   or due to the implementation it is a cancellation point and
Packit Service 82fcde
   therefore not marked with __THROW.  */
Packit Service 82fcde
extern int putpwent (const struct passwd *__restrict __p,
Packit Service 82fcde
		     FILE *__restrict __f);
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
/* Retrieve the user database entry for the given user ID.
Packit Service 82fcde
Packit Service 82fcde
   This function is a possible cancellation point and therefore not
Packit Service 82fcde
   marked with __THROW.  */
Packit Service 82fcde
extern struct passwd *getpwuid (__uid_t __uid);
Packit Service 82fcde
Packit Service 82fcde
/* Retrieve the user database entry for the given username.
Packit Service 82fcde
Packit Service 82fcde
   This function is a possible cancellation point and therefore not
Packit Service 82fcde
   marked with __THROW.  */
Packit Service 82fcde
extern struct passwd *getpwnam (const char *__name) __nonnull ((1));
Packit Service 82fcde
Packit Service 82fcde
#ifdef __USE_POSIX
Packit Service 82fcde
Packit Service 82fcde
# ifdef __USE_MISC
Packit Service 82fcde
/* Reasonable value for the buffer sized used in the reentrant
Packit Service 82fcde
   functions below.  But better use `sysconf'.  */
Packit Service 82fcde
#  define NSS_BUFLEN_PASSWD	1024
Packit Service 82fcde
# endif
Packit Service 82fcde
Packit Service 82fcde
/* Reentrant versions of some of the functions above.
Packit Service 82fcde
Packit Service 82fcde
   PLEASE NOTE: the `getpwent_r' function is not (yet) standardized.
Packit Service 82fcde
   The interface may change in later versions of this library.  But
Packit Service 82fcde
   the interface is designed following the principals used for the
Packit Service 82fcde
   other reentrant functions so the chances are good this is what the
Packit Service 82fcde
   POSIX people would choose.  */
Packit Service 82fcde
Packit Service 82fcde
# ifdef __USE_MISC
Packit Service 82fcde
/* This function is not part of POSIX and therefore no official
Packit Service 82fcde
   cancellation point.  But due to similarity with an POSIX interface
Packit Service 82fcde
   or due to the implementation it is a cancellation point and
Packit Service 82fcde
   therefore not marked with __THROW.  */
Packit Service 82fcde
extern int getpwent_r (struct passwd *__restrict __resultbuf,
Packit Service 82fcde
		       char *__restrict __buffer, size_t __buflen,
Packit Service 82fcde
		       struct passwd **__restrict __result)
Packit Service 82fcde
		       __nonnull ((1, 2, 4));
Packit Service 82fcde
# endif
Packit Service 82fcde
Packit Service 82fcde
extern int getpwuid_r (__uid_t __uid,
Packit Service 82fcde
		       struct passwd *__restrict __resultbuf,
Packit Service 82fcde
		       char *__restrict __buffer, size_t __buflen,
Packit Service 82fcde
		       struct passwd **__restrict __result)
Packit Service 82fcde
		       __nonnull ((2, 3, 5));
Packit Service 82fcde
Packit Service 82fcde
extern int getpwnam_r (const char *__restrict __name,
Packit Service 82fcde
		       struct passwd *__restrict __resultbuf,
Packit Service 82fcde
		       char *__restrict __buffer, size_t __buflen,
Packit Service 82fcde
		       struct passwd **__restrict __result)
Packit Service 82fcde
		       __nonnull ((1, 2, 3, 5));
Packit Service 82fcde
Packit Service 82fcde
Packit Service 82fcde
# ifdef	__USE_MISC
Packit Service 82fcde
/* Read a user database entry from STREAM.  This function is not
Packit Service 82fcde
   standardized and probably never will.
Packit Service 82fcde
Packit Service 82fcde
   This function is not part of POSIX and therefore no official
Packit Service 82fcde
   cancellation point.  But due to similarity with an POSIX interface
Packit Service 82fcde
   or due to the implementation it is a cancellation point and
Packit Service 82fcde
   therefore not marked with __THROW.  */
Packit Service 82fcde
extern int fgetpwent_r (FILE *__restrict __stream,
Packit Service 82fcde
			struct passwd *__restrict __resultbuf,
Packit Service 82fcde
			char *__restrict __buffer, size_t __buflen,
Packit Service 82fcde
			struct passwd **__restrict __result)
Packit Service 82fcde
			__nonnull ((1, 2, 3, 5));
Packit Service 82fcde
# endif
Packit Service 82fcde
Packit Service 82fcde
#endif	/* POSIX or reentrant */
Packit Service 82fcde
Packit Service 82fcde
#ifdef __USE_GNU
Packit Service 82fcde
/* Write a traditional /etc/passwd line, based on the user database
Packit Service 82fcde
   entry for the given UID, to BUFFER; space for BUFFER must be
Packit Service 82fcde
   allocated by the caller.
Packit Service 82fcde
Packit Service 82fcde
   This function is not part of POSIX and therefore no official
Packit Service 82fcde
   cancellation point.  But due to similarity with an POSIX interface
Packit Service 82fcde
   or due to the implementation it is a cancellation point and
Packit Service 82fcde
   therefore not marked with __THROW.  */
Packit Service 82fcde
extern int getpw (__uid_t __uid, char *__buffer);
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
__END_DECLS
Packit Service 82fcde
Packit Service 82fcde
#endif /* pwd.h  */