[RFC PATCH 04/15] [fix] Fix simple compile errors
Ákos Uzonyi
uzonyi.akos at gmail.com
Mon Jun 1 11:44:33 UTC 2020
---
Makefile.am | 1 +
btree.c | 5 ++---
linux/dummy.h | 2 +-
pidns.c | 22 +++++++++++-----------
4 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index e9e537e5..aa7cf0ed 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -68,6 +68,7 @@ libstrace_a_SOURCES = \
bpf_fprog.h \
bpf_seccomp_filter.c \
bpf_sock_filter.c \
+ btree.c \
btrfs.c \
cacheflush.c \
capability.c \
diff --git a/btree.c b/btree.c
index ac279f82..cefd5b1e 100644
--- a/btree.c
+++ b/btree.c
@@ -9,7 +9,7 @@
#include "btree.h"
-static const ptr_sz_lg = (sizeof(uint64_t *) == 8 ? 3 : 2);
+static const uint8_t ptr_sz_lg = (sizeof(uint64_t *) == 8 ? 3 : 2);
bool
btree_check(uint8_t item_size_lg, uint8_t ptr_block_size_lg,
@@ -166,7 +166,7 @@ btree_get_block(struct btree *b, uint64_t key, bool auto_create)
btree_filler((uintptr_t) BTREE_SET,
ptr_sz_lg + 3);
- for (i = 0; i < (1 << (sz - 3)); i++)
+ for (i = 0; i < ((unsigned int)1 << (sz - 3)); i++)
((uint64_t *) *cur_block)[i] = filler;
}
}
@@ -267,7 +267,6 @@ void
btree_free_block(struct btree *b, uint64_t **block, uint8_t depth,
int max_depth)
{
- size_t count;
size_t sz;
size_t i;
diff --git a/linux/dummy.h b/linux/dummy.h
index c6921cb2..1ec110fe 100644
--- a/linux/dummy.h
+++ b/linux/dummy.h
@@ -56,7 +56,7 @@
# define sys_getppid sys_getpid
# define sys_getresgid sys_getresuid
# define sys_getresgid16 sys_getresuid16
-# define sys_lstat sys_statq
+# define sys_lstat sys_stat
# define sys_lstat64 sys_stat64
# define sys_mkdir sys_chmod
# define sys_mkdirat sys_fchmodat
diff --git a/pidns.c b/pidns.c
index db734f33..a2ec2cc4 100644
--- a/pidns.c
+++ b/pidns.c
@@ -189,7 +189,7 @@ get_id_list(int proc_pid, int *id_buf, enum pid_type type)
char *p;
char *endp;
FILE *f;
- size_t idx;
+ size_t idx = -1;
ssize_t ret;
ret = asprintf(&buf, "/proc/%s/status", pid_to_str(proc_pid));
@@ -378,10 +378,12 @@ update_proc_data_cache(struct proc_data *pd, enum pid_type type)
/**
* Removes references to the proc_data entry from all caches.
*/
+/*
static void
invalidate_proc_data(struct proc_data *pd)
{
}
+*/
/**
* Caches:
@@ -411,10 +413,8 @@ find_pid(struct tcb *tcp, int dest_id, enum pid_type type, int *proc_pid_ptr)
DIR *dp = NULL;
struct dirent *entry;
- const char *id_str;
- size_t idx;
+ int idx;
long proc_pid = -1;
- int ret;
int res = -1;
if ((type >= PT_COUNT) || (type < 0))
@@ -425,7 +425,7 @@ find_pid(struct tcb *tcp, int dest_id, enum pid_type type, int *proc_pid_ptr)
*proc_pid_ptr =
dest_id ? dest_id : syscall(__NR_gettid);
- if (dest_id) {
+ if (dest_id)
return dest_id;
switch (type) {
@@ -515,21 +515,21 @@ find_pid_get_pid:
}
} else {
for (idx = 0; idx < pd->ns_count - 1; idx++) {
- if (pr->ns_hierarchy[idx] != dest_ns)
+ if (pd->ns_hierarchy[idx] != dest_ns)
continue;
- if (pr->id_hierarchy[type][pd->id_count[type] -
+ if (pd->id_hierarchy[type][pd->id_count[type] -
idx + 1] != dest_id)
break;
res = pd->id_hierarchy[type][pd->id_count[type] -
- pd->ns_count]
+ pd->ns_count];
goto find_pid_dir;
}
}
put_proc_data(pd);
- } while (1)
+ } while (1);
find_pid_dir:
closedir(dp);
@@ -544,7 +544,7 @@ find_pid_exit:
}
int
-get_proc_pid(struct *tcp)
+get_proc_pid(struct tcb *tcp)
{
if (!is_proc_ours()) {
int ret;
@@ -573,7 +573,7 @@ printpid(struct tcb *tcp, int pid, enum pid_type type)
tprintf("%d", pid);
if (perform_ns_resolution) {
- find_pid(tcp, 0, type, NULL);
+ strace_pid = find_pid(tcp, 0, type, NULL);
if ((strace_pid > 0) && (pid != strace_pid))
tprintf_comment("%d in strace's PID NS", strace_pid);
--
2.26.2
More information about the Strace-devel
mailing list