Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 4 years ago. Improve this question I am looking to write a program that will need to
Tag: system-calls
Why doesn’t this attempt at using sys_write do anything?
Here it is: Not only does this code not segfault, it also outputs nothing. According to what I’ve read, a program should call sys_exit, or it would segfault, but this does not happen. Answer This instruction will interpret the data at “msg” as 64-bit value and load that value into the register rsi. The instruction does NOT load the address
Why gdb backtrace syscall address is different from syscall table address
I’m really confusing with syscall address. 1 now I hook a syscall(fake_sendto) replace real syscall(sct[__NR_sendto]), and it workes normally. now I dmesg to show logs: ok, I think the truely sys_sento address is above 0xffffffff8156b2c0 but when I write a test program, gdb print sendto function address is 0x7ffff7b11400 ! see below gdb debug info: why does gdb show different
Merging two text files into new one (back and forth every new line) using C in Linux using system-calls
So the assignment is merging two text files in Linux using system calls: 1.txt: Hello, my class! 2.txt: Today is a very nice day NEW.txt: Today is Hello, a very nice my class! day Problem is I get (sorry for putting this as code sample): The + sign keeps changing between (“#”, “(“, “0”, “_”, ..) with each execution.. Why
dup2 paramater order confusion
I have written this simple program: What i want is, redirect the output of ls – l to a file called “theFile.txt”. The code works as i expect. What confuses me here is the order of dup2 parameters. I believe that correct order should be dup2(1, fd) – considering fd as the newFD and 1 as the oldFD. But the
Intermittent segmentation faults in main after fork
I’m taking a class on how to learn programming multi process programs on linux on university. I’m still very green and trying my best to learn, so any thing you might see that is wrong would be welcome. I have a problem that asks me to iterate an array, one half on main process, the other half on the child
Why do write syscalls print `%` at end on linux x86_64 (nasm)?
The following hello-world program displays a % sign at the end of the printed string. Why is this and how can I remove it? Here is my program: And here is the output when I run the executable: hello, world!% Thanks in advance. Edit: It seems to be caused by zsh (not reproducible in bash). The question is why this
getnameinfo() compile time error – Extracting MAC address in Linux
I have to send to the server the IP address and MAC address of the network interface from which my client socket is connected and communicating with the server. All machines are on intra-net. I have extracted the IP of my socket and I am attempting to extract the H/W address. My strategy : Extract IP of the socket using
Do linux read/write system calls use dynamic memory allocation?
I wonder if read and write system calls on linux (used with unix sockets) do dynamic memory allocation? The context are real time applications and deterministic behaviour. Answer No. If you look for syscalls in the Linux kernel source (I used grep -rn SYSCALL_DEFINE.*write to find read/write), you can see the source for yourself: Note that system call definitions can
System call that shows processes filtered by their status
I am making a system call that loops through every process with a certain status (passed to the syscall as a parameter) and show their Name, PID, UID and the name of their children. This is what I have so far: This prints all of the system’s processes and their children, completely ignoring the condition if(task->state == state), which is