# (Crazy) Idea: incrementally porting Linux std to syscalls

**URL:** <https://internals.rust-lang.org/t/crazy-idea-incrementally-porting-linux-std-to-syscalls/10404>\
**Category:** language design\
**Created:** [June 15, 2019, 5:21pm UTC](https://internals.rust-lang.org/t/crazy-idea-incrementally-porting-linux-std-to-syscalls/10404 "2019-06-15T17:21:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![newpavlov](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/newpavlov/32/3290_2.png) [@newpavlov](https://internals.rust-lang.org/u/newpavlov)\
**Post date:** [June 15, 2019, 5:21pm UTC](https://internals.rust-lang.org/t/crazy-idea-incrementally-porting-linux-std-to-syscalls/10404/1 "2019-06-15T17:21:18Z")

</div>

We have a proposal by @japaric to introduce a new Linux target which will use raw syscalls instead of relying on `libc`:

> <https://github.com/rust-lang/rfcs/issues/2610>

But I wonder if instead of introducing a new target we could migrate existing Linux targets to raw syscalls incrementally? Yes, motivation for it is probably a bit too weak, especially considering the existence of musl target. Apart from really tiny performance improvements and improved portability for some applications, we probably will not get much. And because of things like system allocator, unwinding, hostname lookup, `errno` and others, we will not be able to make `std` 100% `libc`-free in several years at least. But still I think it’s worth to discuss.

What do you think?

---

<div class="post-metadata">

**Author:** ![stepancheg](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/stepancheg/32/63_2.png) [@stepancheg](https://internals.rust-lang.org/u/stepancheg)\
**Post date:** [June 15, 2019, 11:09pm UTC](https://internals.rust-lang.org/t/crazy-idea-incrementally-porting-linux-std-to-syscalls/10404/2 "2019-06-15T23:09:13Z")

</div>

> [@newpavlov](#):
>
> really tiny performance improvements

Yeah, really tiny.

> [@newpavlov](#):
>
> improved portability

How portability is improved against musl?

---

<div class="post-metadata">

**Author:** ![josh](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/josh/32/5934_2.png) [@josh](https://internals.rust-lang.org/u/josh)\
**Post date:** [June 17, 2019, 1:50am UTC](https://internals.rust-lang.org/t/crazy-idea-incrementally-porting-linux-std-to-syscalls/10404/3 "2019-06-17T01:50:54Z")

</div>

I’d love to have a Linux target that doesn’t depend on libc at all. I’d absolutely use that for some use cases. However, that can’t be the only target, because full interoperability with C that _does_ call libc requires calling into libc. You already mentioned errno and malloc and hostname lookup; we’d also need to use native threads.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [September 15, 2019, 1:56am UTC](https://internals.rust-lang.org/t/crazy-idea-incrementally-porting-linux-std-to-syscalls/10404/4 "2019-09-15T01:56:28Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
