aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ali Polatel <alip@exherbo.org> 2010-12-09 20:57:58 +0200
committerAvatar Ali Polatel <alip@exherbo.org> 2010-12-09 20:57:58 +0200
commita39249c11e4aa92ba54f8b78ba0dbe05951ec4b0 (patch)
tree7074b2e7bd647a35dc2632816609c5c7105f83a0
parent1f47a49e93f131041468314a1d49fa603e87563b (diff)
downloadsydbox-next.tar.gz
sydbox-next.tar.xz
Update for the recent pinktrace_easy changesnext
-rw-r--r--src/syd-callbacks.c14
-rw-r--r--src/syd-callbacks.h14
-rw-r--r--src/syd-context.c22
-rw-r--r--src/syd-context.h2
-rw-r--r--src/syd-syscall.c10
-rw-r--r--src/syd-syscall.h2
6 files changed, 32 insertions, 32 deletions
diff --git a/src/syd-callbacks.c b/src/syd-callbacks.c
index 674cdaf..d70744a 100644
--- a/src/syd-callbacks.c
+++ b/src/syd-callbacks.c
@@ -56,7 +56,7 @@ static void sydbox_child_data_free(void *userdata)
g_free(data);
}
-void sydbox_callback_birth(pink_easy_context_t *ctx, pink_easy_process_t *current, pink_easy_process_t *parent)
+void sydbox_callback_birth(const pink_easy_context_t *ctx, pink_easy_process_t *current, pink_easy_process_t *parent)
{
int i;
const char *sep;
@@ -146,7 +146,7 @@ void sydbox_callback_birth(pink_easy_context_t *ctx, pink_easy_process_t *curren
pink_easy_process_set_data(current, data, sydbox_child_data_free);
}
-void sydbox_callback_death(PINK_UNUSED pink_easy_context_t *ctx, pink_easy_process_t *current)
+void sydbox_callback_death(PINK_UNUSED const pink_easy_context_t *ctx, pink_easy_process_t *current)
{
pid_t pid;
@@ -154,7 +154,7 @@ void sydbox_callback_death(PINK_UNUSED pink_easy_context_t *ctx, pink_easy_proce
g_debug("Process:%i died, R.I.P.", pid);
}
-void sydbox_callback_end(pink_easy_context_t *ctx, bool echild)
+int sydbox_callback_end(const pink_easy_context_t *ctx, bool echild)
{
sydbox_ctx_data_t *data;
@@ -169,7 +169,7 @@ void sydbox_callback_end(pink_easy_context_t *ctx, bool echild)
exit(data->exit_code);
}
-short sydbox_callback_stop(PINK_UNUSED pink_easy_context_t *ctx, pink_easy_process_t *current, bool suspended)
+short sydbox_callback_stop(PINK_UNUSED const pink_easy_context_t *ctx, pink_easy_process_t *current, bool suspended)
{
g_debug("child %i received SIGSTOP, suspended:%s", pink_easy_process_get_pid(current), suspended ? "true" : "false");
return 0;
@@ -182,7 +182,7 @@ process_tree_resume_cb(pink_easy_process_t *proc, PINK_UNUSED void *userdata)
return true;
}
-short sydbox_callback_exit_genuine(pink_easy_context_t *ctx, pink_easy_process_t *current, int code)
+short sydbox_callback_exit_genuine(const pink_easy_context_t *ctx, pink_easy_process_t *current, int code)
{
pid_t cpid, epid;
pink_easy_process_t *eldest = pink_easy_context_get_eldest(ctx);
@@ -205,7 +205,7 @@ short sydbox_callback_exit_genuine(pink_easy_context_t *ctx, pink_easy_process_t
return 0;
}
-short sydbox_callback_exit_signal(pink_easy_context_t *ctx, pink_easy_process_t *current, int sig)
+short sydbox_callback_exit_signal(const pink_easy_context_t *ctx, pink_easy_process_t *current, int sig)
{
pid_t cpid, epid;
pink_easy_process_t *eldest = pink_easy_context_get_eldest(ctx);
@@ -228,7 +228,7 @@ short sydbox_callback_exit_signal(pink_easy_context_t *ctx, pink_easy_process_t
return 0;
}
-short sydbox_callback_syscall(pink_easy_context_t *ctx, pink_easy_process_t *current, bool entering)
+short sydbox_callback_syscall(const pink_easy_context_t *ctx, pink_easy_process_t *current, bool entering)
{
sydbox_ctx_data_t *data;
diff --git a/src/syd-callbacks.h b/src/syd-callbacks.h
index baf4573..a41837b 100644
--- a/src/syd-callbacks.h
+++ b/src/syd-callbacks.h
@@ -24,12 +24,12 @@
#include <pinktrace/easy/pink.h>
-void sydbox_callback_birth(pink_easy_context_t *ctx, pink_easy_process_t *current, pink_easy_process_t *parent);
-void sydbox_callback_death(pink_easy_context_t *ctx, pink_easy_process_t *current);
-short sydbox_callback_stop(PINK_UNUSED pink_easy_context_t *ctx, pink_easy_process_t *current, bool suspended);
-short sydbox_callback_exit_genuine(pink_easy_context_t *ctx, pink_easy_process_t *current, int code);
-short sydbox_callback_exit_signal(pink_easy_context_t *ctx, pink_easy_process_t *current, int sig);
-short sydbox_callback_syscall(pink_easy_context_t *ctx, pink_easy_process_t *current, bool entering);
-PINK_NORETURN void sydbox_callback_end(pink_easy_context_t *ctx, bool echild);
+void sydbox_callback_birth(const pink_easy_context_t *ctx, pink_easy_process_t *current, pink_easy_process_t *parent);
+void sydbox_callback_death(const pink_easy_context_t *ctx, pink_easy_process_t *current);
+short sydbox_callback_stop(PINK_UNUSED const pink_easy_context_t *ctx, pink_easy_process_t *current, bool suspended);
+short sydbox_callback_exit_genuine(const pink_easy_context_t *ctx, pink_easy_process_t *current, int code);
+short sydbox_callback_exit_signal(const pink_easy_context_t *ctx, pink_easy_process_t *current, int sig);
+short sydbox_callback_syscall(const pink_easy_context_t *ctx, pink_easy_process_t *current, bool entering);
+PINK_NORETURN int sydbox_callback_end(const pink_easy_context_t *ctx, bool echild);
#endif /* !SYDBOX_GUARD_CALLBAKCS_H */
diff --git a/src/syd-context.c b/src/syd-context.c
index 4136bf2..f161709 100644
--- a/src/syd-context.c
+++ b/src/syd-context.c
@@ -41,7 +41,7 @@
pink_easy_context_t *context_init(int argc, char **argv)
{
int options;
- pink_easy_callback_t *cb;
+ pink_easy_callback_table_t tbl;
sydbox_ctx_data_t *data;
options = PINK_TRACE_OPTION_SYSGOOD
@@ -50,24 +50,24 @@ pink_easy_context_t *context_init(int argc, char **argv)
| PINK_TRACE_OPTION_CLONE
| PINK_TRACE_OPTION_EXEC;
- cb = g_new0(pink_easy_callback_t, 1);
- cb->birth = sydbox_callback_birth;
- cb->death = sydbox_callback_death;
- cb->ev_stop = sydbox_callback_stop;
- cb->ev_exit_genuine = sydbox_callback_exit_genuine;
- cb->ev_exit_signal = sydbox_callback_exit_signal;
- cb->ev_syscall = sydbox_callback_syscall;
- cb->end = sydbox_callback_end;
+ memset(&tbl, 0, sizeof(pink_easy_callback_table_t));
+ tbl.cb_birth = sydbox_callback_birth;
+ tbl.cb_death = sydbox_callback_death;
+ tbl.cb_event_stop = sydbox_callback_stop;
+ tbl.cb_event_syscall = sydbox_callback_syscall;
+ tbl.cb_exit = sydbox_callback_exit_genuine;
+ tbl.cb_exit_signal = sydbox_callback_exit_signal;
+ tbl.cb_end = sydbox_callback_end;
data = g_new(sydbox_ctx_data_t, 1);
data->exit_code = 0;
data->argc = argc;
data->argv = argv;
- return pink_easy_context_new(options, cb, data, g_free);
+ return pink_easy_context_new(options, &tbl, data, g_free);
}
-int context_remove_child(pink_easy_context_t *ctx, pid_t pid)
+int context_remove_child(const pink_easy_context_t *ctx, pid_t pid)
{
pink_easy_process_tree_t *tree = pink_easy_context_get_tree(ctx);
diff --git a/src/syd-context.h b/src/syd-context.h
index e92dc36..62d671e 100644
--- a/src/syd-context.h
+++ b/src/syd-context.h
@@ -28,7 +28,7 @@
#include <pinktrace/easy/pink.h>
pink_easy_context_t *context_init(int argc, char **argv);
-int context_remove_child(pink_easy_context_t *ctx, pid_t pid);
+int context_remove_child(const pink_easy_context_t *ctx, pid_t pid);
#endif // SYDBOX_GUARD_CONTEXT_H
diff --git a/src/syd-syscall.c b/src/syd-syscall.c
index 265a345..8581c5d 100644
--- a/src/syd-syscall.c
+++ b/src/syd-syscall.c
@@ -231,7 +231,7 @@ static bool syscall_getaddr_net(pink_easy_process_t *proc, struct checkdata *dat
/* Initial callback for system call handler.
* Updates struct checkdata with path and dirfd information.
*/
-static void syscall_check_start(G_GNUC_UNUSED pink_easy_context_t *ctx, pink_easy_process_t *proc, struct checkdata *data)
+static void syscall_check_start(G_GNUC_UNUSED const pink_easy_context_t *ctx, pink_easy_process_t *proc, struct checkdata *data)
{
pid_t pid;
pink_bitness_t bitness;
@@ -829,7 +829,7 @@ static gchar *syscall_resolvepath(pink_easy_process_t *proc, struct checkdata *d
* returns.
* If cdata->sandbox->path is false it does nothing and simply returns.
*/
-static void syscall_check_canonicalize(G_GNUC_UNUSED pink_easy_context_t *ctx, pink_easy_process_t *proc,
+static void syscall_check_canonicalize(G_GNUC_UNUSED const pink_easy_context_t *ctx, pink_easy_process_t *proc,
struct checkdata *data)
{
pid_t pid;
@@ -1076,7 +1076,7 @@ static void syscall_handle_net(pink_easy_process_t *proc, struct checkdata *data
}
}
-static void syscall_check(G_GNUC_UNUSED pink_easy_context_t *ctx, pink_easy_process_t *proc, struct checkdata *data)
+static void syscall_check(G_GNUC_UNUSED const pink_easy_context_t *ctx, pink_easy_process_t *proc, struct checkdata *data)
{
pid_t pid;
pink_bitness_t bitness;
@@ -1137,7 +1137,7 @@ static void syscall_check(G_GNUC_UNUSED pink_easy_context_t *ctx, pink_easy_proc
}
}
-static void syscall_check_finalize(G_GNUC_UNUSED pink_easy_context_t *ctx, pink_easy_process_t *proc, struct checkdata *data)
+static void syscall_check_finalize(G_GNUC_UNUSED const pink_easy_context_t *ctx, pink_easy_process_t *proc, struct checkdata *data)
{
pid_t pid;
pink_bitness_t bitness;
@@ -1613,7 +1613,7 @@ static int syscall_handle_fcntl(pink_easy_process_t *proc)
/* Main syscall handler
*/
-int syscall_handle(pink_easy_context_t *ctx, pink_easy_process_t *proc, bool entering)
+int syscall_handle(const pink_easy_context_t *ctx, pink_easy_process_t *proc, bool entering)
{
bool decode;
pid_t pid;
diff --git a/src/syd-syscall.h b/src/syd-syscall.h
index 75a997c..79277d8 100644
--- a/src/syd-syscall.h
+++ b/src/syd-syscall.h
@@ -22,7 +22,7 @@
#include "syd-context.h"
-int syscall_handle(pink_easy_context_t *ctx, pink_easy_process_t *proc, bool entering);
+int syscall_handle(const pink_easy_context_t *ctx, pink_easy_process_t *proc, bool entering);
#endif // SYDBOX_GUARD_SYSCALL_H