aboutsummaryrefslogtreecommitdiff
path: root/runit/runit_lib.h
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-08-20 17:27:40 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-08-20 17:27:40 +0000
commit45946f8b513d9c292613ac08c3ddf4a89b915752 (patch)
treed6ea51887431e4261a114b95989950d1973d3227 /runit/runit_lib.h
parent63db27f9f4c0ec8b9abe3c32c8d699be0781ffd6 (diff)
downloadbusybox-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.h134
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
25ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*/ 26*/
27 27
28/*** byte.h ***/
29
30extern unsigned byte_chr(char *s,unsigned n,int c); 28extern unsigned byte_chr(char *s,unsigned n,int c);
31 29
32
33/*** coe.h ***/
34
35extern int coe(int); 30extern 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//};
45struct 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//
53extern void tai_unpack(const char *,struct tai *); 45//struct taia {
54 46// struct tai sec;
55extern 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 *);
60struct 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
68extern void taia_now(struct taia *); 60//extern void taia_pack(char *,const struct taia *);
69 61//
70extern void taia_add(struct taia *,const struct taia *,const struct taia *); 62//extern void taia_uint(struct taia *,unsigned);
71extern void taia_addsec(struct taia *,const struct taia *,int); 63//
72extern void taia_sub(struct taia *,const struct taia *,const struct taia *); 64//typedef struct pollfd iopause_fd;
73extern void taia_half(struct taia *,const struct taia *); 65//#define IOPAUSE_READ POLLIN
74extern 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 *);
77extern 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
83extern void taia_uint(struct taia *,unsigned);
84
85
86/*** fmt_ptime.h ***/
87
88#define FMT_PTIME 30
89
90/* NUL terminated */
91extern void fmt_ptime30nul(char *, struct taia *);
92/* NOT terminated! */
93extern unsigned fmt_taia25(char *, struct taia *);
94
95
96/*** iopause.h ***/
97
98typedef struct pollfd iopause_fd;
99#define IOPAUSE_READ POLLIN
100#define IOPAUSE_WRITE POLLOUT
101
102extern void iopause(iopause_fd *,unsigned,struct taia *,struct taia *);
103
104
105/*** lock.h ***/
106 69
107extern int lock_ex(int); 70extern int lock_ex(int);
108extern int lock_un(int); 71extern int lock_un(int);
109extern int lock_exnb(int); 72extern int lock_exnb(int);
110 73
111
112/*** open.h ***/
113
114extern int open_read(const char *); 74extern int open_read(const char *);
115extern int open_excl(const char *); 75extern int open_excl(const char *);
116extern int open_append(const char *); 76extern int open_append(const char *);
117extern int open_trunc(const char *); 77extern int open_trunc(const char *);
118extern int open_write(const char *); 78extern int open_write(const char *);
119 79
120
121/*** pmatch.h ***/
122
123extern unsigned pmatch(const char *, const char *, unsigned); 80extern 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 */
88typedef 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;
97struct ERR_svstatus_must_be_20_bytes {
98 char ERR_svstatus_must_be_20_bytes[sizeof(svstatus_t) == 20 ? 1 : -1];
99};