Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WIP fixes (may not work)
  • Loading branch information
zetanumbers committed Jan 4, 2024
commit 609066120e1f0d851f21c615d00e45077b720ce3
13 changes: 12 additions & 1 deletion src/unix/newlib/align.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ macro_rules! expand_align {
size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T],
}

#[repr(align(8))]
#[cfg_attr(not(target_os = "vita"), repr(align(8)))]
#[cfg_attr(target_os = "vita", repr(align(4)))]
pub struct pthread_cond_t { // Unverified
size: [u8; ::__SIZEOF_PTHREAD_COND_T],
}
Expand All @@ -56,6 +57,16 @@ macro_rules! expand_align {
pub struct pthread_condattr_t { // Unverified
size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T],
}

#[cfg_attr(target_os = "vita", repr(align(4)))]
pub struct pthread_attr_t { // Unverified
size: [u8; ::__SIZEOF_PTHREAD_ATTR_T]
}

#[cfg_attr(target_os = "vita", repr(align(4)))]
pub struct pthread_rwlockattr_t { // Unverified
size: [u8; ::__SIZEOF_PTHREAD_RWLOCKATTR_T]
}
}
};
}
18 changes: 2 additions & 16 deletions src/unix/newlib/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
pub type blkcnt_t = i32;
pub type blksize_t = i32;

cfg_if! {
if #[cfg(target_os = "vita")] {
pub type clockid_t = ::c_uint;
} else {
pub type clockid_t = ::c_ulong;
}
}
pub type clockid_t = ::c_ulong;

cfg_if! {
if #[cfg(target_os = "horizon")] {
Expand Down Expand Up @@ -130,7 +124,7 @@ s! {
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_addr: *mut ::c_char,
}

pub struct pollfd {
Expand Down Expand Up @@ -260,14 +254,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
Expand Down
15 changes: 15 additions & 0 deletions src/unix/newlib/no_align.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ macro_rules! expand_align {
}

pub struct pthread_cond_t { // Unverified
#[cfg(target_os = "vita")]
__align: [::c_long; 0];
#[cfg(not(target_os = "vita"))]
__align: [::c_longlong; 0],
size: [u8; ::__SIZEOF_PTHREAD_COND_T],
}
Expand All @@ -46,6 +49,18 @@ macro_rules! expand_align {
__align: [::c_int; 0],
size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T],
}

pub struct pthread_attr_t { // Unverified
#[cfg(target_os = "vita")]
__align: [::c_long; 0],
size: [u8; ::__SIZEOF_PTHREAD_ATTR_T]
}

pub struct pthread_rwlockattr_t { // Unverified
#[cfg(target_os = "vita")]
__align: [::c_long; 0],
size: [u8; ::__SIZEOF_PTHREAD_RWLOCKATTR_T]
}
}
};
}