I have done the following:
Create a virtual timer that triggers repeatedly.
Install signal handler for SIGVTALRM
Call clone syscall
Set sched_affinity such that the cloned thread runs on a different CPU
Will the cloned thread also be listening for SIGVTALRM? So will both the threads call the signal handler when SIGVTALRM is triggered...
Currently I have some code like (condensed and removed a bunch of error checking):
dp = readdir(dir);
if (dp->d_type == DT_DIR) {
}
This works swimmingly on my Linux machine. However on another machine (looks like SunOS, sparc):
SunOS HOST 5.10 Generic_127127-11 sun4u sparc SUNW,Ultra-5_10
I get the following error at compile time...
select() is a great system call. You can pack any number of file descriptors, socket descriptors, pipes, etc. and get notified in a synchronous fashion when input becomes available.
Is there a way to create an interval/oneshot timer and use it with select()? That would save me from having multiple threads for IO and timing.
...
When I was reading Operating System Concepts (7e, Silberschatz, Galvin, Gagne), I encountered a study project about adding a system call to the linux kernel. The book says that
The system call numbers for recent versions of the Linux kernel are listed in
/usr/src/linux-2.x/include/asm-i386/unistd.h. (for instance, __NR_close, whic...
I would like to acquire the address of the vsyscall page for my own uses. I only have two ideas here: alter the compiler to store this information in some known location after it is given to __start, or read /proc/[pid]/maps. I really don't want to read /proc/ as that is slow and shouldn't be necessary. I also don't want to make compi...
Hi
I am running an executable that uses libmysqlclient.so.15 on a 64bit kernel & 32bit user space compatibility mode.
Once in a while, my program hangs on something from libmysql:
#0 0xf7f01430 in __kernel_vsyscall ()
#1 0xf7b451e3 in vmsplice () from /lib/i686/cmov/libc.so.6
#2 0xf7e72c10 in ?? () from /usr/lib/libmysqlclient.so.1...
I'm trying to implement a syscall in Linux (RedHat Enterprise 8) and I'm a bit confused about the way it works. From what I understand, I implement a wrapper in user mode which puts the syscall number in eax and parameters in ebx, ecx, edx, etc, and then invokes int 0x80 which calls the appropriate syscall. My question is, since a syscal...
Explains both UNIX (BSD flavor) & Linux system call conventions for x86-32:
http://www.int80h.org/bsdasm/#system-calls
http://www.freebsd.org/doc/en/books/developers-handbook/x86-system-calls.html
Can any one please tell me or point me to similar doc for x86-64 on both UNIX & Linux?
...
I am trying to understand why this design decision was made with the rename() syscall in 4.2BSD. There's nothing I'm trying to solve here, just understand the rationale for the behavior itself.
4.2BSD saw the introduction of the rename() syscall for the purpose of allowing atomic renames/moves of files. From 4.3BSD-Reno/src/sys/ufs/uf...
I use syscall SYS_time, but its resolution is 1 second.
Is there any other solution?
...
I'm trying to figure out how to get a list of and documentation for the system calls available in the XNU kernel in OSX. I've googled around quite a bit, but haven't been able to find anything of use. As I understand the calling conventions match BSD, is that correct?
Thanks
...
Hi
I wanted to try out the splice syscall. I have this function - it should copy content of one file to another:
static void test_splice( int in, int out ) {
int i = 0, rcvd = 0;
int filedes[2];
off_t off = 0;
if ( pipe( filedes ) < 0 ) {
perror( "Kicha pipe" );
exit( EX...
I have a long list of all the calls a program I have does. What i need to know is which DLL each call belongs to. How would I find this out?
Thanks,
...
I'd like to play around with the debug MSRs defined in the x86 spec (DR0-7) from my OSX user-space program. Unfortunately, these require CPL == 0 (aka ring 0). I've thumbed through the OSX syscalls and with the exception of kernel_debug nothing really jumps out as a way to access these.
It may be the case that they are only available vi...
Hi,
when i search for adding a system call, i get many articles but they seem to be for old versions, it also seems like a trivial process.
But the problem is, the directories that articles suggest does not hold for the version 2.6.31. does anyone know where unistd.h, syscall_table.S and syscalls.h or their corresponding files are?
Th...
I have the below code that opens up a file, reads it into a buffer and then closes the file.
The close file system call requires that the file descriptor number be in the ebx register. The ebx register gets the file descriptor number before the read system call is made. My question is should I save the ebx register on the stack or somew...
Is there a way to have a bit bucket pointer?
A lot of IO (specifically input related) system calls return data to a buffer of a specific size. Is there a trick or way to make a sorta bit bucket pointer, so I can accept any amount of data that will be thrown away. Doing something like "char tmp[INT_MAX]" is crazy. The behavior I am looki...
Is there a POSIX syscall to resolve filesystem paths? I have the CWD for a path, as well as the path to a file from that CWD. I can't use chdir to switch to the directory because I need to resolve paths from multiple threads simultaneously. I considered appending a / in between the CWD and the path, but for some reason it feels like that...
I'm looking for some good code examples of dynamic memory allocation using an assembly language under Linux and using system calls, not malloc and friends.
What are some of the simplest but effective ways to do this?
On Intel 386+ computers.
...
Hi, I successfully called the exit syscall from assembly but I'm strugling to call the _getpid syscall and use it's return value. Here is the code I'm using
.text
.globl _getpiddirect
_getpiddirect:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
movl $39, %eax
int $0x80
addl $8, %esp
popl %ebp
ret
and
#inc...