| 1 |
#include <sys/utsname.h> |
| 2 |
#ifdef __wasilibc_unmodified_upstream // Implement uname with placeholders |
| 3 |
#include "syscall.h" |
| 4 |
#else |
| 5 |
#include <string.h> |
| 6 |
#endif |
| 7 |
|
| 8 |
int uname(struct utsname *uts) |
| 9 |
{ |
| 10 |
#ifdef __wasilibc_unmodified_upstream // Implement uname with placeholders |
| 11 |
return syscall(SYS_uname, uts); |
| 12 |
#else |
| 13 |
// Just fill in the fields with placeholder values. |
| 14 |
strcpy(uts->sysname, "wasi"); |
| 15 |
strcpy(uts->nodename, "(none)"); |
| 16 |
strcpy(uts->release, "0.0.0"); |
| 17 |
strcpy(uts->version, "0.0.0"); |
| 18 |
#if defined(__wasm32__) |
| 19 |
strcpy(uts->machine, "wasm32"); |
| 20 |
#elif defined(__wasm64__) |
| 21 |
strcpy(uts->machine, "wasm64"); |
| 22 |
#else |
| 23 |
strcpy(uts->machine, "unknown"); |
| 24 |
#endif |
| 25 |
#ifdef _GNU_SOURCE |
| 26 |
strcpy(uts->domainname, "(none)"); |
| 27 |
#else |
| 28 |
strcpy(uts->__domainname, "(none)"); |
| 29 |
#endif |
| 30 |
return 0; |
| 31 |
#endif |
| 32 |
} |