Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
felixmoebius
libc
Commits
49f7b415
Unverified
Commit
49f7b415
authored
5 years ago
by
n-salim
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #15 from Wind-River/union
use union for unions
parents
78a16cba
d751f237
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/vxworks/mod.rs
+64
-6
64 additions, 6 deletions
src/vxworks/mod.rs
with
64 additions
and
6 deletions
src/vxworks/mod.rs
+
64
−
6
View file @
49f7b415
...
...
@@ -252,8 +252,9 @@ s! {
}
// signal.h
pub
struct
sigaction
{
pub
sa_u
:
::
s
ize_t
,
// actually union of two function pointers
pub
sa_u
:
::
s
a_u_t
,
pub
sa_mask
:
::
sigset_t
,
pub
sa_flags
:
::
c_int
,
}
...
...
@@ -269,7 +270,7 @@ s! {
pub
struct
siginfo_t
{
pub
si_signo
:
::
c_int
,
pub
si_code
:
::
c_int
,
pub
si_value
:
::
si
ze_t
,
// actually union of int and void *
pub
si_value
:
::
si
gval
,
pub
si_errno
:
::
c_int
,
pub
si_status
:
::
c_int
,
pub
si_addr
:
*
mut
::
c_void
,
...
...
@@ -414,6 +415,16 @@ s_no_extra_traits! {
pub
__ss_pad2
:
[::
c_char
;
_SS_PAD2SIZE
],
}
pub
union
sa_u_t
{
pub
sa_handler
:
extern
"C"
fn
(::
c_int
)
->
!
,
pub
sa_sigaction
:
extern
"C"
fn
(::
c_int
,
*
mut
::
siginfo_t
,
*
mut
::
c_void
)
->
!
,
}
pub
union
sigval
{
pub
sival_int
:
::
c_int
,
pub
sival_ptr
:
*
mut
::
c_void
,
}
}
cfg_if!
{
...
...
@@ -463,6 +474,46 @@ cfg_if! {
.finish
()
}
}
impl
PartialEq
for
sa_u_t
{
fn
eq
(
&
self
,
other
:
&
sa_u_t
)
->
bool
{
unsafe
{
self
.sa_handler
==
other
.sa_handler
}
}
}
impl
Eq
for
sa_u_t
{}
impl
::
fmt
::
Debug
for
sa_u_t
{
fn
fmt
(
&
self
,
f
:
&
mut
::
fmt
::
Formatter
)
->
::
fmt
::
Result
{
f
.debug_struct
(
"sa_u_t"
)
.field
(
"sa_handler"
,
unsafe
{
&
self
.sa_handler
})
.field
(
"sa_sigaction"
,
unsafe
{
&
self
.sa_sigaction
})
.finish
()
}
}
impl
::
hash
::
Hash
for
sa_u_t
{
fn
hash
<
H
:
::
hash
::
Hasher
>
(
&
self
,
state
:
&
mut
H
)
{
unsafe
{
self
.sa_handler
.hash
(
state
)
};
}
}
impl
PartialEq
for
sigval
{
fn
eq
(
&
self
,
other
:
&
sigval
)
->
bool
{
unsafe
{
self
.sival_ptr
==
other
.sival_ptr
}
}
}
impl
Eq
for
sigval
{}
impl
::
fmt
::
Debug
for
sigval
{
fn
fmt
(
&
self
,
f
:
&
mut
::
fmt
::
Formatter
)
->
::
fmt
::
Result
{
f
.debug_struct
(
"sigval"
)
.field
(
"sival_int"
,
unsafe
{
&
self
.sival_int
})
.field
(
"sival_ptr"
,
unsafe
{
&
self
.sival_ptr
})
.finish
()
}
}
impl
::
hash
::
Hash
for
sigval
{
fn
hash
<
H
:
::
hash
::
Hasher
>
(
&
self
,
state
:
&
mut
H
)
{
unsafe
{
self
.sival_ptr
.hash
(
state
)
};
}
}
}
}
...
...
@@ -1976,16 +2027,14 @@ extern "C" {
pub
fn
sigqueue
(
__pid
:
pid_t
,
__signo
:
::
c_int
,
__value
:
::
size_t
,
// Actual type is const union sigval value,
// which is a union of int and void *
__value
:
::
sigval
,
)
->
::
c_int
;
// signal.h for user
pub
fn
_sigqueue
(
rtpId
:
::
RTP_ID
,
signo
:
::
c_int
,
pValue
:
*
mut
::
size_t
,
// Actual type is const union * sigval value,
// which is a union of int and void *
pValue
:
*
const
::
sigval
,
sigCode
:
::
c_int
,
)
->
::
c_int
;
...
...
@@ -2001,6 +2050,15 @@ extern "C" {
// rtpLibCommon.h
pub
fn
rtpInfoGet
(
rtpId
:
::
RTP_ID
,
rtpStruct
:
*
mut
::
RTP_DESC
)
->
::
c_int
;
pub
fn
rtpSpawn
(
pubrtpFileName
:
*
const
::
c_char
,
argv
:
*
const
*
const
::
c_char
,
envp
:
*
const
*
const
::
c_char
,
priority
:
::
c_int
,
uStackSize
:
::
size_t
,
options
:
::
c_int
,
taskOptions
:
::
c_int
,
)
->
RTP_ID
;
// ioLib.h
pub
fn
_realpath
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment