summaryrefslogtreecommitdiff
path: root/src/supervision
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-01-12 23:16:36 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-01-12 23:16:36 +0000
commitbf6d072124a960d3b84ae39cd15c5aeca2e41c88 (patch)
treec082150f61e67d929b1baca2f5c6104fe959ccac /src/supervision
parent81c7a02ec870ef3dba9f8b8f8dbecbd119e5ea47 (diff)
downloads6-bf6d072124a960d3b84ae39cd15c5aeca2e41c88.tar.xz
Types fix, first pass
Diffstat (limited to 'src/supervision')
-rw-r--r--src/supervision/s6-supervise.c12
-rw-r--r--src/supervision/s6-svc.c3
-rw-r--r--src/supervision/s6-svlisten.c4
-rw-r--r--src/supervision/s6-svlisten.h6
-rw-r--r--src/supervision/s6-svlisten1.c4
-rw-r--r--src/supervision/s6-svscan.c12
-rw-r--r--src/supervision/s6-svstat.c2
-rw-r--r--src/supervision/s6-svwait.c4
-rw-r--r--src/supervision/s6_svlisten_loop.c6
9 files changed, 28 insertions, 25 deletions
diff --git a/src/supervision/s6-supervise.c b/src/supervision/s6-supervise.c
index 2e8fa38..8006e9f 100644
--- a/src/supervision/s6-supervise.c
+++ b/src/supervision/s6-supervise.c
@@ -72,7 +72,7 @@ static inline void announce (void)
static int read_uint (char const *file, unsigned int *fd)
{
char buf[UINT_FMT + 1] ;
- register int r = openreadnclose_nb(file, buf, UINT_FMT) ;
+ register ssize_t r = openreadnclose_nb(file, buf, UINT_FMT) ;
if (r < 0)
{
if (errno != ENOENT) strerr_warnwu2sys("open ", file) ;
@@ -476,7 +476,7 @@ static action_t_ref const actions[5][25] =
static inline void handle_notifyfd (void)
{
char buf[4096] ;
- register int r = 1 ;
+ register ssize_t r = 1 ;
while (r > 0)
{
r = sanitize_read(fd_read(notifyfd, buf, 4096)) ;
@@ -538,12 +538,12 @@ static inline void handle_control (int fd)
for (;;)
{
char c ;
- register int r = sanitize_read(fd_read(fd, &c, 1)) ;
+ register ssize_t r = sanitize_read(fd_read(fd, &c, 1)) ;
if (r < 0) strerr_diefu1sys(111, "read " S6_SUPERVISE_CTLDIR "/control") ;
else if (!r) break ;
else
{
- register unsigned int pos = byte_chr("abqhkti12fFpcyoduxOX", 20, c) ;
+ register size_t pos = byte_chr("abqhkti12fFpcyoduxOX", 20, c) ;
if (pos < 20) (*actions[state][V_a + pos])() ;
}
}
@@ -556,8 +556,8 @@ int main (int argc, char const *const *argv)
if (argc < 2) strerr_dieusage(100, USAGE) ;
if (chdir(argv[1]) < 0) strerr_diefu2sys(111, "chdir to ", argv[1]) ;
{
- register unsigned int proglen = str_len(PROG) ;
- register unsigned int namelen = str_len(argv[1]) ;
+ size_t proglen = str_len(PROG) ;
+ size_t namelen = str_len(argv[1]) ;
char progname[proglen + namelen + 2] ;
byte_copy(progname, proglen, PROG) ;
progname[proglen] = ' ' ;
diff --git a/src/supervision/s6-svc.c b/src/supervision/s6-svc.c
index cc92618..c929806 100644
--- a/src/supervision/s6-svc.c
+++ b/src/supervision/s6-svc.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <skalibs/uint.h>
@@ -71,7 +72,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
if (datalen <= 1) return 0 ;
if (updown[1] == 'U' || updown[1] == 'R')
{
- unsigned int arglen = str_len(argv[0]) ;
+ size_t arglen = str_len(argv[0]) ;
char fn[arglen + 17] ;
byte_copy(fn, arglen, argv[0]) ;
byte_copy(fn + arglen, 17, "/notification-fd") ;
diff --git a/src/supervision/s6-svlisten.c b/src/supervision/s6-svlisten.c
index e53fa76..319a4c3 100644
--- a/src/supervision/s6-svlisten.c
+++ b/src/supervision/s6-svlisten.c
@@ -1,8 +1,8 @@
/* ISC license. */
#include <sys/types.h>
+#include <stdint.h>
#include <skalibs/sgetopt.h>
-#include <skalibs/uint16.h>
#include <skalibs/uint.h>
#include <skalibs/bitarray.h>
#include <skalibs/tai.h>
@@ -64,7 +64,7 @@ int main (int argc, char const **argv, char const *const *envp)
{
s6_svlisten_t foo = S6_SVLISTEN_ZERO ;
pid_t pid ;
- uint16 ids[argc1] ;
+ uint16_t ids[argc1] ;
unsigned char upstate[bitarray_div8(argc1)] ;
unsigned char readystate[bitarray_div8(argc1)] ;
s6_svlisten_init(argc1, argv, &foo, ids, upstate, readystate, &deadline) ;
diff --git a/src/supervision/s6-svlisten.h b/src/supervision/s6-svlisten.h
index a5d36dd..8f01907 100644
--- a/src/supervision/s6-svlisten.h
+++ b/src/supervision/s6-svlisten.h
@@ -3,7 +3,7 @@
#ifndef S6_SVLISTEN_H
#define S6_SVLISTEN_H
-#include <skalibs/uint16.h>
+#include <stdint.h>
#include <skalibs/tai.h>
#include <s6/ftrigr.h>
@@ -15,7 +15,7 @@ struct s6_svlisten_s
{
ftrigr_t a ;
unsigned int n ;
- uint16 *ids ;
+ uint16_t *ids ;
unsigned char *upstate ;
unsigned char *readystate ;
} ;
@@ -23,7 +23,7 @@ struct s6_svlisten_s
extern void s6_svlisten_signal_handler (void) ;
extern int s6_svlisten_selfpipe_init (void) ;
-extern void s6_svlisten_init (int, char const *const *, s6_svlisten_t *, uint16 *, unsigned char *, unsigned char *, tain_t const *) ;
+extern void s6_svlisten_init (int, char const *const *, s6_svlisten_t *, uint16_t *, unsigned char *, unsigned char *, tain_t const *) ;
extern int s6_svlisten_loop (s6_svlisten_t *, int, int, int, tain_t const *, int, action_func_t_ref) ;
#endif
diff --git a/src/supervision/s6-svlisten1.c b/src/supervision/s6-svlisten1.c
index a669403..f5608f0 100644
--- a/src/supervision/s6-svlisten1.c
+++ b/src/supervision/s6-svlisten1.c
@@ -1,8 +1,8 @@
/* ISC license. */
#include <sys/types.h>
+#include <stdint.h>
#include <skalibs/sgetopt.h>
-#include <skalibs/uint16.h>
#include <skalibs/uint.h>
#include <skalibs/tai.h>
#include <skalibs/strerr2.h>
@@ -19,7 +19,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
pid_t pid ;
int spfd ;
int wantup = 1, wantready = 0, wantrestart = 0 ;
- uint16 id ;
+ uint16_t id ;
unsigned char upstate, readystate ;
PROG = "s6-svlisten1" ;
{
diff --git a/src/supervision/s6-svscan.c b/src/supervision/s6-svscan.c
index 28ce830..cf8714c 100644
--- a/src/supervision/s6-svscan.c
+++ b/src/supervision/s6-svscan.c
@@ -36,7 +36,7 @@ struct svinfo_s
dev_t dev ;
ino_t ino ;
tain_t restartafter[2] ;
- int pid[2] ;
+ pid_t pid[2] ;
int p[2] ;
unsigned int flagactive : 1 ;
unsigned int flaglog : 1 ;
@@ -151,7 +151,7 @@ static void handle_diverted_signals (void)
default :
{
char const *name = sig_name(sig) ;
- unsigned int len = str_len(name) ;
+ size_t len = str_len(name) ;
char fn[SIGNAL_PROG_LEN + len + 1] ;
char const *const newargv[2] = { fn, 0 } ;
byte_copy(fn, SIGNAL_PROG_LEN, SIGNAL_PROG) ;
@@ -168,8 +168,8 @@ static void handle_control (int fd)
for (;;)
{
char c ;
- int r = sanitize_read(fd_read(fd, &c, 1)) ;
- if (r == -1) panic("read control pipe") ;
+ ssize_t r = sanitize_read(fd_read(fd, &c, 1)) ;
+ if (r < 0) panic("read control pipe") ;
else if (!r) break ;
else switch (c)
{
@@ -282,7 +282,7 @@ static void reap (void)
static void trystart (unsigned int i, char const *name, int islog)
{
- int pid = fork() ;
+ pid_t pid = fork() ;
switch (pid)
{
case -1 :
@@ -314,7 +314,7 @@ static void retrydirlater (void)
static void check (char const *name)
{
struct stat st ;
- unsigned int namelen ;
+ size_t namelen ;
unsigned int i = 0 ;
if (name[0] == '.') return ;
if (stat(name, &st) == -1)
diff --git a/src/supervision/s6-svstat.c b/src/supervision/s6-svstat.c
index 4a413af..2a0f1aa 100644
--- a/src/supervision/s6-svstat.c
+++ b/src/supervision/s6-svstat.c
@@ -51,7 +51,7 @@ int main (int argc, char const *const *argv)
if (tain_future(&status.stamp)) tain_copynow(&status.stamp) ;
{
- unsigned int dirlen = str_len(*argv) ;
+ size_t dirlen = str_len(*argv) ;
char fn[dirlen + 6] ;
byte_copy(fn, dirlen, *argv) ;
byte_copy(fn + dirlen, 6, "/down") ;
diff --git a/src/supervision/s6-svwait.c b/src/supervision/s6-svwait.c
index 1793347..3f05b75 100644
--- a/src/supervision/s6-svwait.c
+++ b/src/supervision/s6-svwait.c
@@ -1,7 +1,7 @@
/* ISC license. */
+#include <stdint.h>
#include <skalibs/sgetopt.h>
-#include <skalibs/uint16.h>
#include <skalibs/uint.h>
#include <skalibs/bitarray.h>
#include <skalibs/tai.h>
@@ -46,7 +46,7 @@ int main (int argc, char const *const *argv)
{
s6_svlisten_t foo = S6_SVLISTEN_ZERO ;
- uint16 ids[argc] ;
+ uint16_t ids[argc] ;
unsigned char upstate[bitarray_div8(argc)] ;
unsigned char readystate[bitarray_div8(argc)] ;
s6_svlisten_init(argc, argv, &foo, ids, upstate, readystate, &deadline) ;
diff --git a/src/supervision/s6_svlisten_loop.c b/src/supervision/s6_svlisten_loop.c
index f9c603f..40c7b88 100644
--- a/src/supervision/s6_svlisten_loop.c
+++ b/src/supervision/s6_svlisten_loop.c
@@ -1,5 +1,7 @@
/* ISC license. */
+#include <sys/types.h>
+#include <stdint.h>
#include <unistd.h>
#include <errno.h>
#include <skalibs/bytestr.h>
@@ -13,7 +15,7 @@
#include <s6/s6-supervise.h>
#include "s6-svlisten.h"
-void s6_svlisten_init (int argc, char const *const *argv, s6_svlisten_t *foo, uint16 *ids, unsigned char *upstate, unsigned char *readystate, tain_t const *deadline)
+void s6_svlisten_init (int argc, char const *const *argv, s6_svlisten_t *foo, uint16_t *ids, unsigned char *upstate, unsigned char *readystate, tain_t const *deadline)
{
register unsigned int i = 0 ;
foo->n = (unsigned int)argc ;
@@ -24,7 +26,7 @@ void s6_svlisten_init (int argc, char const *const *argv, s6_svlisten_t *foo, ui
for (; i < foo->n ; i++)
{
s6_svstatus_t status = S6_SVSTATUS_ZERO ;
- unsigned int len = str_len(argv[i]) ;
+ size_t len = str_len(argv[i]) ;
char s[len + 1 + sizeof(S6_SUPERVISE_EVENTDIR)] ;
byte_copy(s, len, argv[i]) ;
s[len] = '/' ;