system-call

How do I read the results of a system() call in C++?

I'm using the following code to try to read the results of a df command in Linux using popen. #include <iostream> // file and std I/O functions int main(int argc, char** argv) { FILE* fp; char * buffer; long bufSize; size_t ret_code; fp = popen("df", "r"); if(fp == NULL) { // head off errors reading the results...

Linux Kernel programming: trying to get vm_area_struct->vm_start crashes kernel

Hi, this is for an assignment at school, where I need to determine the size of the processes on the system using a system call. My code is as follows: ... struct task_struct *p; struct vm_area_struct *v; struct mm_struct *m; read_lock(&tasklist_lock); for_each_process(p) { printk("%ld\n", p->pid); m = p->mm; v = m->mmap; ...

GPG system call in PHP

I need to append my public key (which is in a variable) in pubring of .gnupg using the system call in PHP. What system call is available for this? $gpg = system('gpg --recipient userid --output outfile.asc --armor --encrypt hello.txt', $retvalue);//calling gpg encrypt command using system call echo ' Output: ' . $gpg . ' Return value:...

Kernel panic when altering system_call in entry.S

I'm trying to implement a system call counter, and as a result I included an int value in task_struct, and a function that increments it in a separate file. This function is supposed to be called from system_call right before it actually calls the required sys_call (I have my reasons to call it before and not after). However, if I place ...

Doubts in System call mechanism in linux

We transit from ring3 to ring0 using 'int' or the new 'syscall/sysenter' instruction. Does that mean that the page tables and other stuffs that needs to be modified for the kernel is automatically done by the 'int' instruction or the interrupt handler for the 'int 0x80' will do the required stuff and jump to the respective system call. ...