portability-wg icon indicating copy to clipboard operation
portability-wg copied to clipboard

std::sys_common::net assumes existence of libc

Open IsaacWoods opened this issue 6 years ago • 2 comments

As far as I understand, the sys_common module is meant to be common to all platforms. However, sys_common::net assumes existence of a LibC, specifically for some of its types:

use libc::{c_int, c_void};

In my case, I have redefined these types within my sys implementation and just use those instead, but I thought I'd get discussion started on whether, moving forward, we're going to continue assuming every platform should have to provide a LibC, and whether we could eliminate these particular use-cases at any point?

Just for context, my goal here is to provide a libstd implementation for my OS that doesn't depend on a LibC at all.

IsaacWoods avatar Apr 25 '18 17:04 IsaacWoods

we're going to continue assuming every platform should have to provide a LibC

Most definitely not.

The types you mention are actually part of the C ABI, not actual libc. They're also defined in std::os::raw. There has been significant discussion in the past about where these type definitions should live. I'm still in favor of a ctypes crate. See https://github.com/rust-lang-nursery/portability-wg/issues/13

jethrogb avatar Apr 25 '18 18:04 jethrogb

sys_common::net also has the problem of not really being "common" code like most other things in the sys_common module. Seems like the platform-specific bits should be in sys instead.

FenrirWolf avatar Apr 25 '18 18:04 FenrirWolf