mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 11:16:11 +00:00
Kernel logs when thread ends
This commit is contained in:
parent
ddf2ede927
commit
bd4b19f8a7
3 changed files with 34 additions and 0 deletions
|
@ -17,6 +17,7 @@ struct ReplyMessage{
|
||||||
|
|
||||||
#define EXECVE_MESSAGE 1
|
#define EXECVE_MESSAGE 1
|
||||||
#define CLONE_MESSAGE 2
|
#define CLONE_MESSAGE 2
|
||||||
|
#define EXIT_MESSAGE 3
|
||||||
#ifdef AHA_DEBUG
|
#ifdef AHA_DEBUG
|
||||||
#define AHA_PRINTK(args...) printk(args)
|
#define AHA_PRINTK(args...) printk(args)
|
||||||
#else
|
#else
|
||||||
|
@ -30,4 +31,5 @@ void aha_handle_insult_messages(struct ReplyMessage *msg, char __user* file,\
|
||||||
char __user* __user* argv);
|
char __user* __user* argv);
|
||||||
void aha_get_reply_message(char* key, struct ReplyMessage *msg);
|
void aha_get_reply_message(char* key, struct ReplyMessage *msg);
|
||||||
void aha_record_sys_clone(int pid, int ppid);
|
void aha_record_sys_clone(int pid, int ppid);
|
||||||
|
void aha_dump_exits(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -232,3 +232,33 @@ void aha_record_sys_clone(int pid, int ppid)
|
||||||
#undef buf__size
|
#undef buf__size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Tracks if a thread exits, aiming to free up pids in the process trees
|
||||||
|
* Process trees are internally read fronm task_struct
|
||||||
|
*/
|
||||||
|
void aha_dump_exits(void)
|
||||||
|
{
|
||||||
|
int mode = 0644;
|
||||||
|
int fd;
|
||||||
|
struct openflags flg;
|
||||||
|
char filename[32];
|
||||||
|
char qn[64];
|
||||||
|
char buf[16];
|
||||||
|
flg.w = 1;
|
||||||
|
flg.c = 1;
|
||||||
|
if (aha_create_filename((char*)&filename,32)>0){
|
||||||
|
/* Put message in output queue */
|
||||||
|
if (snprintf((char*)&qn,64,"out/%s",filename)>0){
|
||||||
|
if ((fd = os_open_file(qn,flg,mode))>0){
|
||||||
|
__aha_set_type_tag(fd,(char*)&buf,16,EXIT_MESSAGE);
|
||||||
|
__aha_dump_pid_ppids(fd,(char*)&buf,16);
|
||||||
|
__aha_set_done_tag (fd,(char*)&buf,16);
|
||||||
|
os_close_file(fd);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
AHA_PRINTK("record-exit: Could not put filename in output queue\n");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
AHA_PRINTK("record-exit: No filename could be generated\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "skas.h"
|
#include "skas.h"
|
||||||
#include "tlb.h"
|
#include "tlb.h"
|
||||||
|
#include "shared/aha.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is a per-cpu array. A processor only modifies its entry and it only
|
* This is a per-cpu array. A processor only modifies its entry and it only
|
||||||
|
@ -123,6 +124,7 @@ void interrupt_end(void)
|
||||||
|
|
||||||
void exit_thread(void)
|
void exit_thread(void)
|
||||||
{
|
{
|
||||||
|
aha_dump_exits();
|
||||||
}
|
}
|
||||||
|
|
||||||
void *get_current(void)
|
void *get_current(void)
|
||||||
|
|
Loading…
Reference in a new issue