system-calls

Browser and external app communication? (Chrome's current url and referrer on Windows?)

How might an external program communicate with a browser? Hopefully this will be of some use to others: I'm listing off a number of options I've seen or tried while unsuccessfully getting this to work. If you know of others, please post them. If Mac, use AppleScript (info/solution at q.263741, try this search) Use or create an extensio...

Is memory cleared by the Linux kernel when brk is reduced then increased again?

I'm just wondering about what happens to memory that a user program releases through a brk system call, then gets back again. Does the kernel clear it out or is the contents left undefined? I believe that the kernel clears out pages when they are newly allocated via brk, but I can't work out if it zeros them all if that page is returned...

getutent and Linux timer issues

I have a problem running the below code , which invokes getutent() to count the total number of users currently logged in to the system. The timer will be invoked every 1sec and will set the boolean named "isSigAlrmOccured" to true and exit.The main function checks whether the timer signal is delivered by checking this boolen and monitor...

How to get rid of the warning with time.h in C++?

When I use this #include<time.h> //... int n = time(0); //... I get a warning about converting time to int. Is there a way to remove this warning? ...

Virtual Machines and Handling Memory and System Calls

This is a homework problem that I have. I have been doing some research and couldn't find much. I did find a powerpoint but could not make much sense of it due to lack of text. http://xen.org/files/xensummit_tokyo/19_KoichiOnoue_en.pdf (Specifically, what is gPa and hPa?) I was wondering if anyone could point me in the correct directi...

How to determine where code spends a lot of time in a kernel space (system calls)

I noticed that 10% my code run is system space. However I do NOT know which system calls. I suspect, though, it is either has to do files or timestamps. Is there a tool to figure out which system calls are the culprits? Also, I want to know the frequency of (and location) of calls (and callee) . I am on AS3 thx ...

Android: Is it possible to observe system calls?

I was wondering if there is a way to observe the system calls in Android using a service... Is something like this remotely possible using Java or do I have to get down into native code...? Thanks ...

Why sshfs does not work with backtick?

When I do the following: `sshfs [email protected] /tmp/dir1/` in a irb console, the console freezes. If I use something like system("sshfs [email protected] /tmp/dir1/") it works, but I need to use backticks because the system call is in a method used many times, and some of them need the return from the shell. Any tip? ...

Why Would WIFEXITED Return True on Running Process?

When I wait on a specific running process group that is a child process, WIFEXITED returns true saying the process exited? Is this the way it works? Seems there is something I am not understanding.... if ( waitpid(-pgid, &pstatus, WUNTRACED|WNOHANG ) == -1) perror("Wait error"); if ( WIFEXITED(pstatus) ) { strncpy(buf, "Exite...

Is it possible using Linux's clone() system call to run multiple applications in the same address space?

If you don't pass the CLONE_VM flag to clone(), then the new process shares memory with the original. Can this be used to make two distinct applications (two main()'s) run in the same process? Ideally this would be as simple as calling clone() with CLONE_VM and then calling exec(), but I realize it's probably more involved. At the very l...

MIPS Syscalls and $t registers

MIPS registers have a convention - $s registers are to be preserved across subroutine calls, so if your subroutine modifies them, it should save them to the stack, while $t registers are not preserved. Now, can a syscall potentially modify a $t register? In a simulator I have, it doesn't, but could a real machine have the $t registers c...

How does Windows switch to supervisor mode during a system call?

How does Windows switch to supervisor mode during a system call? I heard something about a "trap 0", but that doesn't even seem like an x86 instruction. I stepped through some system calls, but I can't find any. Do a lot of Windows system calls run in user mode? Which DO run in supervisor mode? ...

Writing a System Calls for linux

i try to write a system call. I followed these steps: linux/arch/x86/kernel/syscall_table_32.S ----> . long sys mycall linux/include/linux/syscalls.h --------> asmlinkage int sys mycall (int i , int j ); linux/arch/x86/include/asm/unistd_32.h ----> #define NR mycall 333 I changed linux/Makefile to core-y += kernel/ mm/ f...

system call does not work same as command line

Ok I have two programs, and one calls another using executable from another. I am running it on Ubuntu terminal This is folder structure in place .../src/pgm1/pgm1 .../src/pgm0/pgm0 pgm1 and pgm0 are executables. This is how I call the other executable char cmd[1000]; string path = "/home/usr/src/"; // call pgm0 for e...

Assembly and System Calls

Im having a bit of trouble understanding the more complex system calls in assembly. I wrote a exec system call and it worked great .bss .text .globl _start _start: #exit(0) system call movl $1, %rax movl $0, %rbx int $0X80 Though I am a bit insure and have not been able to find info pertaining to how you...

Run and forget system call in php

So I am trying to execute some script from my php code. That lives in page blah.php <?php // .... // just basic web site that allows upload of file... ?> Inside I use system call if (system("blah.pl arg1") != 0) { print "error\n"; } else { print "working on it..you will receive e-mail at completion\n"; } Works great...

Why doesn't the following (perfectly valid) C code show the contents of a file in Objective-C?

Here's a very basic C snippet to open and read a file: int fd = open("test.txt",O_RDONLY); char buf[128]; int reader = read(fd,buf,128); int i; for (i=0;i<strlen(buf);i++) { printf("%i: I read: %c", i, (int)buf[i]); } I'm also including these standard headers: #include <stdio.h> #include <stdlib.h> #include <...

Limiting the File System Usage Programmatically in Linux

I was assigned to write a system call for Linux kernel, which oddly determines (and reduces) users´ maximum transfer amount per minute (for file operations). This system call will be called lim_fs_usage and will take a parameter for maximum number of bytes all users can access in a minute. For short, I am going to determine bandwidth of ...

Debugging segmentation fault in a multi-threaded (using clone) program

I wrote a code to create some threads and whenever one of the threads finish a new thread is created to replace it. As I was not able to create very large number of threads (>450) using pthreads, I used clone system call instead. (Please note that I am aware of the implication of having such a huge number of threads, but this program is ...

File can be opened only by root user..Wrong permisssions given, i guess....

My program basically runs a executable file with command line arguments. A child process is forked and the output of the child process is taken in the file "filename". The problem is that the file is made and the data is written but it can only be opened by the root user.. How can make it readable to the user who invoked the program? T...