From f5ba2bc9ca84d67f03f2542bfff0525f2f478e4c Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Fri, 18 Mar 2011 21:52:26 -0400 Subject: [PATCH] various legacy and linux-specific stuff this commit is part of an effort to make more of busybox work out-of-the-box. --- arch/i386/bits/termios.h | 1 + arch/x86_64/bits/termios.h | 1 + include/sys/sendfile.h | 16 +++++++ include/sys/timex.h | 91 ++++++++++++++++++++++++++++++++++++++ include/utmp.h | 2 + include/utmpx.h | 7 ++- src/stub/utmpx.c | 5 +++ 7 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 include/sys/sendfile.h create mode 100644 include/sys/timex.h diff --git a/arch/i386/bits/termios.h b/arch/i386/bits/termios.h index 316baeb2..9f6abd83 100644 --- a/arch/i386/bits/termios.h +++ b/arch/i386/bits/termios.h @@ -138,6 +138,7 @@ struct termios #define IEXTEN 0100000 /* Extensions? */ +#define CBAUDEX 0010000 #define ECHOCTL 0001000 #define ECHOPRT 0002000 #define ECHOKE 0004000 diff --git a/arch/x86_64/bits/termios.h b/arch/x86_64/bits/termios.h index 316baeb2..9f6abd83 100644 --- a/arch/x86_64/bits/termios.h +++ b/arch/x86_64/bits/termios.h @@ -138,6 +138,7 @@ struct termios #define IEXTEN 0100000 /* Extensions? */ +#define CBAUDEX 0010000 #define ECHOCTL 0001000 #define ECHOPRT 0002000 #define ECHOKE 0004000 diff --git a/include/sys/sendfile.h b/include/sys/sendfile.h new file mode 100644 index 00000000..f0c6ed05 --- /dev/null +++ b/include/sys/sendfile.h @@ -0,0 +1,16 @@ +#ifndef _SYS_INOTIFY_H +#define _SYS_INOTIFY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +ssize_t sendfile(int, int, off_t *, size_t); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/sys/timex.h b/include/sys/timex.h new file mode 100644 index 00000000..a1689777 --- /dev/null +++ b/include/sys/timex.h @@ -0,0 +1,91 @@ +#ifndef _SYS_TIMEX_H +#define _SYS_TIMEX_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +struct npttimeval { + struct timeval time; + long maxerror, esterror; +}; + +struct timex { + unsigned modes; + long offset, freq, maxerror, esterror; + int status; + long constant, precision, tolerance; + struct timeval time; + long tick, ppsfreq, jitter; + int shift; + long stabil, jitcnt, calcnt, errcnt, stbcnt; + int tai; + int __padding[11]; +}; + +#define ADJ_OFFSET 0x0001 +#define ADJ_FREQUENCY 0x0002 +#define ADJ_MAXERROR 0x0004 +#define ADJ_ESTERROR 0x0008 +#define ADJ_STATUS 0x0010 +#define ADJ_TIMECONST 0x0020 +#define ADJ_TAI 0x0080 +#define ADJ_MICRO 0x1000 +#define ADJ_NANO 0x2000 +#define ADJ_TICK 0x4000 +#define ADJ_OFFSET_SINGLESHOT 0x8001 +#define ADJ_OFFSET_SS_READ 0xa001 + +#define MOD_OFFSET ADJ_OFFSET +#define MOD_FREQUENCY ADJ_FREQUENCY +#define MOD_MAXERROR ADJ_MAXERROR +#define MOD_ESTERROR ADJ_ESTERROR +#define MOD_STATUS ADJ_STATUS +#define MOD_TIMECONST ADJ_TIMECONST +#define MOD_CLKB ADJ_TICK +#define MOD_CLKA ADJ_OFFSET_SINGLESHOT +#define MOD_MICRO ADJ_MICRO +#define MOD_NANO ADJ_NANO + +#define STA_PLL 0x0001 +#define STA_PPSFREQ 0x0002 +#define STA_PPSTIME 0x0004 +#define STA_FLL 0x0008 + +#define STA_INS 0x0010 +#define STA_DEL 0x0020 +#define STA_UNSYNC 0x0040 +#define STA_FREQHOLD 0x0080 + +#define STA_PPSSIGNAL 0x0100 +#define STA_PPSJITTER 0x0200 +#define STA_PPSWANDER 0x0400 +#define STA_PPSERROR 0x0800 + +#define STA_CLOCKERR 0x1000 +#define STA_NANO 0x2000 +#define STA_MODE 0x4000 +#define STA_CLK 0x8000 + +#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ + STA_PPSERROR | STA_CLOCKERR) + +#define TIME_OK 0 +#define TIME_INS 1 +#define TIME_DEL 2 +#define TIME_OOP 3 +#define TIME_WAIT 4 +#define TIME_ERROR 5 +#define TIME_BAD TIME_ERROR + +#define MAXTC 6 + +int adjtimex(struct timex *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/utmp.h b/include/utmp.h index ff3e45e1..540bec34 100644 --- a/include/utmp.h +++ b/include/utmp.h @@ -22,6 +22,8 @@ struct utmp *getutline(const struct utmp *); struct utmp *pututline(const struct utmp *); void setutent(void); +void updwtmp(const char *, const struct utmp *); + #define _PATH_UTMP "/dev/null" #define _PATH_WTMP "/dev/null" diff --git a/include/utmpx.h b/include/utmpx.h index 9a2e3075..592c0cd2 100644 --- a/include/utmpx.h +++ b/include/utmpx.h @@ -11,11 +11,13 @@ extern "C" { #include +#define UT_LINESIZE 32 + struct utmpx { short ut_type; pid_t ut_pid; - char ut_line[32]; + char ut_line[UT_LINESIZE]; char ut_id[4]; char ut_user[32]; char ut_host[256]; @@ -36,7 +38,10 @@ struct utmpx *getutxline(const struct utmpx *); struct utmpx *pututxline(const struct utmpx *); void setutxent(void); +void updwtmpx(const char *, const struct utmpx *); + #define EMPTY 0 +#define RUN_LVL 1 #define BOOT_TIME 2 #define NEW_TIME 3 #define OLD_TIME 4 diff --git a/src/stub/utmpx.c b/src/stub/utmpx.c index 42190ec2..c483e4ed 100644 --- a/src/stub/utmpx.c +++ b/src/stub/utmpx.c @@ -30,9 +30,14 @@ struct utmpx *pututxline(const struct utmpx *ut) return NULL; } +void updwtmpx(const char *f, const struct utmpx *u) +{ +} + weak_alias(endutxent, endutent); weak_alias(setutxent, setutent); weak_alias(getutxent, getutent); weak_alias(getutxid, getutid); weak_alias(getutxline, getutline); weak_alias(pututxline, pututline); +weak_alias(updwtmpx, updwtmp);