Skip to content

Commit

Permalink
move utmp.h include to libbb.h
Browse files Browse the repository at this point in the history
Signed-off-by: Denys Vlasenko <[email protected]>
  • Loading branch information
Denys Vlasenko committed Jan 25, 2011
1 parent 9aa599d commit 8d0e0cd
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 38 deletions.
20 changes: 10 additions & 10 deletions Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -284,26 +284,26 @@ config FEATURE_CLEAN_UP
Don't enable this unless you have a really good reason to clean
things up manually.

config FEATURE_UTMP
bool "Support utmp file"
default y
help
The file /var/run/utmp is used to track who is currently logged in.
With this option on, certain applets (getty, login, telnetd etc)
will create and delete entries there.
"who" applet requires this option.

config FEATURE_WTMP
bool "Support wtmp file"
default y
select FEATURE_UTMP
depends on FEATURE_UTMP
help
The file /var/run/wtmp is used to track when users have logged into
and logged out of the system.
With this option on, certain applets (getty, login, telnetd etc)
will append new entries there.
"last" applet requires this option.

config FEATURE_UTMP
bool "Support utmp file"
default y
help
The file /var/run/utmp is used to track who is currently logged in.
With this option on, certain applets (getty, login, telnetd etc)
will create and delete entries there.
"who" applet requires this option.

config FEATURE_PIDFILE
bool "Support writing pidfiles"
default y
Expand Down
1 change: 0 additions & 1 deletion coreutils/who.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
/* BB_AUDIT SUSv3 _NOT_ compliant -- missing options -b, -d, -l, -m, -p, -q, -r, -s, -t, -T, -u; Missing argument 'file'. */

#include "libbb.h"
#include <utmp.h>

static void idle_string(char *str6, time_t t)
{
Expand Down
3 changes: 3 additions & 0 deletions include/libbb.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
# include <selinux/flask.h>
# include <selinux/av_permissions.h>
#endif
#if ENABLE_FEATURE_UTMP
# include <utmp.h>
#endif
#if ENABLE_LOCALE_SUPPORT
# include <locale.h>
#else
Expand Down
1 change: 0 additions & 1 deletion init/halt.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@

#if ENABLE_FEATURE_WTMP
#include <sys/utsname.h>
#include <utmp.h>

static void write_wtmp(void)
{
Expand Down
3 changes: 0 additions & 3 deletions init/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@
#ifdef __linux__
#include <linux/vt.h>
#endif
#if ENABLE_FEATURE_UTMP
# include <utmp.h> /* DEAD_PROCESS */
#endif
#include "reboot.h" /* reboot() constants */

/* Used only for sanitizing purposes in set_sane_term() below. On systems where
Expand Down
11 changes: 6 additions & 5 deletions libbb/messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,16 @@ const int const_int_1 = 1;
* and it will end up in bss */
const int const_int_0 = 0;

#include <utmp.h>
#if ENABLE_FEATURE_WTMP
/* This is usually something like "/var/adm/wtmp" or "/var/log/wtmp" */
const char bb_path_wtmp_file[] ALIGN1 =
#if defined _PATH_WTMP
# if defined _PATH_WTMP
_PATH_WTMP;
#elif defined WTMP_FILE
# elif defined WTMP_FILE
WTMP_FILE;
#else
#error unknown path to wtmp file
# else
# error unknown path to wtmp file
# endif
#endif

/* We use it for "global" data via *(struct global*)&bb_common_bufsiz1.
Expand Down
1 change: 0 additions & 1 deletion libbb/utmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* Licensed under GPLv2, see file LICENSE in this source tree.
*/
#include "libbb.h"
#include <utmp.h>

static void touch(const char *filename)
{
Expand Down
6 changes: 3 additions & 3 deletions loginutils/adduser.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ static void addgroup_wrapper(struct passwd *p, const char *group_name)
free(cmd);
}

static void passwd_wrapper(const char *login) NORETURN;
static void passwd_wrapper(const char *login_name) NORETURN;

static void passwd_wrapper(const char *login)
static void passwd_wrapper(const char *login_name)
{
BB_EXECLP("passwd", "passwd", login, NULL);
BB_EXECLP("passwd", "passwd", login_name, NULL);
bb_error_msg_and_die("can't execute passwd, you must set password manually");
}

Expand Down
3 changes: 0 additions & 3 deletions loginutils/getty.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@

#include "libbb.h"
#include <syslog.h>
#if ENABLE_FEATURE_UTMP
# include <utmp.h> /* LOGIN_PROCESS */
#endif
#ifndef IUCLC
# define IUCLC 0
#endif
Expand Down
3 changes: 0 additions & 3 deletions loginutils/login.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
*/
#include "libbb.h"
#include <syslog.h>
#if ENABLE_FEATURE_UTMP
# include <utmp.h> /* USER_PROCESS */
#endif
#include <sys/resource.h>

#if ENABLE_SELINUX
Expand Down
1 change: 0 additions & 1 deletion miscutils/last.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/

#include "libbb.h"
#include <utmp.h>

/* NB: ut_name and ut_user are the same field, use only one name (ut_user)
* to reduce confusion */
Expand Down
1 change: 0 additions & 1 deletion miscutils/last_fancy.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/

#include "libbb.h"
#include <utmp.h>

/* NB: ut_name and ut_user are the same field, use only one name (ut_user)
* to reduce confusion */
Expand Down
1 change: 0 additions & 1 deletion miscutils/runlevel.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* initially busyboxified by Bernhard Reutner-Fischer
*/
#include "libbb.h"
#include <utmp.h>

int runlevel_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int runlevel_main(int argc UNUSED_PARAM, char **argv)
Expand Down
1 change: 0 additions & 1 deletion miscutils/wall.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

#include "libbb.h"
#include <utmp.h>

int wall_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int wall_main(int argc UNUSED_PARAM, char **argv)
Expand Down
4 changes: 0 additions & 4 deletions networking/telnetd.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
#endif
#include <arpa/telnet.h>

#if ENABLE_FEATURE_UTMP
# include <utmp.h> /* LOGIN_PROCESS */
#endif


struct tsession {
struct tsession *next;
Expand Down
2 changes: 2 additions & 0 deletions shell/ash.c
Original file line number Diff line number Diff line change
Expand Up @@ -4944,6 +4944,8 @@ stoppedjobs(void)
* Code for dealing with input/output redirection.
*/

#undef EMPTY
#undef CLOSED
#define EMPTY -2 /* marks an unused slot in redirtab */
#define CLOSED -3 /* marks a slot of previously-closed fd */

Expand Down

0 comments on commit 8d0e0cd

Please sign in to comment.