According to this system calls table, linux system calls are different across architecture, but IMO syscalls are higher level encapsulation which do not depent on any specific architechture. Why is it designed this way? In a specific case, riscv64 linux doesn’t have mkdir, instead it has mkdirat, but weirdly it doesn’t have rmdir or rmdirat, how could it implement /bin/rmdir
Tag: system-calls
Linux: let a process fail, if it does opens a file for writing [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question
How to increase the size of memory region allocated with mmap()
I’m allocating memory using mmap Linux syscall. Is it possible to increase the size of allocated memory region preserving its start address and contents? How to do it properly? Answer On Linux, use the mremap(2) Linux-specific system call without MREMAP_MAYMOVE to extend the existing mapping, without considering the option of remapping those physical pages to a different virtual address where
Why does strace ignore some syscalls (randomly) depending on environment/kernel?
If I compile the following program: and then run it under strace in “standard” Kubuntu, I get this: As you can see, there is no clock_gettime (full strace output is here). On the other hand, if I run the same app in my custom built linux kernel under qemu, I get the following output: Which is more expected – there
read directories withoud readdir
I’m working on POSIX linux to learn. I’m using C Programming Languages. I want to read a folder, but instead of using readdir or opendir, I want to use pure open and read, I want to extract subfolders or files in this folder as names as string. Is this possible with open() and read() as open and read (without using
Finding the number of bytes of entered string at runtime
I’m new at learning assembly x86. I have written a program that asks the user to enter a number and then checks if it’s even or odd and then print a message to display this information. The code works fine but it has one problem. It only works for 1 digit numbers: It does not work properly for numbers with
Usage of getc with a file
To print the contents of a file one can use getc: How efficient is the getc function? That is, how frequently does it actually do operating system calls or something that would take a non-trivial amount of time? For example, let’s say I had a 10TB file — would calling this function trillions of times be a poor way to
Why do system calls use a different stack?
Here is a question about the details happening during system call. However, one thing surprises me that the TSS maintains different stacks for different priviliges. That is, codes running in user mode and system mode are using different stack context. Since system call is actually a function call, why couldn’t we just reuse the user stack and just create a
Why am I not able to view the clone() system call in strace output when typing ‘strace ls’ in terminal?
My understanding is that when we type ls in the terminal: It invokes fork() library function which invokes system call clone() to create a child process. Then system call execve() is invoked to replace address space of the new process created with new content. In that case I was expecting to see system calls clone() and execve() in the strace
Which system call does the Linux file command use?
Do you know which system call the Linux file command uses to determine the type of file? On the command line, if you use the file command it will reply with something like: dev-1:~/$ file download.png download.png: PNG image data, 724x 724, 8-bit/color RGBA, non-interlaced Is this an entire routine that does that? Or is there a system call that