mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-29 05:18:00 +00:00
Whitespace at EOL cleanup and check
My editor (vim) auto-removes whitespace at EOL for *.c and *.h files, and I think it makes sense to have a separate commit for this, rather than littering other commits with such changes. To make sure this won't pile up again, add a line to Makefile under the linter target to check for such things (so CI will fail). This is all whitespace except an addition to Makefile. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
parent
7ea20e8f5a
commit
96b7178bab
2
Makefile
2
Makefile
@ -411,6 +411,8 @@ lint:
|
|||||||
! git --no-pager grep -E '^\s*\<(pr_perror|fail)\>.*%m'
|
! git --no-pager grep -E '^\s*\<(pr_perror|fail)\>.*%m'
|
||||||
# Do not use errno with pr_perror or fail
|
# Do not use errno with pr_perror or fail
|
||||||
! git --no-pager grep -E '^\s*\<(pr_perror|fail)\>\(".*".*errno'
|
! git --no-pager grep -E '^\s*\<(pr_perror|fail)\>\(".*".*errno'
|
||||||
|
# No EOL whitespace for C files
|
||||||
|
! git --no-pager grep -E '\s+$$' \*.c \*.h
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
|
|
||||||
codecov: SHELL := $(shell which bash)
|
codecov: SHELL := $(shell which bash)
|
||||||
|
@ -17,11 +17,11 @@ void compel_set_cpu_cap(compel_cpuinfo_t *c, unsigned int feature){ }
|
|||||||
void compel_clear_cpu_cap(compel_cpuinfo_t *c, unsigned int feature){ }
|
void compel_clear_cpu_cap(compel_cpuinfo_t *c, unsigned int feature){ }
|
||||||
|
|
||||||
int compel_test_cpu_cap(compel_cpuinfo_t *c, unsigned int feature)
|
int compel_test_cpu_cap(compel_cpuinfo_t *c, unsigned int feature)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int compel_cpuid(compel_cpuinfo_t *c){
|
int compel_cpuid(compel_cpuinfo_t *c){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,6 +31,6 @@ bool compel_cpu_has_feature(unsigned int feature)
|
|||||||
compel_cpuid(&rt_info);
|
compel_cpuid(&rt_info);
|
||||||
rt_info_done = true;
|
rt_info_done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return compel_test_cpu_cap(&rt_info, feature);
|
return compel_test_cpu_cap(&rt_info, feature);
|
||||||
}
|
}
|
||||||
|
@ -41,8 +41,8 @@ typedef struct {
|
|||||||
|
|
||||||
#define MIPS_a0 regs[4] //arguments a0-a3
|
#define MIPS_a0 regs[4] //arguments a0-a3
|
||||||
#define MIPS_t0 regs[8] //temporaries t0-t7
|
#define MIPS_t0 regs[8] //temporaries t0-t7
|
||||||
#define MIPS_v0 regs[2]
|
#define MIPS_v0 regs[2]
|
||||||
#define MIPS_v1 regs[3]
|
#define MIPS_v1 regs[3]
|
||||||
#define MIPS_sp regs[29]
|
#define MIPS_sp regs[29]
|
||||||
#define MIPS_ra regs[31]
|
#define MIPS_ra regs[31]
|
||||||
|
|
||||||
@ -59,10 +59,10 @@ static inline bool user_regs_native(user_regs_struct_t *pregs)
|
|||||||
#define compel_arch_get_tls_task(ctl, tls)
|
#define compel_arch_get_tls_task(ctl, tls)
|
||||||
#define compel_arch_get_tls_thread(tctl, tls)
|
#define compel_arch_get_tls_thread(tctl, tls)
|
||||||
|
|
||||||
#define REG_RES(regs) ((regs).MIPS_v0)
|
#define REG_RES(regs) ((regs).MIPS_v0)
|
||||||
#define REG_IP(regs) ((regs).cp0_epc)
|
#define REG_IP(regs) ((regs).cp0_epc)
|
||||||
#define REG_SP(regs) ((regs).MIPS_sp)
|
#define REG_SP(regs) ((regs).MIPS_sp)
|
||||||
#define REG_SYSCALL_NR(regs) ((regs).MIPS_v0)
|
#define REG_SYSCALL_NR(regs) ((regs).MIPS_v0)
|
||||||
|
|
||||||
//#define __NR(syscall, compat) ((compat) ? __NR32_##syscall : __NR_##syscall)
|
//#define __NR(syscall, compat) ((compat) ? __NR32_##syscall : __NR_##syscall)
|
||||||
#define __NR(syscall, compat) __NR_##syscall
|
#define __NR(syscall, compat) __NR_##syscall
|
||||||
|
@ -36,8 +36,8 @@ struct rt_sigframe {
|
|||||||
|
|
||||||
#define RT_SIGFRAME_UC(rt_sigframe) (&rt_sigframe->rs_uc)
|
#define RT_SIGFRAME_UC(rt_sigframe) (&rt_sigframe->rs_uc)
|
||||||
#define RT_SIGFRAME_UC_SIGMASK(rt_sigframe) ((k_rtsigset_t *)(void *)&rt_sigframe->rs_uc.uc_sigmask)
|
#define RT_SIGFRAME_UC_SIGMASK(rt_sigframe) ((k_rtsigset_t *)(void *)&rt_sigframe->rs_uc.uc_sigmask)
|
||||||
#define RT_SIGFRAME_REGIP(rt_sigframe) ((long unsigned int)0x00)
|
#define RT_SIGFRAME_REGIP(rt_sigframe) ((long unsigned int)0x00)
|
||||||
#define RT_SIGFRAME_FPU(rt_sigframe)
|
#define RT_SIGFRAME_FPU(rt_sigframe)
|
||||||
#define RT_SIGFRAME_HAS_FPU(rt_sigframe) 1
|
#define RT_SIGFRAME_HAS_FPU(rt_sigframe) 1
|
||||||
|
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ void *remote_mmap(struct parasite_ctl *ctl,
|
|||||||
* regs must be inited when calling this function from original context
|
* regs must be inited when calling this function from original context
|
||||||
*/
|
*/
|
||||||
void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *regs)
|
void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *regs)
|
||||||
{
|
{
|
||||||
regs->cp0_epc = new_ip;
|
regs->cp0_epc = new_ip;
|
||||||
if (stack){
|
if (stack){
|
||||||
/* regs[29] is sp */
|
/* regs[29] is sp */
|
||||||
@ -286,7 +286,7 @@ void compel_relocs_apply_mips(void *mem, void *vbase, struct parasite_blob_desc
|
|||||||
* mips rebasing :load time relocation
|
* mips rebasing :load time relocation
|
||||||
* parasite.built-in.o and restorer.built-in.o is ELF 64-bit LSB relocatable for mips.
|
* parasite.built-in.o and restorer.built-in.o is ELF 64-bit LSB relocatable for mips.
|
||||||
* so we have to relocate some type for R_MIPS_26 R_MIPS_HIGHEST R_MIPS_HIGHER R_MIPS_HI16 and R_MIPS_LO16 in there.
|
* so we have to relocate some type for R_MIPS_26 R_MIPS_HIGHEST R_MIPS_HIGHER R_MIPS_HI16 and R_MIPS_LO16 in there.
|
||||||
* for mips64el .if toload/store data or jump instruct ,need to relocation R_TYPE
|
* for mips64el .if toload/store data or jump instruct ,need to relocation R_TYPE
|
||||||
*/
|
*/
|
||||||
for (i = 0, j = 0; i < nr_relocs; i++) {
|
for (i = 0, j = 0; i < nr_relocs; i++) {
|
||||||
if (elf_relocs[i].type & COMPEL_TYPE_MIPS_26) {
|
if (elf_relocs[i].type & COMPEL_TYPE_MIPS_26) {
|
||||||
|
@ -201,7 +201,7 @@ int __handle_elf(void *mem, size_t size)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate section addresses with proper alignment.
|
/* Calculate section addresses with proper alignment.
|
||||||
* Note: some but not all linkers precalculate this information.
|
* Note: some but not all linkers precalculate this information.
|
||||||
*/
|
*/
|
||||||
|
@ -65,14 +65,14 @@ int save_task_regs(void *x, user_regs_struct_t *regs, user_fpregs_struct_t *fpre
|
|||||||
core->ti_mips->gpregs->r29 = regs->regs[29];
|
core->ti_mips->gpregs->r29 = regs->regs[29];
|
||||||
core->ti_mips->gpregs->r30 = regs->regs[30];
|
core->ti_mips->gpregs->r30 = regs->regs[30];
|
||||||
core->ti_mips->gpregs->r31 = regs->regs[31];
|
core->ti_mips->gpregs->r31 = regs->regs[31];
|
||||||
|
|
||||||
core->ti_mips->gpregs->lo = regs->lo;
|
core->ti_mips->gpregs->lo = regs->lo;
|
||||||
core->ti_mips->gpregs->hi = regs->hi;
|
core->ti_mips->gpregs->hi = regs->hi;
|
||||||
core->ti_mips->gpregs->cp0_epc = regs->cp0_epc;
|
core->ti_mips->gpregs->cp0_epc = regs->cp0_epc;
|
||||||
core->ti_mips->gpregs->cp0_badvaddr = regs->cp0_badvaddr;
|
core->ti_mips->gpregs->cp0_badvaddr = regs->cp0_badvaddr;
|
||||||
core->ti_mips->gpregs->cp0_status = regs->cp0_status;
|
core->ti_mips->gpregs->cp0_status = regs->cp0_status;
|
||||||
core->ti_mips->gpregs->cp0_cause = regs->cp0_cause;
|
core->ti_mips->gpregs->cp0_cause = regs->cp0_cause;
|
||||||
|
|
||||||
core->ti_mips->fpregs->r0 = fpregs->regs[0];
|
core->ti_mips->fpregs->r0 = fpregs->regs[0];
|
||||||
core->ti_mips->fpregs->r1 = fpregs->regs[1];
|
core->ti_mips->fpregs->r1 = fpregs->regs[1];
|
||||||
core->ti_mips->fpregs->r2 = fpregs->regs[2];
|
core->ti_mips->fpregs->r2 = fpregs->regs[2];
|
||||||
@ -107,7 +107,7 @@ int save_task_regs(void *x, user_regs_struct_t *regs, user_fpregs_struct_t *fpre
|
|||||||
core->ti_mips->fpregs->r31 = fpregs->regs[31];
|
core->ti_mips->fpregs->r31 = fpregs->regs[31];
|
||||||
core->ti_mips->fpregs->fpu_fcr31 = fpregs->fpu_fcr31;
|
core->ti_mips->fpregs->fpu_fcr31 = fpregs->fpu_fcr31;
|
||||||
core->ti_mips->fpregs->fpu_id = fpregs->fpu_id;
|
core->ti_mips->fpregs->fpu_id = fpregs->fpu_id;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ int arch_alloc_thread_info(CoreEntry *core)
|
|||||||
|
|
||||||
user_mips_fpregs_entry__init(fpregs);
|
user_mips_fpregs_entry__init(fpregs);
|
||||||
ti_mips->fpregs = fpregs;
|
ti_mips->fpregs = fpregs;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
err:
|
err:
|
||||||
return -1;
|
return -1;
|
||||||
@ -155,7 +155,7 @@ void arch_free_thread_info(CoreEntry *core)
|
|||||||
|
|
||||||
if (core->ti_mips->gpregs)
|
if (core->ti_mips->gpregs)
|
||||||
xfree(core->ti_mips->gpregs);
|
xfree(core->ti_mips->gpregs);
|
||||||
|
|
||||||
if (core->ti_mips->fpregs)
|
if (core->ti_mips->fpregs)
|
||||||
xfree(core->ti_mips->fpregs);
|
xfree(core->ti_mips->fpregs);
|
||||||
|
|
||||||
|
@ -7,13 +7,13 @@
|
|||||||
#include <compel/plugins/std/syscall-codes.h>
|
#include <compel/plugins/std/syscall-codes.h>
|
||||||
#include <compel/asm/sigframe.h>
|
#include <compel/asm/sigframe.h>
|
||||||
|
|
||||||
static inline void restore_tls(tls_t *ptls) {
|
static inline void restore_tls(tls_t *ptls) {
|
||||||
asm volatile(
|
asm volatile(
|
||||||
"move $4, %0 \n"
|
"move $4, %0 \n"
|
||||||
"li $2, "__stringify(__NR_set_thread_area)" \n"
|
"li $2, "__stringify(__NR_set_thread_area)" \n"
|
||||||
"syscall \n"
|
"syscall \n"
|
||||||
:
|
:
|
||||||
: "r"(*ptls)
|
: "r"(*ptls)
|
||||||
: "$4","$2","memory");
|
: "$4","$2","memory");
|
||||||
}
|
}
|
||||||
static inline int arch_compat_rt_sigaction(void *stack, int sig, void *act)
|
static inline int arch_compat_rt_sigaction(void *stack, int sig, void *act)
|
||||||
|
@ -72,7 +72,7 @@ int restore_bpfmap_data(int map_fd, uint32_t map_id, struct bpfmap_data_rst **bp
|
|||||||
.flags = 0,
|
.flags = 0,
|
||||||
);
|
);
|
||||||
|
|
||||||
for (map_data = bpf_hash_table[map_id & BPFMAP_DATA_HASH_MASK]; map_data != NULL;
|
for (map_data = bpf_hash_table[map_id & BPFMAP_DATA_HASH_MASK]; map_data != NULL;
|
||||||
map_data = map_data->next) {
|
map_data = map_data->next) {
|
||||||
|
|
||||||
if (map_data->bde->map_id == map_id)
|
if (map_data->bde->map_id == map_id)
|
||||||
@ -143,11 +143,11 @@ int dump_one_bpfmap_data(BpfmapFileEntry *bpf, int lfd, const struct fd_parms *p
|
|||||||
* by userspace if it's dealing with percpu maps. 'count' will contain the
|
* by userspace if it's dealing with percpu maps. 'count' will contain the
|
||||||
* number of keys/values successfully retrieved. Note that 'count' is an
|
* number of keys/values successfully retrieved. Note that 'count' is an
|
||||||
* input/output variable and it can contain a lower value after a call.
|
* input/output variable and it can contain a lower value after a call.
|
||||||
*
|
*
|
||||||
* If there's no more entries to retrieve, ENOENT will be returned. If error
|
* If there's no more entries to retrieve, ENOENT will be returned. If error
|
||||||
* is ENOENT, count might be > 0 in case it copied some values but there were
|
* is ENOENT, count might be > 0 in case it copied some values but there were
|
||||||
* no more entries to retrieve.
|
* no more entries to retrieve.
|
||||||
*
|
*
|
||||||
* Note that if the return code is an error and not -EFAULT,
|
* Note that if the return code is an error and not -EFAULT,
|
||||||
* count indicates the number of elements successfully processed.
|
* count indicates the number of elements successfully processed.
|
||||||
*/
|
*/
|
||||||
@ -270,7 +270,7 @@ static int dump_one_bpfmap(int lfd, u32 id, const struct fd_parms *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct fdtype_ops bpfmap_dump_ops = {
|
const struct fdtype_ops bpfmap_dump_ops = {
|
||||||
|
@ -1544,7 +1544,7 @@ static int get_build_id(const int fd, const struct stat *fd_status,
|
|||||||
ret = get_build_id_32(start_addr, build_id, fd, mapped_size);
|
ret = get_build_id_32(start_addr, build_id, fd, mapped_size);
|
||||||
if (buf[EI_CLASS] == ELFCLASS64)
|
if (buf[EI_CLASS] == ELFCLASS64)
|
||||||
ret = get_build_id_64(start_addr, build_id, fd, mapped_size);
|
ret = get_build_id_64(start_addr, build_id, fd, mapped_size);
|
||||||
|
|
||||||
munmap(start_addr, mapped_size);
|
munmap(start_addr, mapped_size);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -2065,7 +2065,7 @@ int open_path(struct file_desc *d,
|
|||||||
tmp = inherit_fd_lookup_id(rfi->rfe->name);
|
tmp = inherit_fd_lookup_id(rfi->rfe->name);
|
||||||
if (tmp >= 0) {
|
if (tmp >= 0) {
|
||||||
inh_fd = tmp;
|
inh_fd = tmp;
|
||||||
/*
|
/*
|
||||||
* PROC_SELF isn't used, because only service
|
* PROC_SELF isn't used, because only service
|
||||||
* descriptors can be used here.
|
* descriptors can be used here.
|
||||||
*/
|
*/
|
||||||
|
@ -30,4 +30,4 @@ extern const struct fdtype_ops bpfmap_dump_ops;
|
|||||||
extern struct collect_image_info bpfmap_cinfo;
|
extern struct collect_image_info bpfmap_cinfo;
|
||||||
extern struct collect_image_info bpfmap_data_cinfo;
|
extern struct collect_image_info bpfmap_data_cinfo;
|
||||||
|
|
||||||
#endif /* __CR_BPFMAP_H__ */
|
#endif /* __CR_BPFMAP_H__ */
|
||||||
|
@ -1694,7 +1694,7 @@ static int parse_bpfmap(struct bfd *f, char *str, BpfmapFileEntry *bpf)
|
|||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Format is:
|
* Format is:
|
||||||
*
|
*
|
||||||
* uint32_t map_type
|
* uint32_t map_type
|
||||||
* uint32_t key_size
|
* uint32_t key_size
|
||||||
* uint32_t value_size
|
* uint32_t value_size
|
||||||
@ -1718,7 +1718,7 @@ static int parse_bpfmap(struct bfd *f, char *str, BpfmapFileEntry *bpf)
|
|||||||
|
|
||||||
size_t n = sizeof(map) / sizeof(bpfmap_fmt);
|
size_t n = sizeof(map) / sizeof(bpfmap_fmt);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
if (sscanf(str, map[i].fmt, map[i].value) != 1)
|
if (sscanf(str, map[i].fmt, map[i].value) != 1)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#define v0 $2
|
#define v0 $2
|
||||||
#define v1 $3
|
#define v1 $3
|
||||||
|
|
||||||
#define a0 $4
|
#define a0 $4
|
||||||
#define a1 $5
|
#define a1 $5
|
||||||
#define a2 $6
|
#define a2 $6
|
||||||
#define a3 $7
|
#define a3 $7
|
||||||
@ -18,7 +18,7 @@
|
|||||||
#define t1 $13
|
#define t1 $13
|
||||||
#define t2 $14
|
#define t2 $14
|
||||||
#define t3 $15
|
#define t3 $15
|
||||||
|
|
||||||
#define s0 $16 /* callee saved */
|
#define s0 $16 /* callee saved */
|
||||||
#define s1 $17
|
#define s1 $17
|
||||||
#define s2 $18
|
#define s2 $18
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
#define __aligned(x) __attribute__((aligned(x)))
|
#define __aligned(x) __attribute__((aligned(x)))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Macro to define stack alignment.
|
* Macro to define stack alignment.
|
||||||
* aarch64 requires stack to be aligned to 16 bytes.
|
* aarch64 requires stack to be aligned to 16 bytes.
|
||||||
*/
|
*/
|
||||||
#define __stack_aligned__ __attribute__((aligned(16)))
|
#define __stack_aligned__ __attribute__((aligned(16)))
|
||||||
|
@ -96,7 +96,7 @@ struct libsoccr_sk_data {
|
|||||||
* from the kernel and is required for restore. Not present data
|
* from the kernel and is required for restore. Not present data
|
||||||
* is zeroified by the library.
|
* is zeroified by the library.
|
||||||
*
|
*
|
||||||
* Ideally the caller should carry the whole _data structure between
|
* Ideally the caller should carry the whole _data structure between
|
||||||
* calls, but for optimization purposes it may analyze the flags
|
* calls, but for optimization purposes it may analyze the flags
|
||||||
* field and drop the unneeded bits.
|
* field and drop the unneeded bits.
|
||||||
*/
|
*/
|
||||||
@ -213,14 +213,14 @@ union libsoccr_addr *libsoccr_get_addr(struct libsoccr_sk *sk, int self, unsigne
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Set a pointer on the send/recv queue data.
|
* Set a pointer on the send/recv queue data.
|
||||||
* If flags have SOCCR_MEM_EXCL, the buffer is stolen by the library and is
|
* If flags have SOCCR_MEM_EXCL, the buffer is stolen by the library and is
|
||||||
* free()-ed after libsoccr_resume().
|
* free()-ed after libsoccr_resume().
|
||||||
*/
|
*/
|
||||||
int libsoccr_set_queue_bytes(struct libsoccr_sk *sk, int queue_id, char *bytes, unsigned flags);
|
int libsoccr_set_queue_bytes(struct libsoccr_sk *sk, int queue_id, char *bytes, unsigned flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set a pointer on the libsoccr_addr for src/dst.
|
* Set a pointer on the libsoccr_addr for src/dst.
|
||||||
* If flags have SOCCR_MEM_EXCL, the buffer is stolen by the library and is
|
* If flags have SOCCR_MEM_EXCL, the buffer is stolen by the library and is
|
||||||
* fre()-ed after libsoccr_resume().
|
* fre()-ed after libsoccr_resume().
|
||||||
*/
|
*/
|
||||||
int libsoccr_set_addr(struct libsoccr_sk *sk, int self, union libsoccr_addr *, unsigned flags);
|
int libsoccr_set_addr(struct libsoccr_sk *sk, int self, union libsoccr_addr *, unsigned flags);
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* Also note that changing the log file during restore has nothing to do
|
* Also note that changing the log file during restore has nothing to do
|
||||||
* with the pipe. It's just a nice feature for cases where it's desirable
|
* with the pipe. It's just a nice feature for cases where it's desirable
|
||||||
* to have a restored process use a different file then the original one.
|
* to have a restored process use a different file then the original one.
|
||||||
*
|
*
|
||||||
* The parent process spawns a child that will write messages to its
|
* The parent process spawns a child that will write messages to its
|
||||||
* parent through a pipe. After a couple of messages, parent invokes
|
* parent through a pipe. After a couple of messages, parent invokes
|
||||||
* criu to checkpoint the child. Since the child exits after checkpoint,
|
* criu to checkpoint the child. Since the child exits after checkpoint,
|
||||||
@ -377,7 +377,7 @@ void chld_handler(int signum)
|
|||||||
if (pid == child_pid) {
|
if (pid == child_pid) {
|
||||||
if (!qflag) {
|
if (!qflag) {
|
||||||
printf("%s %s exited with status %d\n", who(0),
|
printf("%s %s exited with status %d\n", who(0),
|
||||||
who(pid), status);
|
who(pid), status);
|
||||||
}
|
}
|
||||||
/* if child exited successfully, we're done */
|
/* if child exited successfully, we're done */
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
@ -528,7 +528,7 @@ char *pipe_name(int fd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use two buffers to support two calls to
|
* Use two buffers to support two calls to
|
||||||
* this function in a printf argument list.
|
* this function in a printf argument list.
|
||||||
*/
|
*/
|
||||||
char *who(pid_t pid)
|
char *who(pid_t pid)
|
||||||
|
@ -123,4 +123,4 @@ int cmp_bpfmap_fdinfo(struct bpfmap_fdinfo_obj *old, struct bpfmap_fdinfo_obj *n
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -77,13 +77,13 @@ int main(int argc, char **argv)
|
|||||||
.flags = 0,
|
.flags = 0,
|
||||||
);
|
);
|
||||||
|
|
||||||
keys = mmap(NULL, max_entries * sizeof(int),
|
keys = mmap(NULL, max_entries * sizeof(int),
|
||||||
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0);
|
|
||||||
values = mmap(NULL, max_entries * sizeof(int),
|
|
||||||
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0);
|
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0);
|
||||||
visited = mmap(NULL, max_entries * sizeof(int),
|
values = mmap(NULL, max_entries * sizeof(int),
|
||||||
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0);
|
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0);
|
||||||
|
visited = mmap(NULL, max_entries * sizeof(int),
|
||||||
|
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0);
|
||||||
|
|
||||||
if ((keys == MAP_FAILED) || (values == MAP_FAILED) || (visited == MAP_FAILED)) {
|
if ((keys == MAP_FAILED) || (values == MAP_FAILED) || (visited == MAP_FAILED)) {
|
||||||
pr_perror("Can't mmap()");
|
pr_perror("Can't mmap()");
|
||||||
goto err;
|
goto err;
|
||||||
@ -133,7 +133,7 @@ int main(int argc, char **argv)
|
|||||||
pr_perror("Could not parse new map fdinfo from procfs");
|
pr_perror("Could not parse new map fdinfo from procfs");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmp_bpf_map_info(&old_map_info, &new_map_info)) {
|
if (cmp_bpf_map_info(&old_map_info, &new_map_info)) {
|
||||||
pr_err("bpf_map_info mismatch\n");
|
pr_err("bpf_map_info mismatch\n");
|
||||||
goto err;
|
goto err;
|
||||||
@ -167,7 +167,7 @@ err:
|
|||||||
munmap(keys, max_entries * sizeof(int));
|
munmap(keys, max_entries * sizeof(int));
|
||||||
munmap(values, max_entries * sizeof(int));
|
munmap(values, max_entries * sizeof(int));
|
||||||
munmap(visited, max_entries * sizeof(int));
|
munmap(visited, max_entries * sizeof(int));
|
||||||
|
|
||||||
fail();
|
fail();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ static int map_batch_verify(int *visited, uint32_t max_entries, int *keys, int *
|
|||||||
{
|
{
|
||||||
memset(visited, 0, max_entries * sizeof(*visited));
|
memset(visited, 0, max_entries * sizeof(*visited));
|
||||||
for (int i = 0; i < max_entries; i++) {
|
for (int i = 0; i < max_entries; i++) {
|
||||||
|
|
||||||
if (keys[i] + 1 != values[i]) {
|
if (keys[i] + 1 != values[i]) {
|
||||||
pr_err("Key/value checking error: i=%d, key=%d, value=%d\n", i, keys[i], values[i]);
|
pr_err("Key/value checking error: i=%d, key=%d, value=%d\n", i, keys[i], values[i]);
|
||||||
return -1;
|
return -1;
|
||||||
@ -76,13 +76,13 @@ int main(int argc, char **argv)
|
|||||||
.flags = 0,
|
.flags = 0,
|
||||||
);
|
);
|
||||||
|
|
||||||
keys = mmap(NULL, max_entries * sizeof(int),
|
keys = mmap(NULL, max_entries * sizeof(int),
|
||||||
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0);
|
|
||||||
values = mmap(NULL, max_entries * sizeof(int),
|
|
||||||
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0);
|
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0);
|
||||||
visited = mmap(NULL, max_entries * sizeof(int),
|
values = mmap(NULL, max_entries * sizeof(int),
|
||||||
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0);
|
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0);
|
||||||
|
visited = mmap(NULL, max_entries * sizeof(int),
|
||||||
|
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0);
|
||||||
|
|
||||||
if ((keys == MAP_FAILED) || (values == MAP_FAILED) || (visited == MAP_FAILED)) {
|
if ((keys == MAP_FAILED) || (values == MAP_FAILED) || (visited == MAP_FAILED)) {
|
||||||
pr_perror("Can't mmap()");
|
pr_perror("Can't mmap()");
|
||||||
goto err;
|
goto err;
|
||||||
@ -132,7 +132,7 @@ int main(int argc, char **argv)
|
|||||||
pr_perror("Could not parse new map fdinfo from procfs");
|
pr_perror("Could not parse new map fdinfo from procfs");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmp_bpf_map_info(&old_map_info, &new_map_info)) {
|
if (cmp_bpf_map_info(&old_map_info, &new_map_info)) {
|
||||||
pr_err("bpf_map_info mismatch\n");
|
pr_err("bpf_map_info mismatch\n");
|
||||||
goto err;
|
goto err;
|
||||||
@ -166,7 +166,7 @@ err:
|
|||||||
munmap(keys, max_entries * sizeof(int));
|
munmap(keys, max_entries * sizeof(int));
|
||||||
munmap(values, max_entries * sizeof(int));
|
munmap(values, max_entries * sizeof(int));
|
||||||
munmap(visited, max_entries * sizeof(int));
|
munmap(visited, max_entries * sizeof(int));
|
||||||
|
|
||||||
fail();
|
fail();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -76,18 +76,18 @@ int subreaper(void)
|
|||||||
pr_perror("Wrong exit status for HELPER: %d", status);
|
pr_perror("Wrong exit status for HELPER: %d", status);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Give control to ORPHAN so it can check its parent */
|
/* Give control to ORPHAN so it can check its parent */
|
||||||
futex_set_and_wake(&sh->fstate, TEST_CHECK);
|
futex_set_and_wake(&sh->fstate, TEST_CHECK);
|
||||||
futex_wait_until(&sh->fstate, TEST_EXIT);
|
futex_wait_until(&sh->fstate, TEST_EXIT);
|
||||||
|
|
||||||
/* Cleanup: reap the ORPHAN */
|
/* Cleanup: reap the ORPHAN */
|
||||||
wait(&status);
|
wait(&status);
|
||||||
if (!WIFEXITED(status) || WEXITSTATUS(status)) {
|
if (!WIFEXITED(status) || WEXITSTATUS(status)) {
|
||||||
pr_perror("Wrong exit status for ORPHAN: %d", status);
|
pr_perror("Wrong exit status for ORPHAN: %d", status);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ int main(int argc, char *argv[])
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
test_init(argc, argv);
|
test_init(argc, argv);
|
||||||
|
|
||||||
signal(SIGPIPE, SIG_IGN);
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
|
||||||
cwd = get_current_dir_name();
|
cwd = get_current_dir_name();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user