lx 0.4.0

A no_std crate to use Linux system calls
Documentation
use super::abi::*;
use crate::{
    result_from_value,
    OwnedFd,
};

pub const SOCK_STREAM: i32 = 0x1;
pub const SOCK_DGRAM: i32 = 0x2;
pub const SOCK_RAW: i32 = 0x3;
pub const SOCK_RDM: i32 = 0x4;
pub const SOCK_SEQPACKET: i32 = 0x5;
pub const SOCK_DCCP: i32 = 0x6;
pub const SOCK_PACKET: i32 = 0xA;
pub const SOCK_NONBLOCK: i32 = 0x800;
pub const SOCK_CLOEXEC: i32 = 0x80000;

#[inline]
pub fn socket(family: i32, sock_type: i32, protocol: i32) -> crate::Result<OwnedFd> {
    let ret =
        unsafe { syscall_3(41, family as usize, sock_type as usize, protocol as usize) as i32 };
    result_from_value(ret).map(OwnedFd::new)
}