Why are linux system calls different across architectures

Direktor

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 without rmdir, even if it could (via other syscalls like read and write), why not do the same for mkdir? It's really confusing that these two syscalls don't match.

Joseph Sible-Reinstate Monica

You're looking at this from the wrong direction. mkdirat can do everything that mkdir can do and then some, so the question isn't why riscv64 doesn't have mkdir, but rather why x86 does have it. The answer to that is backwards userspace compatibility. Since Linux never breaks that, and mkdir existed first, it will exist there forever. But riscv64 never had it, so there are no userspace programs for it to break by not having it.

As for rmdir, the replacement for that isn't rmdirat, but rather unlinkat with AT_REMOVEDIR. The same argument then applies to it.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Are binaries portable across different CPU architectures?

From Dev

Why is pointer arithmetic inconsistent across architectures?

From Dev

Why do system calls use a different stack?

From Dev

Why are the mkdir() and rmdir() POSIX system calls in different header files?

From Java

Why do some Linux system calls not have a wrapper, but are documented as if they do?

From Java

Why do some Linux system calls have two man pages?

From Dev

Concurrent system calls in Linux

From Dev

Linux:System calls for Who

From Linux

Is CPU affinity enforced across system calls?

From Dev

Persisting Data Across Shared Library Calls in Linux

From Dev

APT version conflicts across different architectures even with Multi-Arch: same?

From Dev

Linux System calls in C on OSX

From Dev

Linux bare system calls, not glibc

From Java

Why are the system call numbers different in amd64 linux?

From Dev

Programming on different ARM architectures

From Dev

Assembly Linux system calls vs assembly OS x system calls

From Java

Why do x86-64 Linux system calls modify RCX, and what does the value mean?

From Dev

Why do x86-64 Linux system calls work with 6 registers set?

From Java

Why is my "cat" function with system calls slower compared to Linux's "cat"?

From Dev

Why is parameter i preserved across calls to delegate function in lambda expression?

From Java

Linux system calls vs C lib functions

From Dev

How to Mock Linux System Calls in C

From Java

How many system calls are there in linux kernel 2.6?

From Dev

Can I use Linux system calls in android?

From Java

Are function calls like read() , write() actual system calls in linux?

From Dev

Why are rmdir and unlink two separate system calls?

From Java

Generate APK for different architectures - FFmpegMediaMetadataRetriever

From Dev

File operations in C on different architectures

From Dev

Behavior of getCString and withCString on different architectures

Related Related

  1. 1

    Are binaries portable across different CPU architectures?

  2. 2

    Why is pointer arithmetic inconsistent across architectures?

  3. 3

    Why do system calls use a different stack?

  4. 4

    Why are the mkdir() and rmdir() POSIX system calls in different header files?

  5. 5

    Why do some Linux system calls not have a wrapper, but are documented as if they do?

  6. 6

    Why do some Linux system calls have two man pages?

  7. 7

    Concurrent system calls in Linux

  8. 8

    Linux:System calls for Who

  9. 9

    Is CPU affinity enforced across system calls?

  10. 10

    Persisting Data Across Shared Library Calls in Linux

  11. 11

    APT version conflicts across different architectures even with Multi-Arch: same?

  12. 12

    Linux System calls in C on OSX

  13. 13

    Linux bare system calls, not glibc

  14. 14

    Why are the system call numbers different in amd64 linux?

  15. 15

    Programming on different ARM architectures

  16. 16

    Assembly Linux system calls vs assembly OS x system calls

  17. 17

    Why do x86-64 Linux system calls modify RCX, and what does the value mean?

  18. 18

    Why do x86-64 Linux system calls work with 6 registers set?

  19. 19

    Why is my "cat" function with system calls slower compared to Linux's "cat"?

  20. 20

    Why is parameter i preserved across calls to delegate function in lambda expression?

  21. 21

    Linux system calls vs C lib functions

  22. 22

    How to Mock Linux System Calls in C

  23. 23

    How many system calls are there in linux kernel 2.6?

  24. 24

    Can I use Linux system calls in android?

  25. 25

    Are function calls like read() , write() actual system calls in linux?

  26. 26

    Why are rmdir and unlink two separate system calls?

  27. 27

    Generate APK for different architectures - FFmpegMediaMetadataRetriever

  28. 28

    File operations in C on different architectures

  29. 29

    Behavior of getCString and withCString on different architectures

HotTag

Archive