Top "System-calls" questions

A system call is used by programs to request services from the operating system's kernel.

How is malloc() implemented internally?

Can anyone explain how malloc() works internally? I have sometimes done strace program and I see a lot of sbrk …

c memory malloc system-calls sbrk
practical examples use dup or dup2

I know what dup / dup2 does, but I have no idea when it would be used. Any practical examples? Thanks.

c file unix system-calls dup
warning: incompatible implicit declaration of built-in function ‘printf’ [enabled by default]

I'm using the following C code: #include <unistd.h> #include <fcntl.h> #include <sys/types.…

c system-calls
How to write a signal handler to catch SIGSEGV?

I want to write a signal handler to catch SIGSEGV. I protect a block of memory for read or write …

c linux system-calls signal-handling mprotect
How do I get a thread ID from an arbitrary pthread_t?

I have a pthread_t, and I'd like to change its CPU affinity. The problem is that I'm using glibc 2.3.2, …

c linux unix pthreads system-calls
How to make a call to an executable from Python script?

I need to execute this script from my Python script. Is it possible? The script generate some outputs with some …

python linux executable system-calls
Python: waiting for external launched process finish

The question already in title - how can one make the python script wait until some process launched with os.…

python system-calls
Printing newline in MIPS

I'm using MARS MIPS simulator and I want to print a newline in my program. .data space: .asciiz "\n" .text …

mips system-calls
How can I make the system call write() print to the screen?

For my OS class I'm supposed to implement Linux's cat using only system calls (no printf) Reading this reference I …

c linux system-calls
How to check the value of errno?

I am using a system call and in case it fails, I need to do different things for different errnos. …

c system-calls errno