RustForge

foundry

Foundry OS: the operating system built on the Rustbelt kernel

foundry / c / hello-musl.c
504 bytes ยท raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* The first Foundry OS C program (milestone M2): plain C against musl.
 * Build:  toolchain/foundry-cc -O2 c/hello-musl.c -o out/hello-musl  (after `make musl`)
 * (Rustbelt 0.19.0 loads static-PIE programs, so no special link flags.) */
#include <stdio.h>
#include <sys/utsname.h>

int main(void) {
    struct utsname u;
    if (uname(&u) == 0)
        printf("hello from musl on Foundry OS (%s %s)\n", u.sysname, u.release);
    else
        printf("hello from musl on Foundry OS\n");
    return 0;
}