Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6334

How to implement a system call that could check if itself has been successfully executed without going to the kernel log?

$
0
0

I have just stepped into the kernel world and would like to add some system calls. My goal is to add a system call that lets me check if it executed (without looking at the kernel log). However, I have been thinking for a long time, but have not yet figured out how to implement it. Could anyone please give me some advice? Or some pseudocodes? Thanks in advance.

My thinking is that we could implement a new system call, in which it writes something into a buffer. Then, another system call reads the content of the buffer to check if the previous system call has written to the buffer. (Somehow like pthread_create and pthread_join) Hence, my implementation consists of 2 system calls in total.

Here is a sketch of my thinking written in pseudocode:

syscall_2(...){    if (syscall_1 executes)        return 0;    if (syscall_1 NOT executes)        return -1;}syscall_1(){    do something;    create a buffer;    write something into buffer;    return syscall_2(buffer); // checks what is in buffer}

Viewing all articles
Browse latest Browse all 6334

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>