Why is the exitcode given in this paragraph of Linux x64 syscall _ _ NR_exit wrong?

this is a piece of code in C that calls ASM directly:

  http://blog.rchapman.org/post.

Dec.01,2021

problem solved. The problem is that my failure to declare rax in the fourth domain of asm () causes changed, to cause 0 to be stored directly in rax .

the correct code is as follows:

void _start() {
    int ret = 2;
    asm(
        "mov $60, %%rax;"  // __NR_exit
        "mov %0, %%edi;"   // param 1
        "syscall"
        :
        : "r"(ret)
        : "rax", "rdi"
    );
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5bd32-27b99.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5bd32-27b99.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?