Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Viennot <Nicolas.Viennot@twosigma.com>2019-12-21 21:13:06 +0300
committerAndrei Vagin <avagin@gmail.com>2020-02-04 23:39:42 +0300
commit17c4a8b24507d1bd1a906aa4a9d5ea3054072141 (patch)
treed2f11a35430548513c210ab05d1d7b6f9772374f
parent8bb3c17a0f7f14baaed8d9b6ebf953c24a793ccc (diff)
style: Enforce kernel style -Wstrict-prototypes
Include warnings that the kernel uses during compilation: -Wstrict-prototypes: enforces full declaration of functions. Previously, when declaring extern void func(), one can call func(123) and have no compilation error. This is dangerous. The correct declaration is extern void func(void). Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com> [Generated a commit message from the pull request] Signed-off-by: Dmitry Safonov <dima@arista.com>
-rw-r--r--Makefile2
-rw-r--r--criu/config.c2
-rw-r--r--criu/cr-check.c10
-rw-r--r--criu/cr-dump.c4
-rw-r--r--criu/cr-restore.c8
-rw-r--r--criu/cr-service.c4
-rw-r--r--criu/crtools.c2
-rw-r--r--criu/fault-injection.c2
-rw-r--r--criu/include/cr_options.h4
-rw-r--r--criu/include/lsm.h4
-rw-r--r--criu/include/mount.h2
-rw-r--r--criu/include/net.h8
-rw-r--r--criu/include/tls.h2
-rw-r--r--criu/kerndat.c6
-rw-r--r--criu/lsm.c2
-rw-r--r--criu/mount.c6
-rw-r--r--criu/namespaces.c2
-rw-r--r--criu/net.c10
-rw-r--r--criu/pstree.c2
-rw-r--r--criu/seize.c2
-rw-r--r--criu/tls.c6
-rw-r--r--criu/util.c4
-rw-r--r--soccr/test/tcp-conn.c2
-rw-r--r--soccr/test/tcp-constructor.c2
-rw-r--r--test/others/unix-callback/unix-client.c2
-rw-r--r--test/others/unix-callback/unix-server.c2
-rw-r--r--test/zdtm/Makefile.inc2
-rw-r--r--test/zdtm/lib/test.c6
-rw-r--r--test/zdtm/static/apparmor.c4
-rw-r--r--test/zdtm/static/child_subreaper_and_reparent.c6
-rw-r--r--test/zdtm/static/child_subreaper_existing_child.c6
-rw-r--r--test/zdtm/static/dumpable02.c2
-rw-r--r--test/zdtm/static/fdt_shared.c4
-rw-r--r--test/zdtm/static/file_locks00.c2
-rw-r--r--test/zdtm/static/inotify_system.c2
-rw-r--r--test/zdtm/static/maps00.c7
-rw-r--r--test/zdtm/static/selinux00.c8
-rw-r--r--test/zdtm/static/selinux01.c10
-rw-r--r--test/zdtm/static/session02.c8
-rw-r--r--test/zdtm/static/session03.c10
-rw-r--r--test/zdtm/transition/netlink00.c22
41 files changed, 101 insertions, 100 deletions
diff --git a/Makefile b/Makefile
index 133390f17..00e563c11 100644
--- a/Makefile
+++ b/Makefile
@@ -100,7 +100,7 @@ export PROTOUFIX DEFINES
DEFINES += -D_FILE_OFFSET_BITS=64
DEFINES += -D_GNU_SOURCE
-WARNINGS := -Wall -Wformat-security -Wdeclaration-after-statement
+WARNINGS := -Wall -Wformat-security -Wdeclaration-after-statement -Wstrict-prototypes
CFLAGS-GCOV := --coverage -fno-exceptions -fno-inline -fprofile-update=atomic
export CFLAGS-GCOV
diff --git a/criu/config.c b/criu/config.c
index e5d42efe4..73c62f5bb 100644
--- a/criu/config.c
+++ b/criu/config.c
@@ -853,7 +853,7 @@ bad_arg:
return 1;
}
-int check_options()
+int check_options(void)
{
if (opts.tcp_established_ok)
pr_info("Will dump/restore TCP connections\n");
diff --git a/criu/cr-check.c b/criu/cr-check.c
index 729b2dc38..17dd29b42 100644
--- a/criu/cr-check.c
+++ b/criu/cr-check.c
@@ -51,7 +51,7 @@
#include "restorer.h"
#include "uffd.h"
-static char *feature_name(int (*func)());
+static char *feature_name(int (*func)(void));
static int check_tty(void)
{
@@ -513,7 +513,7 @@ static int check_ipc(void)
return -1;
}
-static int check_sigqueuinfo()
+static int check_sigqueuinfo(void)
{
siginfo_t info = { .si_code = 1 };
@@ -960,7 +960,7 @@ static int clone_cb(void *_arg) {
exit(0);
}
-static int check_clone_parent_vs_pid()
+static int check_clone_parent_vs_pid(void)
{
struct clone_arg ca;
pid_t pid;
@@ -1447,7 +1447,7 @@ static int check_external_net_ns(void)
struct feature_list {
char *name;
- int (*func)();
+ int (*func)(void);
};
static struct feature_list feature_list[] = {
@@ -1517,7 +1517,7 @@ int check_add_feature(char *feat)
return -1;
}
-static char *feature_name(int (*func)())
+static char *feature_name(int (*func)(void))
{
struct feature_list *fl;
diff --git a/criu/cr-dump.c b/criu/cr-dump.c
index 4b5a01cfd..88323af92 100644
--- a/criu/cr-dump.c
+++ b/criu/cr-dump.c
@@ -1439,7 +1439,7 @@ err_cure_imgset:
static int alarm_attempts = 0;
-bool alarm_timeouted() {
+bool alarm_timeouted(void) {
return alarm_attempts > 0;
}
@@ -1456,7 +1456,7 @@ static void alarm_handler(int signo)
BUG();
}
-static int setup_alarm_handler()
+static int setup_alarm_handler(void)
{
struct sigaction sa = {
.sa_handler = alarm_handler,
diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index b920ce262..687cd6c68 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -182,13 +182,13 @@ static int __restore_wait_inprogress_tasks(int participants)
return 0;
}
-static int restore_wait_inprogress_tasks()
+static int restore_wait_inprogress_tasks(void)
{
return __restore_wait_inprogress_tasks(0);
}
/* Wait all tasks except the current one */
-static int restore_wait_other_tasks()
+static int restore_wait_other_tasks(void)
{
int participants, stage;
@@ -1587,7 +1587,7 @@ static void restore_pgid(void)
futex_set_and_wake(&rsti(current)->pgrp_set, 1);
}
-static int __legacy_mount_proc()
+static int __legacy_mount_proc(void)
{
char proc_mountpoint[] = "/tmp/crtools-proc.XXXXXX";
int fd;
@@ -1941,7 +1941,7 @@ static int catch_tasks(bool root_seized, enum trace_flags *flag)
return 0;
}
-static int clear_breakpoints()
+static int clear_breakpoints(void)
{
struct pstree_item *item;
int ret = 0, i;
diff --git a/criu/cr-service.c b/criu/cr-service.c
index 549b3368b..279016bcd 100644
--- a/criu/cr-service.c
+++ b/criu/cr-service.c
@@ -1278,7 +1278,7 @@ static void reap_worker(int signo)
}
}
-static int setup_sigchld_handler()
+static int setup_sigchld_handler(void)
{
struct sigaction action;
@@ -1295,7 +1295,7 @@ static int setup_sigchld_handler()
return 0;
}
-static int restore_sigchld_handler()
+static int restore_sigchld_handler(void)
{
struct sigaction action;
diff --git a/criu/crtools.c b/criu/crtools.c
index 700fad994..9b6e94809 100644
--- a/criu/crtools.c
+++ b/criu/crtools.c
@@ -47,7 +47,7 @@
#include "setproctitle.h"
#include "sysctl.h"
-void flush_early_log_to_stderr() __attribute__((destructor));
+void flush_early_log_to_stderr(void) __attribute__((destructor));
void flush_early_log_to_stderr(void)
{
diff --git a/criu/fault-injection.c b/criu/fault-injection.c
index 4128814d5..4b0650008 100644
--- a/criu/fault-injection.c
+++ b/criu/fault-injection.c
@@ -3,7 +3,7 @@
enum faults fi_strategy;
-int fault_injection_init()
+int fault_injection_init(void)
{
char *val;
int start;
diff --git a/criu/include/cr_options.h b/criu/include/cr_options.h
index 2c1451e86..c5af33186 100644
--- a/criu/include/cr_options.h
+++ b/criu/include/cr_options.h
@@ -158,7 +158,7 @@ extern struct cr_options opts;
char *rpc_cfg_file;
extern int parse_options(int argc, char **argv, bool *usage_error, bool *has_exec_cmd, int state);
-extern int check_options();
-extern void init_opts();
+extern int check_options(void);
+extern void init_opts(void);
#endif /* __CR_OPTIONS_H__ */
diff --git a/criu/include/lsm.h b/criu/include/lsm.h
index 3b8271282..a41915a4c 100644
--- a/criu/include/lsm.h
+++ b/criu/include/lsm.h
@@ -39,7 +39,7 @@ extern int lsm_check_opts(void);
#ifdef CONFIG_HAS_SELINUX
int dump_xattr_security_selinux(int fd, FdinfoEntry *e);
int run_setsockcreatecon(FdinfoEntry *e);
-int reset_setsockcreatecon();
+int reset_setsockcreatecon(void);
#else
static inline int dump_xattr_security_selinux(int fd, FdinfoEntry *e) {
return 0;
@@ -47,7 +47,7 @@ static inline int dump_xattr_security_selinux(int fd, FdinfoEntry *e) {
static inline int run_setsockcreatecon(FdinfoEntry *e) {
return 0;
}
-static inline int reset_setsockcreatecon() {
+static inline int reset_setsockcreatecon(void) {
return 0;
}
#endif
diff --git a/criu/include/mount.h b/criu/include/mount.h
index d9b375f5d..8bf19b266 100644
--- a/criu/include/mount.h
+++ b/criu/include/mount.h
@@ -96,7 +96,7 @@ extern int collect_binfmt_misc(void);
static inline int collect_binfmt_misc(void) { return 0; }
#endif
-extern struct mount_info *mnt_entry_alloc();
+extern struct mount_info *mnt_entry_alloc(void);
extern void mnt_entry_free(struct mount_info *mi);
extern int __mntns_get_root_fd(pid_t pid);
diff --git a/criu/include/net.h b/criu/include/net.h
index 9976f6eb0..0a556f3da 100644
--- a/criu/include/net.h
+++ b/criu/include/net.h
@@ -31,7 +31,7 @@ extern int collect_net_namespaces(bool for_dump);
extern int network_lock(void);
extern void network_unlock(void);
-extern int network_lock_internal();
+extern int network_lock_internal(void);
extern struct ns_desc net_ns_desc;
@@ -47,11 +47,11 @@ extern int move_veth_to_bridge(void);
extern int kerndat_link_nsid(void);
extern int net_get_nsid(int rtsk, int fd, int *nsid);
-extern struct ns_id *net_get_root_ns();
+extern struct ns_id *net_get_root_ns(void);
extern int kerndat_nsid(void);
extern void check_has_netns_ioc(int fd, bool *kdat_val, const char *name);
extern int net_set_ext(struct ns_id *ns);
-extern struct ns_id *get_root_netns();
-extern int read_net_ns_img();
+extern struct ns_id *get_root_netns(void);
+extern int read_net_ns_img(void);
#endif /* __CR_NET_H__ */
diff --git a/criu/include/tls.h b/criu/include/tls.h
index aa2517887..b48e4b480 100644
--- a/criu/include/tls.h
+++ b/criu/include/tls.h
@@ -4,7 +4,7 @@
# ifdef CONFIG_GNUTLS
int tls_x509_init(int sockfd, bool is_server);
-void tls_terminate_session();
+void tls_terminate_session(void);
ssize_t tls_send(const void *buf, size_t len, int flags);
ssize_t tls_recv(void *buf, size_t len, int flags);
diff --git a/criu/kerndat.c b/criu/kerndat.c
index b0dd83135..d1afde71d 100644
--- a/criu/kerndat.c
+++ b/criu/kerndat.c
@@ -364,7 +364,7 @@ no_dt:
}
/* The page frame number (PFN) is constant for the zero page */
-static int init_zero_page_pfn()
+static int init_zero_page_pfn(void)
{
void *addr;
int ret = 0;
@@ -429,7 +429,7 @@ static int get_task_size(void)
return 0;
}
-static int kerndat_fdinfo_has_lock()
+static int kerndat_fdinfo_has_lock(void)
{
int fd, pfd = -1, exit_code = -1, len;
char buf[PAGE_SIZE];
@@ -464,7 +464,7 @@ out:
return exit_code;
}
-static int get_ipv6()
+static int get_ipv6(void)
{
if (access("/proc/sys/net/ipv6", F_OK) < 0) {
if (errno == ENOENT) {
diff --git a/criu/lsm.c b/criu/lsm.c
index 9d7e55c11..060f10259 100644
--- a/criu/lsm.c
+++ b/criu/lsm.c
@@ -133,7 +133,7 @@ static int selinux_get_sockcreate_label(pid_t pid, char **output)
return 0;
}
-int reset_setsockcreatecon()
+int reset_setsockcreatecon(void)
{
/* Currently this only works for SELinux. */
if (kdat.lsm != LSMTYPE__SELINUX)
diff --git a/criu/mount.c b/criu/mount.c
index 24a8516c6..180f2a62d 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -2140,7 +2140,7 @@ static int restore_ext_mount(struct mount_info *mi)
static char mnt_clean_path[] = "/tmp/cr-tmpfs.XXXXXX";
-static int mount_clean_path()
+static int mount_clean_path(void)
{
/*
* To make a bind mount, we need to have access to a source directory,
@@ -2167,7 +2167,7 @@ static int mount_clean_path()
return 0;
}
-static int umount_clean_path()
+static int umount_clean_path(void)
{
if (umount2(mnt_clean_path, MNT_DETACH)) {
pr_perror("Unable to umount %s", mnt_clean_path);
@@ -2659,7 +2659,7 @@ static int find_remap_mounts(struct mount_info *root)
}
/* Move remapped mounts to places where they have to be */
-static int fixup_remap_mounts()
+static int fixup_remap_mounts(void)
{
struct mnt_remap_entry *r;
diff --git a/criu/namespaces.c b/criu/namespaces.c
index 57f6bdfef..21266df7c 100644
--- a/criu/namespaces.c
+++ b/criu/namespaces.c
@@ -976,7 +976,7 @@ err:
return exit_code;
}
-void free_userns_maps()
+void free_userns_maps(void)
{
if (userns_entry.n_uid_map > 0) {
xfree(userns_entry.uid_map[0]);
diff --git a/criu/net.c b/criu/net.c
index 712837782..8e6cfaff1 100644
--- a/criu/net.c
+++ b/criu/net.c
@@ -1765,7 +1765,7 @@ static int __restore_links(struct ns_id *nsid, int *nrlinks, int *nrcreated)
return 0;
}
-static int restore_links()
+static int restore_links(void)
{
int nrcreated, nrlinks;
struct ns_id *nsid;
@@ -2080,7 +2080,7 @@ out:
* iptables-restore is executed from a target userns and it may have not enough
* rights to open /run/xtables.lock. Here we try to workaround this problem.
*/
-static int prepare_xtable_lock()
+static int prepare_xtable_lock(void)
{
int fd;
@@ -2700,7 +2700,7 @@ err:
return ret;
}
-int network_lock_internal()
+int network_lock_internal(void)
{
char conf[] = "*filter\n"
":CRIU - [0:0]\n"
@@ -2731,7 +2731,7 @@ int network_lock_internal()
return ret;
}
-static int network_unlock_internal()
+static int network_unlock_internal(void)
{
char conf[] = "*filter\n"
":CRIU - [0:0]\n"
@@ -3284,7 +3284,7 @@ static int check_link_nsid(int rtsk, void *args)
return do_rtnl_req(rtsk, &req, sizeof(req), check_one_link_nsid, NULL, NULL, args);
}
-int kerndat_link_nsid()
+int kerndat_link_nsid(void)
{
int status;
pid_t pid;
diff --git a/criu/pstree.c b/criu/pstree.c
index 92b4167aa..19cf5ad38 100644
--- a/criu/pstree.c
+++ b/criu/pstree.c
@@ -608,7 +608,7 @@ err:
}
#define RESERVED_PIDS 300
-static int get_free_pid()
+static int get_free_pid(void)
{
static struct pid *prev, *next;
diff --git a/criu/seize.c b/criu/seize.c
index e1e6b8195..fd314666f 100644
--- a/criu/seize.c
+++ b/criu/seize.c
@@ -194,7 +194,7 @@ static int seize_cgroup_tree(char *root_path, const char *state)
* A freezer cgroup can contain tasks which will not be dumped
* and we need to wait them, because the are interrupted them by ptrace.
*/
-static int freezer_wait_processes()
+static int freezer_wait_processes(void)
{
int i;
diff --git a/criu/tls.c b/criu/tls.c
index db9cc4f5a..f7b94dee8 100644
--- a/criu/tls.c
+++ b/criu/tls.c
@@ -31,7 +31,7 @@ static gnutls_certificate_credentials_t x509_cred;
static int tls_sk = -1;
static int tls_sk_flags = 0;
-void tls_terminate_session()
+void tls_terminate_session(void)
{
int ret;
@@ -227,7 +227,7 @@ static int tls_x509_verify_peer_cert(void)
return 0;
}
-static int tls_handshake()
+static int tls_handshake(void)
{
int ret = -1;
while (ret != GNUTLS_E_SUCCESS) {
@@ -241,7 +241,7 @@ static int tls_handshake()
return 0;
}
-static int tls_x509_setup_creds()
+static int tls_x509_setup_creds(void)
{
int ret;
char *cacert = CRIU_CACERT;
diff --git a/criu/util.c b/criu/util.c
index 3bae18ab2..1646ce1c4 100644
--- a/criu/util.c
+++ b/criu/util.c
@@ -326,7 +326,7 @@ int close_pid_proc(void)
return 0;
}
-void close_proc()
+void close_proc(void)
{
close_pid_proc();
close_service_fd(PROC_FD_OFF);
@@ -690,7 +690,7 @@ int cr_daemon(int nochdir, int noclose, int close_fd)
return 0;
}
-int is_root_user()
+int is_root_user(void)
{
if (geteuid() != 0) {
pr_err("You need to be root to run this command\n");
diff --git a/soccr/test/tcp-conn.c b/soccr/test/tcp-conn.c
index 1a1a5bb39..e31f58e7e 100644
--- a/soccr/test/tcp-conn.c
+++ b/soccr/test/tcp-conn.c
@@ -23,7 +23,7 @@ static void pr_printf(unsigned int level, const char *fmt, ...)
va_end(args);
}
-int main()
+int main(void)
{
union libsoccr_addr addr, dst;
int srv, sock, clnt, rst;
diff --git a/soccr/test/tcp-constructor.c b/soccr/test/tcp-constructor.c
index 89f201000..973dbf10c 100644
--- a/soccr/test/tcp-constructor.c
+++ b/soccr/test/tcp-constructor.c
@@ -20,7 +20,7 @@ struct tcp {
uint16_t wscale;
};
-static void usage()
+static void usage(void)
{
printf(
"Usage: --addr ADDR -port PORT --seq SEQ --next --addr ADDR -port PORT --seq SEQ -- CMD ...\n"
diff --git a/test/others/unix-callback/unix-client.c b/test/others/unix-callback/unix-client.c
index 69808b53c..676c4adbc 100644
--- a/test/others/unix-callback/unix-client.c
+++ b/test/others/unix-callback/unix-client.c
@@ -86,7 +86,7 @@ static int check_sock(int i)
return 0;
}
-int main()
+int main(void)
{
int i, fd;
sigset_t set;
diff --git a/test/others/unix-callback/unix-server.c b/test/others/unix-callback/unix-server.c
index 8f32f53dd..47bebd05d 100644
--- a/test/others/unix-callback/unix-server.c
+++ b/test/others/unix-callback/unix-server.c
@@ -19,7 +19,7 @@ struct ticket *tickets;
#define SK_NAME "/tmp/criu.unix.callback.test"
-int main()
+int main(void)
{
int sk, ret, id;
char buf[4096];
diff --git a/test/zdtm/Makefile.inc b/test/zdtm/Makefile.inc
index 6958d128e..43763321f 100644
--- a/test/zdtm/Makefile.inc
+++ b/test/zdtm/Makefile.inc
@@ -38,7 +38,7 @@ ifeq ($(origin CC), default)
CC := $(CROSS_COMPILE)$(HOSTCC)
endif
CFLAGS += -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
-CFLAGS += -Wdeclaration-after-statement
+CFLAGS += -Wdeclaration-after-statement -Wstrict-prototypes
CFLAGS += $(USERCFLAGS)
CFLAGS += -D_GNU_SOURCE
CPPFLAGS += -iquote $(LIBDIR)/arch/$(ARCH)/include
diff --git a/test/zdtm/lib/test.c b/test/zdtm/lib/test.c
index a1bdfc1b4..630476de0 100644
--- a/test/zdtm/lib/test.c
+++ b/test/zdtm/lib/test.c
@@ -71,7 +71,7 @@ static void test_fini(void)
unlinkat(cwd, pidfile, 0);
}
-static void setup_outfile()
+static void setup_outfile(void)
{
if (!access(outfile, F_OK) || errno != ENOENT) {
fprintf(stderr, "Output file %s appears to exist, aborting\n",
@@ -93,7 +93,7 @@ static void setup_outfile()
exit(1);
}
-static void redir_stdfds()
+static void redir_stdfds(void)
{
int nullfd;
@@ -346,7 +346,7 @@ void test_init(int argc, char **argv)
srand48(time(NULL)); /* just in case we need it */
}
-void test_daemon()
+void test_daemon(void)
{
futex_set_and_wake(&test_shared_state->stage, TEST_RUNNING_STAGE);
}
diff --git a/test/zdtm/static/apparmor.c b/test/zdtm/static/apparmor.c
index 15930c761..b3a4d7549 100644
--- a/test/zdtm/static/apparmor.c
+++ b/test/zdtm/static/apparmor.c
@@ -15,7 +15,7 @@ const char *test_author = "Tycho Andersen <tycho.andersen@canonical.com>";
#define PROFILE "criu_test"
-int setprofile()
+int setprofile(void)
{
char profile[1024];
int fd, len;
@@ -45,7 +45,7 @@ int setprofile()
return 0;
}
-int checkprofile()
+int checkprofile(void)
{
FILE *f;
char path[PATH_MAX], profile[1024];
diff --git a/test/zdtm/static/child_subreaper_and_reparent.c b/test/zdtm/static/child_subreaper_and_reparent.c
index 57943a67b..e3955d3d9 100644
--- a/test/zdtm/static/child_subreaper_and_reparent.c
+++ b/test/zdtm/static/child_subreaper_and_reparent.c
@@ -25,7 +25,7 @@ struct shared {
int parent_after_cr;
} *sh;
-int orphan()
+int orphan(void)
{
/*
* Wait until reparented to the pidns init. (By waiting
@@ -45,7 +45,7 @@ int orphan()
return 0;
}
-int helper()
+int helper(void)
{
int pid;
@@ -59,7 +59,7 @@ int helper()
return 0;
}
-int subreaper()
+int subreaper(void)
{
int pid, ret, status;
diff --git a/test/zdtm/static/child_subreaper_existing_child.c b/test/zdtm/static/child_subreaper_existing_child.c
index 28e9dbb8a..8291aba08 100644
--- a/test/zdtm/static/child_subreaper_existing_child.c
+++ b/test/zdtm/static/child_subreaper_existing_child.c
@@ -24,7 +24,7 @@ struct shared {
} *sh;
-int orphan()
+int orphan(void)
{
/* Return the control back to MAIN worker to do C/R */
futex_set_and_wake(&sh->fstate, TEST_CRIU);
@@ -36,7 +36,7 @@ int orphan()
return 0;
}
-int helper()
+int helper(void)
{
int pid;
@@ -52,7 +52,7 @@ int helper()
return 0;
}
-int subreaper()
+int subreaper(void)
{
int pid, ret, status;
diff --git a/test/zdtm/static/dumpable02.c b/test/zdtm/static/dumpable02.c
index 024371bd8..7e2eee2d1 100644
--- a/test/zdtm/static/dumpable02.c
+++ b/test/zdtm/static/dumpable02.c
@@ -13,7 +13,7 @@
const char *test_doc = "Check dumpable flag handling (non-dumpable case)";
const char *test_author = "Filipe Brandenburger <filbranden@google.com>";
-int dumpable_server() {
+int dumpable_server(void) {
char buf[256];
int ret;
diff --git a/test/zdtm/static/fdt_shared.c b/test/zdtm/static/fdt_shared.c
index 2111356f5..a84444af5 100644
--- a/test/zdtm/static/fdt_shared.c
+++ b/test/zdtm/static/fdt_shared.c
@@ -22,7 +22,7 @@ TEST_OPTION(filename, string, "file name", 1);
#define CHILDREN 4
static int fork_pfd[2];
-static void forked()
+static void forked(void)
{
char c = 0;
@@ -32,7 +32,7 @@ static void forked()
}
}
-static void wait_children()
+static void wait_children(void)
{
int i;
char c;
diff --git a/test/zdtm/static/file_locks00.c b/test/zdtm/static/file_locks00.c
index 59e19cfe1..fa98a31b3 100644
--- a/test/zdtm/static/file_locks00.c
+++ b/test/zdtm/static/file_locks00.c
@@ -101,7 +101,7 @@ static int check_write_lock(int fd, int whence, off_t offset, off_t len)
return -1;
}
-static int check_file_locks()
+static int check_file_locks(void)
{
int fd_0, fd_1;
int ret0, ret1;
diff --git a/test/zdtm/static/inotify_system.c b/test/zdtm/static/inotify_system.c
index 59f47c41c..3e6b2ad48 100644
--- a/test/zdtm/static/inotify_system.c
+++ b/test/zdtm/static/inotify_system.c
@@ -68,7 +68,7 @@ typedef struct {
int dir;
} desc;
-void do_wait() {
+void do_wait(void) {
test_daemon();
test_waitsig();
}
diff --git a/test/zdtm/static/maps00.c b/test/zdtm/static/maps00.c
index a6c68cd25..f2da9b975 100644
--- a/test/zdtm/static/maps00.c
+++ b/test/zdtm/static/maps00.c
@@ -123,7 +123,7 @@ static void segfault(int signo)
* after test func should be placed check map, because size of test_func
* is calculated as (check_map-test_func)
*/
-int test_func()
+int test_func(void)
{
return 1;
}
@@ -176,8 +176,9 @@ static int check_map(struct map *map)
memcpy(map->ptr,test_func, getpagesize());
} else {
if (!(map->flag & MAP_ANONYMOUS)) {
+ uint8_t funlen = (uint8_t *)check_map - (uint8_t *)test_func;
lseek(map->fd,0,SEEK_SET);
- if (write(map->fd,test_func,check_map - test_func)<check_map - test_func) {
+ if (write(map->fd,test_func,funlen)<funlen) {
pr_perror("failed to write %s", map->filename);
return -1;
}
@@ -185,7 +186,7 @@ static int check_map(struct map *map)
}
if (!(map->flag & MAP_ANONYMOUS) || map->prot & PROT_WRITE)
/* Function body has been copied into the mapping */
- ((int (*)())map->ptr)(); /* perform exec access */
+ ((int (*)(void))map->ptr)(); /* perform exec access */
else
/* No way to copy function body into mapping,
* clear exec bit from effective protection
diff --git a/test/zdtm/static/selinux00.c b/test/zdtm/static/selinux00.c
index db8420eac..b5b3e3cc0 100644
--- a/test/zdtm/static/selinux00.c
+++ b/test/zdtm/static/selinux00.c
@@ -26,14 +26,14 @@ const char *test_author = "Adrian Reber <areber@redhat.com>";
*/
char state;
-int check_for_selinux()
+int check_for_selinux(void)
{
if (access("/sys/fs/selinux", F_OK) == 0)
return 0;
return 1;
}
-int setprofile()
+int setprofile(void)
{
int fd, len;
@@ -54,7 +54,7 @@ int setprofile()
return 0;
}
-int checkprofile()
+int checkprofile(void)
{
int fd;
char context[1024];
@@ -83,7 +83,7 @@ int checkprofile()
return 0;
}
-int check_sockcreate()
+int check_sockcreate(void)
{
char *output = NULL;
FILE *f = fopen("/proc/self/attr/sockcreate", "r");
diff --git a/test/zdtm/static/selinux01.c b/test/zdtm/static/selinux01.c
index cec5980e8..cbf145d2a 100644
--- a/test/zdtm/static/selinux01.c
+++ b/test/zdtm/static/selinux01.c
@@ -28,14 +28,14 @@ const char *test_author = "Adrian Reber <areber@redhat.com>";
*/
char state;
-int check_for_selinux()
+int check_for_selinux(void)
{
if (access("/sys/fs/selinux", F_OK) == 0)
return 0;
return 1;
}
-int setprofile()
+int setprofile(void)
{
int fd, len;
@@ -56,7 +56,7 @@ int setprofile()
return 0;
}
-int set_sockcreate()
+int set_sockcreate(void)
{
int fd, len;
@@ -77,7 +77,7 @@ int set_sockcreate()
return 0;
}
-int check_sockcreate()
+int check_sockcreate(void)
{
int fd;
char context[1024];
@@ -106,7 +106,7 @@ int check_sockcreate()
return 0;
}
-int check_sockcreate_empty()
+int check_sockcreate_empty(void)
{
char *output = NULL;
FILE *f = fopen("/proc/self/attr/sockcreate", "r");
diff --git a/test/zdtm/static/session02.c b/test/zdtm/static/session02.c
index 37f245d2e..f5c81df16 100644
--- a/test/zdtm/static/session02.c
+++ b/test/zdtm/static/session02.c
@@ -25,7 +25,7 @@ struct process *processes;
int nr_processes = 20;
int current = 0;
-static void cleanup()
+static void cleanup(void)
{
int i;
@@ -55,9 +55,9 @@ struct command
int arg2;
};
-static void handle_command();
+static void handle_command(void);
-static void mainloop()
+static void mainloop(void)
{
while (1)
handle_command();
@@ -100,7 +100,7 @@ static int make_child(int id, int flags)
return cid;
}
-static void handle_command()
+static void handle_command(void)
{
int sk = processes[current].sks[0], ret, status = 0;
struct command cmd;
diff --git a/test/zdtm/static/session03.c b/test/zdtm/static/session03.c
index 2b3c46c32..8ca16e410 100644
--- a/test/zdtm/static/session03.c
+++ b/test/zdtm/static/session03.c
@@ -36,7 +36,7 @@ static void sigchld_handler(int signal, siginfo_t *siginfo, void *data)
waitpid(pid, NULL, WNOHANG);
}
-static void cleanup()
+static void cleanup(void)
{
int i, ret;
@@ -72,7 +72,7 @@ enum commands
int cmd_weght[TEST_MAX] = {10, 3, 1, 10, 7};
int sum_weight = 0;
-static int get_rnd_op()
+static int get_rnd_op(void)
{
int i, m;
if (sum_weight == 0) {
@@ -97,9 +97,9 @@ struct command
int arg2;
};
-static void handle_command();
+static void handle_command(void);
-static void mainloop()
+static void mainloop(void)
{
while (1)
handle_command();
@@ -142,7 +142,7 @@ static int make_child(int id, int flags)
return cid;
}
-static void handle_command()
+static void handle_command(void)
{
int sk = processes[current].sks[0], ret, status = 0;
struct command cmd;
diff --git a/test/zdtm/transition/netlink00.c b/test/zdtm/transition/netlink00.c
index c9b2303e8..3504a48a1 100644
--- a/test/zdtm/transition/netlink00.c
+++ b/test/zdtm/transition/netlink00.c
@@ -56,12 +56,12 @@ struct rtmsg *rtp;
int rtl;
struct rtattr *rtap;
-int send_request();
-int recv_reply();
-int form_request_add();
-int form_request_del();
-int read_reply();
-typedef int (*cmd_t)();
+int send_request(void);
+int recv_reply(void);
+int form_request_add(void);
+int form_request_del(void);
+int read_reply(void);
+typedef int (*cmd_t)(void);
#define CMD_NUM 2
cmd_t cmd[CMD_NUM]={form_request_add, form_request_del};
@@ -120,7 +120,7 @@ out:
return 0;
}
-int send_request()
+int send_request(void)
{
// create the remote address
// to communicate
@@ -145,7 +145,7 @@ int send_request()
}
return 0;
}
-int recv_reply()
+int recv_reply(void)
{
char *p;
// initialize the socket read buffer
@@ -191,7 +191,7 @@ int recv_reply()
return 0;
}
-int read_reply()
+int read_reply(void)
{
//string to hold content of the route
// table (i.e. one entry)
@@ -250,7 +250,7 @@ int read_reply()
#define NLMSG_TAIL(nmsg) \
((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len)))
-int form_request_del()
+int form_request_del(void)
{
bzero(&req, sizeof(req));
req.nl.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg));
@@ -272,7 +272,7 @@ int form_request_del()
return 0;
}
-int form_request_add()
+int form_request_add(void)
{
int ifcn = 1; //interface number