mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 01:51:51 +00:00
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>
This commit is contained in:
parent
8bb3c17a0f
commit
17c4a8b245
2
Makefile
2
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
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
enum faults fi_strategy;
|
||||
|
||||
int fault_injection_init()
|
||||
int fault_injection_init(void)
|
||||
{
|
||||
char *val;
|
||||
int start;
|
||||
|
@ -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__ */
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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__ */
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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]);
|
||||
|
10
criu/net.c
10
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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -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"
|
||||
|
@ -86,7 +86,7 @@ static int check_sock(int i)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main()
|
||||
int main(void)
|
||||
{
|
||||
int i, fd;
|
||||
sigset_t set;
|
||||
|
@ -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];
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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];
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -68,7 +68,7 @@ typedef struct {
|
||||
int dir;
|
||||
} desc;
|
||||
|
||||
void do_wait() {
|
||||
void do_wait(void) {
|
||||
test_daemon();
|
||||
test_waitsig();
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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");
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user