diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-20 17:27:40 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-20 17:27:40 +0000 |
commit | 45946f8b513d9c292613ac08c3ddf4a89b915752 (patch) | |
tree | d6ea51887431e4261a114b95989950d1973d3227 /runit/runit_lib.h | |
parent | 63db27f9f4c0ec8b9abe3c32c8d699be0781ffd6 (diff) | |
download | busybox-w32-45946f8b513d9c292613ac08c3ddf4a89b915752.tar.gz busybox-w32-45946f8b513d9c292613ac08c3ddf4a89b915752.tar.bz2 busybox-w32-45946f8b513d9c292613ac08c3ddf4a89b915752.zip |
runit/*: get rid of tai[a] time abstraction, it's too bloaty.
text data bss dec hex filename
772537 1058 11092 784687 bf92f busybox.t0/busybox
772459 1058 11060 784577 bf8c1 busybox.t1/busybox
772326 1058 11028 784412 bf81c busybox.t2/busybox
772158 1058 10980 784196 bf744 busybox.t3/busybox
771490 1055 10988 783533 bf4ad busybox.t4/busybox
Diffstat (limited to 'runit/runit_lib.h')
-rw-r--r-- | runit/runit_lib.h | 134 |
1 files changed, 51 insertions, 83 deletions
diff --git a/runit/runit_lib.h b/runit/runit_lib.h index 1dadb6e47..c73befcb6 100644 --- a/runit/runit_lib.h +++ b/runit/runit_lib.h | |||
@@ -25,107 +25,75 @@ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |||
25 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | /*** byte.h ***/ | ||
29 | |||
30 | extern unsigned byte_chr(char *s,unsigned n,int c); | 28 | extern unsigned byte_chr(char *s,unsigned n,int c); |
31 | 29 | ||
32 | |||
33 | /*** coe.h ***/ | ||
34 | |||
35 | extern int coe(int); | 30 | extern int coe(int); |
36 | 31 | ||
37 | |||
38 | /*** direntry.h ***/ | ||
39 | |||
40 | #define direntry struct dirent | 32 | #define direntry struct dirent |
41 | 33 | ||
42 | 34 | //struct tai { | |
43 | /*** tai.h ***/ | 35 | // uint64_t x; |
44 | 36 | //}; | |
45 | struct tai { | 37 | // |
46 | uint64_t x; | 38 | //#define tai_unix(t,u) ((void) ((t)->x = 0x400000000000000aULL + (uint64_t) (u))) |
47 | }; | 39 | // |
48 | 40 | //#define TAI_PACK 8 | |
49 | #define tai_unix(t,u) ((void) ((t)->x = 4611686018427387914ULL + (uint64_t) (u))) | 41 | //extern void tai_unpack(const char *,struct tai *); |
50 | 42 | // | |
51 | #define TAI_PACK 8 | 43 | //extern void tai_uint(struct tai *,unsigned); |
52 | //extern void tai_pack(char *,const struct tai *); | 44 | // |
53 | extern void tai_unpack(const char *,struct tai *); | 45 | //struct taia { |
54 | 46 | // struct tai sec; | |
55 | extern void tai_uint(struct tai *,unsigned); | 47 | // unsigned long nano; /* 0...999999999 */ |
56 | 48 | // unsigned long atto; /* 0...999999999 */ | |
57 | 49 | //}; | |
58 | /*** taia.h ***/ | 50 | // |
59 | 51 | //extern void taia_now(struct taia *); | |
60 | struct taia { | 52 | // |
61 | struct tai sec; | 53 | //extern void taia_add(struct taia *,const struct taia *,const struct taia *); |
62 | unsigned long nano; /* 0...999999999 */ | 54 | //extern void taia_addsec(struct taia *,const struct taia *,int); |
63 | unsigned long atto; /* 0...999999999 */ | 55 | //extern void taia_sub(struct taia *,const struct taia *,const struct taia *); |
64 | }; | 56 | //extern void taia_half(struct taia *,const struct taia *); |
65 | 57 | //extern int taia_less(const struct taia *,const struct taia *); | |
66 | //extern void taia_tai(const struct taia *,struct tai *); | 58 | // |
67 | 59 | //#define TAIA_PACK 16 | |
68 | extern void taia_now(struct taia *); | 60 | //extern void taia_pack(char *,const struct taia *); |
69 | 61 | // | |
70 | extern void taia_add(struct taia *,const struct taia *,const struct taia *); | 62 | //extern void taia_uint(struct taia *,unsigned); |
71 | extern void taia_addsec(struct taia *,const struct taia *,int); | 63 | // |
72 | extern void taia_sub(struct taia *,const struct taia *,const struct taia *); | 64 | //typedef struct pollfd iopause_fd; |
73 | extern void taia_half(struct taia *,const struct taia *); | 65 | //#define IOPAUSE_READ POLLIN |
74 | extern int taia_less(const struct taia *,const struct taia *); | 66 | //#define IOPAUSE_WRITE POLLOUT |
75 | 67 | // | |
76 | #define TAIA_PACK 16 | 68 | //extern void iopause(iopause_fd *,unsigned,struct taia *,struct taia *); |
77 | extern void taia_pack(char *,const struct taia *); | ||
78 | //extern void taia_unpack(const char *,struct taia *); | ||
79 | |||
80 | //#define TAIA_FMTFRAC 19 | ||
81 | //extern unsigned taia_fmtfrac(char *,const struct taia *); | ||
82 | |||
83 | extern void taia_uint(struct taia *,unsigned); | ||
84 | |||
85 | |||
86 | /*** fmt_ptime.h ***/ | ||
87 | |||
88 | #define FMT_PTIME 30 | ||
89 | |||
90 | /* NUL terminated */ | ||
91 | extern void fmt_ptime30nul(char *, struct taia *); | ||
92 | /* NOT terminated! */ | ||
93 | extern unsigned fmt_taia25(char *, struct taia *); | ||
94 | |||
95 | |||
96 | /*** iopause.h ***/ | ||
97 | |||
98 | typedef struct pollfd iopause_fd; | ||
99 | #define IOPAUSE_READ POLLIN | ||
100 | #define IOPAUSE_WRITE POLLOUT | ||
101 | |||
102 | extern void iopause(iopause_fd *,unsigned,struct taia *,struct taia *); | ||
103 | |||
104 | |||
105 | /*** lock.h ***/ | ||
106 | 69 | ||
107 | extern int lock_ex(int); | 70 | extern int lock_ex(int); |
108 | extern int lock_un(int); | 71 | extern int lock_un(int); |
109 | extern int lock_exnb(int); | 72 | extern int lock_exnb(int); |
110 | 73 | ||
111 | |||
112 | /*** open.h ***/ | ||
113 | |||
114 | extern int open_read(const char *); | 74 | extern int open_read(const char *); |
115 | extern int open_excl(const char *); | 75 | extern int open_excl(const char *); |
116 | extern int open_append(const char *); | 76 | extern int open_append(const char *); |
117 | extern int open_trunc(const char *); | 77 | extern int open_trunc(const char *); |
118 | extern int open_write(const char *); | 78 | extern int open_write(const char *); |
119 | 79 | ||
120 | |||
121 | /*** pmatch.h ***/ | ||
122 | |||
123 | extern unsigned pmatch(const char *, const char *, unsigned); | 80 | extern unsigned pmatch(const char *, const char *, unsigned); |
124 | 81 | ||
125 | |||
126 | /*** str.h ***/ | ||
127 | |||
128 | //extern unsigned str_chr(const char *,int); /* never returns NULL */ | ||
129 | |||
130 | #define str_diff(s,t) strcmp((s), (t)) | 82 | #define str_diff(s,t) strcmp((s), (t)) |
131 | #define str_equal(s,t) (!strcmp((s), (t))) | 83 | #define str_equal(s,t) (!strcmp((s), (t))) |
84 | |||
85 | /* | ||
86 | * runsv / supervise / sv stuff | ||
87 | */ | ||
88 | typedef struct svstatus_t { | ||
89 | uint64_t time_be64; | ||
90 | uint32_t time_nsec_be32; | ||
91 | uint32_t pid_le32; | ||
92 | uint8_t paused; | ||
93 | uint8_t want; | ||
94 | uint8_t got_term; | ||
95 | uint8_t run_or_finish; | ||
96 | } svstatus_t; | ||
97 | struct ERR_svstatus_must_be_20_bytes { | ||
98 | char ERR_svstatus_must_be_20_bytes[sizeof(svstatus_t) == 20 ? 1 : -1]; | ||
99 | }; | ||