enarx-archive / cipherpipe

Cipherpipe is a wrapper around libc to add the IPPROTO_TLS socket protocol.
Apache License 2.0
1 stars 4 forks source link

Mark all C functions as extern "C" #1

Closed npmccallum closed 5 years ago

npmccallum commented 5 years ago

I missed this in my first pass. All the C functions that we override or export need to be marked as extern "C". For example:

#[no_mangle]
pub fn accept(fd: c_int, addr: *mut libc::sockaddr, addr_len: *mut libc::socklen_t) -> c_int {
    accept4(fd, addr, addr_len, 0)
}

Needs to become:

#[no_mangle]
pub extern "C" fn accept(fd: c_int, addr: *mut libc::sockaddr, addr_len: *mut libc::socklen_t) -> c_int {
    accept4(fd, addr, addr_len, 0)
}
DK-DARKmatter commented 5 years ago

Do we need to reorganize the function declaration since we have a format width limitation?

frozencemetery commented 5 years ago

That would be nice, yes. Ideally rustfmt gets run in CI, but there's no CI on this project yet.