-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix newlib #3345
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: main
Are you sure you want to change the base?
Fix newlib #3345
Changes from all commits
c1371d1
1279b4d
829242f
6090661
1aa247c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,71 @@ | ||
pub type blkcnt_t = i32; | ||
pub type blksize_t = i32; | ||
|
||
pub type clockid_t = ::c_ulong; | ||
|
||
cfg_if! { | ||
if #[cfg(target_os = "vita")] { | ||
pub type clockid_t = ::c_uint; | ||
if #[cfg(target_os = "horizon")] { | ||
pub type dev_t = u32; | ||
pub type off_t = i64; | ||
} else { | ||
pub type clockid_t = ::c_ulong; | ||
pub type dev_t = ::c_short; | ||
pub type off_t = ::c_long; | ||
} | ||
} | ||
|
||
cfg_if! { | ||
if #[cfg(any(target_os = "espidf"))] { | ||
if #[cfg(target_os = "horizon")] { | ||
pub type dev_t = u32; | ||
pub type off_t = i64; | ||
} else { | ||
pub type dev_t = ::c_short; | ||
pub type ino_t = ::c_ushort; | ||
pub type off_t = ::c_long; | ||
} else if #[cfg(any(target_os = "vita"))] { | ||
pub type dev_t = ::c_short; | ||
pub type ino_t = ::c_ushort; | ||
pub type off_t = ::c_int; | ||
} else { | ||
pub type dev_t = u32; | ||
} | ||
} | ||
|
||
cfg_if! { | ||
if #[cfg(target_os = "horizon")] { | ||
pub type ino_t = u32; | ||
pub type off_t = i64; | ||
} else if #[cfg(target_arch = "sparc")] { | ||
pub type ino_t = ::c_ulong; | ||
} else { | ||
pub type ino_t = ::c_ushort; | ||
} | ||
} | ||
|
||
pub type fsblkcnt_t = u64; | ||
pub type fsfilcnt_t = u32; | ||
pub type id_t = u32; | ||
pub type key_t = ::c_int; | ||
|
||
cfg_if! { | ||
if #[cfg(target_os = "horizon")] { | ||
pub type key_t = ::c_int; | ||
} else { | ||
pub type key_t = ::c_long; | ||
} | ||
} | ||
|
||
pub type loff_t = ::c_longlong; | ||
pub type mode_t = ::c_uint; | ||
pub type nfds_t = u32; | ||
|
||
cfg_if! { | ||
if #[cfg(target_os = "horizon")] { | ||
pub type mode_t = ::c_uint; | ||
pub type nfds_t = u32; | ||
} else { | ||
pub type mode_t = u32; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
DOS newlib isn't used or supported for rust by anyone, so i didn't that definition. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
pub type nfds_t = ::c_uint; | ||
} | ||
} | ||
|
||
pub type nlink_t = ::c_ushort; | ||
pub type pthread_t = ::c_ulong; | ||
|
||
cfg_if! { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if #[cfg(target_os = "horizon")] { | ||
pub type pthread_t = ::c_ulong; | ||
} else { | ||
pub type pthread_t = u32; | ||
} | ||
} | ||
pub type pthread_key_t = ::c_uint; | ||
pub type rlim_t = u32; | ||
|
||
|
@@ -93,16 +125,15 @@ s! { | |
} | ||
|
||
pub struct in_addr { | ||
pub s_addr: ::in_addr_t, | ||
pub s_addr: ::in_addr_t, | ||
} | ||
|
||
pub struct hostent { | ||
pub h_name: *mut ::c_char, | ||
pub h_aliases: *mut *mut ::c_char, | ||
pub h_addrtype: ::c_int, | ||
pub h_length: ::c_int, | ||
pub h_addr_list: *mut *mut ::c_char, | ||
pub h_addr: *mut ::c_char, | ||
pub h_name: *mut ::c_char, | ||
pub h_aliases: *mut *mut ::c_char, | ||
pub h_addrtype: ::c_int, | ||
pub h_length: ::c_int, | ||
pub h_addr_list: *mut *mut ::c_char, | ||
} | ||
|
||
pub struct pollfd { | ||
|
@@ -232,14 +263,6 @@ s! { | |
pub struct cpu_set_t { // Unverified | ||
bits: [u32; 32], | ||
} | ||
|
||
pub struct pthread_attr_t { // Unverified | ||
__size: [u8; __SIZEOF_PTHREAD_ATTR_T] | ||
} | ||
|
||
pub struct pthread_rwlockattr_t { // Unverified | ||
__size: [u8; __SIZEOF_PTHREAD_RWLOCKATTR_T] | ||
} | ||
} | ||
|
||
// unverified constants | ||
|
@@ -546,8 +569,8 @@ pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit | |
pub const IFF_ALTPHYS: ::c_int = IFF_LINK2; // use alternate physical connection | ||
pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast | ||
|
||
pub const TCP_NODELAY: ::c_int = 8193; | ||
pub const TCP_MAXSEG: ::c_int = 8194; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These definitions must be included via a |
||
pub const TCP_NODELAY: ::c_int = 1; | ||
zetanumbers marked this conversation as resolved.
Show resolved
Hide resolved
|
||
pub const TCP_MAXSEG: ::c_int = 2; | ||
pub const TCP_NOPUSH: ::c_int = 4; | ||
pub const TCP_NOOPT: ::c_int = 8; | ||
pub const TCP_KEEPIDLE: ::c_int = 256; | ||
|
@@ -557,16 +580,21 @@ pub const TCP_KEEPCNT: ::c_int = 1024; | |
cfg_if! { | ||
if #[cfg(target_os = "horizon")] { | ||
pub const IP_TOS: ::c_int = 7; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All of these have wrong values for ESP-IDF, but I must say this is not due to this PR. It was also wrong before, and needs fixing: |
||
pub const IP_TTL: ::c_int = 8; | ||
pub const IP_MULTICAST_LOOP: ::c_int = 9; | ||
pub const IP_MULTICAST_TTL: ::c_int = 10; | ||
pub const IP_ADD_MEMBERSHIP: ::c_int = 11; | ||
pub const IP_DROP_MEMBERSHIP: ::c_int = 12; | ||
} else { | ||
pub const IP_TOS: ::c_int = 3; | ||
pub const IP_TTL: ::c_int = 4; | ||
pub const IP_MULTICAST_IF: ::c_int = 9; | ||
pub const IP_MULTICAST_TTL: ::c_int = 10; | ||
pub const IP_MULTICAST_LOOP: ::c_int = 11; | ||
pub const IP_ADD_MEMBERSHIP: ::c_int = 12; | ||
pub const IP_DROP_MEMBERSHIP: ::c_int = 13; | ||
} | ||
} | ||
pub const IP_TTL: ::c_int = 8; | ||
pub const IP_MULTICAST_IF: ::c_int = 9; | ||
pub const IP_MULTICAST_TTL: ::c_int = 10; | ||
pub const IP_MULTICAST_LOOP: ::c_int = 11; | ||
pub const IP_ADD_MEMBERSHIP: ::c_int = 11; | ||
pub const IP_DROP_MEMBERSHIP: ::c_int = 12; | ||
|
||
pub const IPV6_UNICAST_HOPS: ::c_int = 4; | ||
pub const IPV6_MULTICAST_IF: ::c_int = 9; | ||
|
@@ -598,10 +626,18 @@ pub const NI_NAMEREQD: ::c_int = 4; | |
pub const NI_NUMERICSERV: ::c_int = 0; | ||
pub const NI_DGRAM: ::c_int = 0; | ||
|
||
pub const EAI_FAMILY: ::c_int = -303; | ||
pub const EAI_MEMORY: ::c_int = -304; | ||
pub const EAI_NONAME: ::c_int = -305; | ||
pub const EAI_SOCKTYPE: ::c_int = -307; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These definitions must be included via a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. This was from past commit, so i haven't yet tried to preserve these mixed |
||
pub const EAI_AGAIN: ::c_int = 2; | ||
zetanumbers marked this conversation as resolved.
Show resolved
Hide resolved
|
||
pub const EAI_BADFLAGS: ::c_int = 3; | ||
pub const EAI_FAIL: ::c_int = 4; | ||
pub const EAI_FAMILY: ::c_int = 5; | ||
pub const EAI_MEMORY: ::c_int = 6; | ||
pub const EAI_NONAME: ::c_int = 8; | ||
pub const EAI_SERVICE: ::c_int = 9; | ||
pub const EAI_SOCKTYPE: ::c_int = 10; | ||
pub const EAI_SYSTEM: ::c_int = 11; | ||
pub const EAI_BADHINTS: ::c_int = 12; | ||
pub const EAI_PROTOCOL: ::c_int = 13; | ||
pub const EAI_OVERFLOW: ::c_int = 14; | ||
|
||
pub const EXIT_SUCCESS: ::c_int = 0; | ||
pub const EXIT_FAILURE: ::c_int = 1; | ||
|
Uh oh!
There was an error while loading. Please reload this page.