FAQ Database Discussion Community


Linux x86 syscall 355 is run repeatedly on bootup and causes crash unless returns -ENOSYS

linux,linux-kernel,x86,system-calls,syscall
kernel version: 3.14.33 Before I added any system calls, the highest-numbered one for x86 (32 bit) was 352. I then added 353-357 by simply adding a row each to arch/x86/syscall/syscall_32.tbl and then using SYSCALL_DEFINEx as appropriate in kernel/*. The problem is with the syscall numbered 355. It is run repeatedly...

Software interrupts on AVR

posix,interrupt,system-calls,avr,syscall
I understand that x86 machine code can make POSIX system calls using software interrupts (by entering a 32-bit value corresponding to a kernel function into the EAX register of the processor and then executing INT 0x80). I'm looking into designing a small Unix-like operating system for the AVR architecture for...

Why does x86_64 assembly have odd syscall argument order?

assembly,x86-64,syscall,arm64
According to the syscall man page in the Architecture calling conventions section, it states the various register orders for each architecture syscall arguments. All of them make some sort of logical ordered sense, except x86_64. For example, arm64 uses x0, x1, x2, x3, x4, then x5 in order, which seems...

rmdir (2) used for directory tree removal

filesystems,standards,system-calls,syscall,standards-compliance
If a particular filesystem supports cheap removal of whole directories (with everything inside), would it be acceptable by POSIX / Linux / de-facto standards to let rmdir syscall delete a directory successfully even if it was not empty? Manpage for rmdir(2) syscall specifies an error ENOTEMPTY can (or should?) be...

How am I able to use read() and write() without including “unistd.h”?

c,file-io,header-files,syscall,unistd.h
I have used syscalls read() and write() in my program WITHOUT including "unistd.h" header file in the program. But still the program works and gives expected results. After running the program, i thought i will read the man page for read() and write(). In the man 2 page for read()...

function of rdi register during sys_exit syscall

assembly,linux-kernel,x86-64,syscall
I have isolated the sys_exit call to the following instruction on my machine xorq %%rdi, %%rdi /* return value */ movq $60, %%rax syscall What is the purpose of the rdi resister in this case? What is this sys call expected to return? ...

why non-blocking write to disk doesn't return EAGAIN or EWOULDBLOCK?

c,linux,kernel,nonblocking,syscall
I modified a program from APUE, the program first open a file, then mark the fd as non-blocking, then continue write to the fd until write return -1. I think since disk I/O is slow, when write buffers in OS is nearly full, the write system call will return -1,...

Floating-point computation without syscall?

linux-kernel,floating-point,syscall
I am reading Robert Love's book on Linux kernel (which says no FP computation inside kernel). And I am wondering how floating point computation is done in user space. For instance, does 3.14 + 5.26 (in C) invoke any syscall to do the job?...

How do I make syscalls from my C program

c,linux-kernel,syscall
How do I make system calls from my C program. For example, how do I call the following function? What headers would I have to include? asmlinkage long sys_exit(int error_code); ...

Syscall to new server in Minix 3.2.1

server,syscall,minix
I implemented a new server in minix. It seems to work fine, after "service up..." it is up and waits for messages. In client file: 1)I get endpoint with minix_rs_lookup("serverName",*pt) 2)call _syscall(pt,...) After that I'm getting: sys_call: ipc mask denied SENDREC from number1 to number2 I searched through minix code...

Callling the brk syscall using inline assembler

x86-64,inline-assembly,syscall
How can I implement brk syscall in x86-64 linux? My code is as follows: Mysyscall(uint64_t n, uint64_t a1){ uint64_t ret; __asm__ __volatile__("movq %0, %%rax\n\t" "movq %1, %%rdi\n\t" "syscall\n" : "=r"(ret) : "g"(n), "g"(a1)); return ret; } Mysyscall(SYS_brk, uint64_t increment); But it is not working. I think I may use wrong...

pointer to char changes after opendir() system call

c,linux,syscall,opendir
i am currently trying to delete directories from system call using c and i am facing a weird problem. In my deleteFunction() after using the char * path to open the directory. the value of path changes here is part of the code: #include <dirent.h> #include <stdio.h> #include <stdlib.h> #include...

How to trace system calls in FreeBSD from source code?

freebsd,system-calls,syscall,truss
How to log system calls (the syscall number and the return value, for both int 0x80 and sysenter/syscall) on FreeBSD 10.1 x86_64 from source code? I know truss can do the work, but I need to log other information like the buffer of copyout during each system call. I tried...

Assembly execve failure -14

linux,assembly,nasm,elf,syscall
Program writes executable placed in it's second segment on disk, decrypts it(into /tmp/decbd), and executes(as it was planned) file decbd appears on disk, and can be executed via shell, last execve call return eax=-14, and after end of the program, execution flows on data and gets segfault. http://pastebin.com/KywXTB0X In second...

VT-100 commands are working strangely

linux,nasm,syscall,vt100
I'm writing simple clock program with NASM. I'm using Ubuntu 14.10 Vagrant box under OSX via iTerm. Terminal is xterm, so should be VT-100 compatible. I need to remove one line. For instance, I expect the following behaviour: Hello, this is clock program 13:01:25 UTC+4 Next moment: Hello, this is...

Creating array with mmap function. Assembler x86_64 AT&T

linux,assembly,x86-64,mmap,syscall
I want to create an array that will contains for example 4 values Here's my code: mov $32,%rsi # 4 x 8bytes mov $9,%rax mov $0,%rdi mov $0x3,%rdx mov $0x01,%r10 mov $0,%r9 syscall Now I am having a new adress of alocated 32 bytes in rax? When I am trying...

How to uninitialize the entropy of /dev/urandom in C?

c,random,syscall,libc
Is there a way to make that the entropy of /dev/urandom is and stay uninitialized? My goal is to simulate an initialized or simply uninitialize /dev/urandom. How can I do a such thing? edit: I see my question has been downvoted. I am sure the person who did has a...

Print floats in nasm without binding to C functions

linux,assembly,nasm,syscall
I'm wondering, how to print float numbers in nasm using only syscalls in linux. I have the following code, but it prints only @ section .data num dq 2.0 len equ $ - num section .text global _start _start: mov edx, len mov ecx, num mov ebx, 1 mov eax,...

Can't access the open /arch/x86/syscalls/syscall_32.tbl

linux-kernel,syscall
As i'm writing this command after i shift to the kernel. When i compile it, it wasn't showing any list.Is there any other command to open the list ? open /arch/x86/syscalls/syscall_32.tbl ...

Separating a string in C++

c++,string,strtok,syscall
I am trying to separate a string into multiple strings, to make a customized terminal. So far I have been separating control signals using strtok, however I do not understand how to separate specific instances of a character. For example: string input = "false || echo \"hello world\" | grep...