split out sa_family_t to a bits header
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
# POSIX header spec: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_socket.h.html
|
||||
#
|
||||
# The sys/socket header should define this type.
|
||||
# It is split out to avoid other headers from including all of sys/socket.
|
||||
#
|
||||
# POSIX headers that require sa_family_t:
|
||||
# - netinet/in.h
|
||||
# - sys/socket.h
|
||||
# - sys/un.h
|
||||
sys_includes = []
|
||||
include_guard = "_RELIBC_BITS_SA_FAMILY_T_H"
|
||||
language = "C"
|
||||
style = "type"
|
||||
no_includes = true
|
||||
cpp_compat = true
|
||||
|
||||
[export]
|
||||
include = ["sa_family_t"]
|
||||
|
||||
[enum]
|
||||
prefix_with_name = true
|
||||
@@ -0,0 +1 @@
|
||||
pub type sa_family_t = u16;
|
||||
@@ -9,6 +9,8 @@ pub mod bits_iovec;
|
||||
#[path = "bits_locale-t/mod.rs"]
|
||||
pub mod bits_locale_t;
|
||||
pub mod bits_pthread;
|
||||
#[path = "bits_safamily-t/mod.rs"]
|
||||
pub mod bits_safamily_t;
|
||||
#[path = "bits_socklen-t/mod.rs"]
|
||||
pub mod bits_socklen_t;
|
||||
pub mod bits_timespec;
|
||||
|
||||
@@ -14,13 +14,14 @@ use crate::{
|
||||
header::{
|
||||
arpa_inet::inet_aton,
|
||||
bits_arpainet::{htons, ntohl},
|
||||
bits_safamily_t::sa_family_t,
|
||||
bits_socklen_t::socklen_t,
|
||||
errno::*,
|
||||
fcntl::O_RDONLY,
|
||||
netinet_in::{in_addr, sockaddr_in, sockaddr_in6},
|
||||
stdlib::atoi,
|
||||
strings::strcasecmp,
|
||||
sys_socket::{constants::AF_INET, sa_family_t, sockaddr},
|
||||
sys_socket::{constants::AF_INET, sockaddr},
|
||||
unistd::SEEK_SET,
|
||||
},
|
||||
platform::{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
use crate::{
|
||||
header::sys_socket::{sa_family_t, sockaddr_storage},
|
||||
header::{bits_safamily_t::sa_family_t, sys_socket::sockaddr_storage},
|
||||
platform::types::{c_char, c_int},
|
||||
};
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ sys_includes = ["stddef.h", "stdint.h", "sys/types.h"]
|
||||
include_guard = "_RELIBC_SYS_SOCKET_H"
|
||||
after_includes = """
|
||||
#include <bits/iovec.h> // for iovec from sys/uio.h
|
||||
#include <bits/safamily-t.h> // for sa_family_t
|
||||
#include <bits/socklen-t.h> // for socklen_t
|
||||
"""
|
||||
trailer = """
|
||||
|
||||
@@ -6,7 +6,7 @@ use core::{mem, ptr};
|
||||
|
||||
use crate::{
|
||||
error::ResultExt,
|
||||
header::{bits_iovec::iovec, bits_socklen_t::socklen_t},
|
||||
header::{bits_iovec::iovec, bits_safamily_t::sa_family_t, bits_socklen_t::socklen_t},
|
||||
platform::{
|
||||
PalSocket, Sys,
|
||||
types::{
|
||||
@@ -17,8 +17,6 @@ use crate::{
|
||||
|
||||
pub mod constants;
|
||||
|
||||
pub type sa_family_t = u16;
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_socket.h.html>.
|
||||
#[repr(C)]
|
||||
#[derive(Default, CheckVsLibcCrate)]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//!
|
||||
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_un.h.html>.
|
||||
|
||||
use crate::{header::sys_socket::sa_family_t, platform::types::c_char};
|
||||
use crate::{header::bits_safamily_t::sa_family_t, platform::types::c_char};
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_un.h.html>.
|
||||
#[repr(C)]
|
||||
|
||||
Reference in New Issue
Block a user