busybox/include/shadow_.h
Denys Vlasenko 908b6e5dfd libpwdgrp: use FAST_FUNC to make "matching ABI" optimization more likely to succeed
See bb_internal_get*nam_r size reduction:

function                                             old     new   delta
bb_internal_getpwent_r                               167     176      +9
getXXnam_r                                           204     206      +2
sulogin_main                                         326     325      -1
su_main                                              471     470      -1
read_line_input                                     3832    3831      -1
print_stat                                           865     864      -1
prepare_socket_fd                                    283     282      -1
load_crontab                                         777     776      -1
fork_job                                             456     455      -1
do_shm                                               884     883      -1
do_sem                                               637     636      -1
do_msg                                               783     782      -1
complete_username                                    124     123      -1
bb_internal_getgrouplist                              71      70      -1
xgetpwuid                                             27      25      -2
xgetpwnam                                             27      25      -2
xgetgrnam                                             27      25      -2
xgetgrgid                                             27      25      -2
uid2uname                                             18      16      -2
login_main                                           980     978      -2
gid2group                                             18      16      -2
get_shell_name                                        54      52      -2
change_identity                                       50      48      -2
bb_internal_initgroups                                50      48      -2
argstr                                              1261    1259      -2
print_perms                                          177     174      -3
inetd_main                                          2077    2074      -3
run_applet_no_and_exit                               446     442      -4
fileaction_setowngrp                                  89      85      -4
deluser_main                                         312     308      -4
bb_internal_getpwuid                                  19      15      -4
bb_internal_getpwnam                                  11       7      -4
bb_internal_getgrnam                                  14      10      -4
bb_internal_getgrgid                                  19      15      -4
adduser_main                                         865     861      -4
passwd_main                                          989     984      -5
get_passwd                                            97      92      -5
data_extract_all                                     887     882      -5
check_user_passwd                                    490     485      -5
get_groups                                            81      75      -6
ftpd_main                                           2178    2171      -7
bb_internal_getspnam_r                                42      18     -24
bb_internal_getpwnam_r                                39      15     -24
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/41 up/down: 11/-153)         Total: -142 bytes
   text	   data	    bss	    dec	    hex	filename
 923167	    928	  17676	 941771	  e5ecb	busybox_old
 923023	    928	  17676	 941627	  e5e3b	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-02 22:31:07 +01:00

107 lines
3.7 KiB
C

/* vi: set sw=4 ts=4: */
/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/* Declaration of types and functions for shadow password suite */
#ifndef BB_SHADOW_H
#define BB_SHADOW_H 1
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
/* Structure of the password file */
struct spwd {
char *sp_namp; /* Login name */
char *sp_pwdp; /* Encrypted password */
long sp_lstchg; /* Date of last change */
long sp_min; /* Minimum number of days between changes */
long sp_max; /* Maximum number of days between changes */
long sp_warn; /* Number of days to warn user to change the password */
long sp_inact; /* Number of days the account may be inactive */
long sp_expire; /* Number of days since 1970-01-01 until account expires */
unsigned long sp_flag; /* Reserved */
};
#define setspent bb_internal_setspent
#define endspent bb_internal_endspent
#define getspent bb_internal_getspent
#define getspnam bb_internal_getspnam
#define sgetspent bb_internal_sgetspent
#define fgetspent bb_internal_fgetspent
#define putspent bb_internal_putspent
#define getspent_r bb_internal_getspent_r
#define getspnam_r bb_internal_getspnam_r
#define sgetspent_r bb_internal_sgetspent_r
#define fgetspent_r bb_internal_fgetspent_r
#define lckpwdf bb_internal_lckpwdf
#define ulckpwdf bb_internal_ulckpwdf
/* All function names below should be remapped by #defines above
* in order to not collide with libc names. */
#ifdef UNUSED_FOR_NOW
/* Open database for reading */
void FAST_FUNC setspent(void);
/* Close database */
void FAST_FUNC endspent(void);
/* Get next entry from database, perhaps after opening the file */
struct spwd* FAST_FUNC getspent(void);
/* Get shadow entry matching NAME */
struct spwd* FAST_FUNC getspnam(const char *__name);
/* Read shadow entry from STRING */
struct spwd* FAST_FUNC sgetspent(const char *__string);
/* Read next shadow entry from STREAM */
struct spwd* FAST_FUNC fgetspent(FILE *__stream);
/* Write line containing shadow password entry to stream */
int FAST_FUNC putspent(const struct spwd *__p, FILE *__stream);
/* Reentrant versions of some of the functions above */
int FAST_FUNC getspent_r(struct spwd *__result_buf, char *__buffer,
size_t __buflen, struct spwd **__result);
#endif
int FAST_FUNC getspnam_r(const char *__name, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
struct spwd **__result);
#ifdef UNUSED_FOR_NOW
int FAST_FUNC sgetspent_r(const char *__string, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
struct spwd **__result);
int FAST_FUNC fgetspent_r(FILE *__stream, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
struct spwd **__result);
/* Protect password file against multi writers */
int FAST_FUNC lckpwdf(void);
/* Unlock password file */
int FAST_FUNC ulckpwdf(void);
#endif
POP_SAVED_FUNCTION_VISIBILITY
#endif /* shadow.h */