int curcol; /* Output column for this process */
FILE *outf; /* Output file for this process */
const char *auxstr; /* Auxiliary info from syscall (see RVAL_STR) */
+ void *_priv_data; /* Private data for syscall decoding functions */
+ void (*_free_priv_data)(void *); /* Callback for freeing priv_data */
const struct_sysent *s_ent; /* sysent[scno] or dummy struct for bad scno */
const struct_sysent *s_prev_ent; /* for "resuming interrupted SYSCALL" msg */
struct timeval stime; /* System time usage as of last process wait */
extern void temporarily_clear_syserror(struct tcb *);
extern void restore_cleared_syserror(struct tcb *);
+extern void *get_tcb_priv_data(const struct tcb *);
+extern int set_tcb_priv_data(struct tcb *, void *priv_data,
+ void (*free_priv_data)(void *));
+extern void free_tcb_priv_data(struct tcb *);
+
+static inline unsigned long get_tcb_priv_ulong(const struct tcb *tcp)
+{
+ return (unsigned long) get_tcb_priv_data(tcp);
+}
+
+static inline int set_tcb_priv_ulong(struct tcb *tcp, unsigned long val)
+{
+ return set_tcb_priv_data(tcp, (void *) val, 0);
+}
+
extern int umoven(struct tcb *, long, unsigned int, void *);
#define umove(pid, addr, objp) \
umoven((pid), (addr), sizeof(*(objp)), (void *) (objp))
error_msg_and_die("bug in alloctcb");
}
+void *
+get_tcb_priv_data(const struct tcb *tcp)
+{
+ return tcp->_priv_data;
+}
+
+int
+set_tcb_priv_data(struct tcb *tcp, void *const priv_data,
+ void (*const free_priv_data)(void *))
+{
+ if (tcp->_priv_data)
+ return -1;
+
+ tcp->_free_priv_data = free_priv_data;
+ tcp->_priv_data = priv_data;
+
+ return 0;
+}
+
+void
+free_tcb_priv_data(struct tcb *tcp)
+{
+ if (tcp->_priv_data) {
+ if (tcp->_free_priv_data) {
+ tcp->_free_priv_data(tcp->_priv_data);
+ tcp->_free_priv_data = NULL;
+ }
+ tcp->_priv_data = NULL;
+ }
+}
+
static void
droptcb(struct tcb *tcp)
{
if (tcp->pid == 0)
return;
+ free_tcb_priv_data(tcp);
+
#ifdef USE_LIBUNWIND
if (stack_trace_enabled) {
unwind_tcb_fin(tcp);
line_ended();
tcp->flags &= ~TCB_INSYSCALL;
tcp->sys_func_rval = 0;
+ free_tcb_priv_data(tcp);
return res;
}
tcp->s_prev_ent = tcp->s_ent;
ret:
tcp->flags &= ~TCB_INSYSCALL;
tcp->sys_func_rval = 0;
+ free_tcb_priv_data(tcp);
return 0;
}