471
471
__pgrp: :: pid_t,
472
472
__sd: :: sigset_t,
473
473
__ss: :: sigset_t,
474
- #[ cfg( target_env = "musl" ) ]
474
+ #[ cfg( any ( target_env = "musl" , target_env = "ohos" ) ) ]
475
475
__prio: :: c_int,
476
- #[ cfg( not( target_env = "musl" ) ) ]
476
+ #[ cfg( not( any ( target_env = "musl" , target_env = "ohos" ) ) ) ]
477
477
__sp: :: sched_param,
478
478
__policy: :: c_int,
479
479
__pad: [ :: c_int; 16 ] ,
@@ -1225,7 +1225,7 @@ cfg_if! {
1225
1225
}
1226
1226
1227
1227
cfg_if ! {
1228
- if #[ cfg( any( target_env = "gnu" , target_env = "musl" ) ) ] {
1228
+ if #[ cfg( any( target_env = "gnu" , target_env = "musl" , target_env = "ohos" ) ) ] {
1229
1229
pub const ABDAY_1 : :: nl_item = 0x20000 ;
1230
1230
pub const ABDAY_2 : :: nl_item = 0x20001 ;
1231
1231
pub const ABDAY_3 : :: nl_item = 0x20002 ;
@@ -3970,7 +3970,7 @@ safe_f! {
3970
3970
}
3971
3971
3972
3972
cfg_if ! {
3973
- if #[ cfg( not( target_env = "uclibc" ) ) ] {
3973
+ if #[ cfg( all ( not( target_env = "uclibc" ) , not ( target_env = "ohos" ) ) ) ] {
3974
3974
extern "C" {
3975
3975
pub fn aio_read( aiocbp: * mut aiocb) -> :: c_int;
3976
3976
pub fn aio_write( aiocbp: * mut aiocb) -> :: c_int;
@@ -3989,6 +3989,13 @@ cfg_if! {
3989
3989
nitems: :: c_int,
3990
3990
sevp: * mut :: sigevent,
3991
3991
) -> :: c_int;
3992
+ }
3993
+ }
3994
+ }
3995
+
3996
+ cfg_if ! {
3997
+ if #[ cfg( not( target_env = "uclibc" ) ) ] {
3998
+ extern "C" {
3992
3999
pub fn pwritev(
3993
4000
fd: :: c_int,
3994
4001
iov: * const :: iovec,
@@ -4038,8 +4045,79 @@ cfg_if! {
4038
4045
}
4039
4046
}
4040
4047
4048
+ // These functions are not available on OpenHarmony
4049
+ cfg_if ! {
4050
+ if #[ cfg( not( target_env = "ohos" ) ) ] {
4051
+ extern "C" {
4052
+ // Only `getspnam_r` is implemented for musl, out of all of the reenterant
4053
+ // functions from `shadow.h`.
4054
+ // https://git.musl-libc.org/cgit/musl/tree/include/shadow.h
4055
+ pub fn getspnam_r(
4056
+ name: * const :: c_char,
4057
+ spbuf: * mut spwd,
4058
+ buf: * mut :: c_char,
4059
+ buflen: :: size_t,
4060
+ spbufp: * mut * mut spwd,
4061
+ ) -> :: c_int;
4062
+
4063
+ pub fn shm_open( name: * const c_char, oflag: :: c_int, mode: mode_t) -> :: c_int;
4064
+ pub fn shm_unlink( name: * const :: c_char) -> :: c_int;
4065
+
4066
+ pub fn mq_open( name: * const :: c_char, oflag: :: c_int, ...) -> :: mqd_t;
4067
+ pub fn mq_close( mqd: :: mqd_t) -> :: c_int;
4068
+ pub fn mq_unlink( name: * const :: c_char) -> :: c_int;
4069
+ pub fn mq_receive(
4070
+ mqd: :: mqd_t,
4071
+ msg_ptr: * mut :: c_char,
4072
+ msg_len: :: size_t,
4073
+ msg_prio: * mut :: c_uint,
4074
+ ) -> :: ssize_t;
4075
+ pub fn mq_timedreceive(
4076
+ mqd: :: mqd_t,
4077
+ msg_ptr: * mut :: c_char,
4078
+ msg_len: :: size_t,
4079
+ msg_prio: * mut :: c_uint,
4080
+ abs_timeout: * const :: timespec,
4081
+ ) -> :: ssize_t;
4082
+ pub fn mq_send(
4083
+ mqd: :: mqd_t,
4084
+ msg_ptr: * const :: c_char,
4085
+ msg_len: :: size_t,
4086
+ msg_prio: :: c_uint,
4087
+ ) -> :: c_int;
4088
+ pub fn mq_timedsend(
4089
+ mqd: :: mqd_t,
4090
+ msg_ptr: * const :: c_char,
4091
+ msg_len: :: size_t,
4092
+ msg_prio: :: c_uint,
4093
+ abs_timeout: * const :: timespec,
4094
+ ) -> :: c_int;
4095
+ pub fn mq_getattr( mqd: :: mqd_t, attr: * mut :: mq_attr) -> :: c_int;
4096
+ pub fn mq_setattr(
4097
+ mqd: :: mqd_t,
4098
+ newattr: * const :: mq_attr,
4099
+ oldattr: * mut :: mq_attr
4100
+ ) -> :: c_int;
4101
+
4102
+ pub fn pthread_mutex_consistent( mutex: * mut pthread_mutex_t) -> :: c_int;
4103
+ pub fn pthread_cancel( thread: :: pthread_t) -> :: c_int;
4104
+ pub fn pthread_mutexattr_getrobust(
4105
+ attr: * const pthread_mutexattr_t,
4106
+ robustness: * mut :: c_int,
4107
+ ) -> :: c_int;
4108
+ pub fn pthread_mutexattr_setrobust(
4109
+ attr: * mut pthread_mutexattr_t,
4110
+ robustness: :: c_int,
4111
+ ) -> :: c_int;
4112
+ }
4113
+ }
4114
+ }
4115
+
4041
4116
extern "C" {
4042
- #[ cfg_attr( not( target_env = "musl" ) , link_name = "__xpg_strerror_r" ) ]
4117
+ #[ cfg_attr(
4118
+ not( any( target_env = "musl" , target_env = "ohos" ) ) ,
4119
+ link_name = "__xpg_strerror_r"
4120
+ ) ]
4043
4121
pub fn strerror_r ( errnum : :: c_int , buf : * mut c_char , buflen : :: size_t ) -> :: c_int ;
4044
4122
4045
4123
pub fn abs ( i : :: c_int ) -> :: c_int ;
@@ -4070,18 +4148,6 @@ extern "C" {
4070
4148
pub fn getspent ( ) -> * mut spwd ;
4071
4149
4072
4150
pub fn getspnam ( name : * const :: c_char ) -> * mut spwd ;
4073
- // Only `getspnam_r` is implemented for musl, out of all of the reenterant
4074
- // functions from `shadow.h`.
4075
- // https://git.musl-libc.org/cgit/musl/tree/include/shadow.h
4076
- pub fn getspnam_r (
4077
- name : * const :: c_char ,
4078
- spbuf : * mut spwd ,
4079
- buf : * mut :: c_char ,
4080
- buflen : :: size_t ,
4081
- spbufp : * mut * mut spwd ,
4082
- ) -> :: c_int ;
4083
-
4084
- pub fn shm_open ( name : * const c_char , oflag : :: c_int , mode : mode_t ) -> :: c_int ;
4085
4151
4086
4152
// System V IPC
4087
4153
pub fn shmget ( key : :: key_t , size : :: size_t , shmflg : :: c_int ) -> :: c_int ;
@@ -4187,37 +4253,6 @@ extern "C" {
4187
4253
id : :: c_int ,
4188
4254
data : * mut :: c_char ,
4189
4255
) -> :: c_int ;
4190
- pub fn mq_open ( name : * const :: c_char , oflag : :: c_int , ...) -> :: mqd_t ;
4191
- pub fn mq_close ( mqd : :: mqd_t ) -> :: c_int ;
4192
- pub fn mq_unlink ( name : * const :: c_char ) -> :: c_int ;
4193
- pub fn mq_receive (
4194
- mqd : :: mqd_t ,
4195
- msg_ptr : * mut :: c_char ,
4196
- msg_len : :: size_t ,
4197
- msg_prio : * mut :: c_uint ,
4198
- ) -> :: ssize_t ;
4199
- pub fn mq_timedreceive (
4200
- mqd : :: mqd_t ,
4201
- msg_ptr : * mut :: c_char ,
4202
- msg_len : :: size_t ,
4203
- msg_prio : * mut :: c_uint ,
4204
- abs_timeout : * const :: timespec ,
4205
- ) -> :: ssize_t ;
4206
- pub fn mq_send (
4207
- mqd : :: mqd_t ,
4208
- msg_ptr : * const :: c_char ,
4209
- msg_len : :: size_t ,
4210
- msg_prio : :: c_uint ,
4211
- ) -> :: c_int ;
4212
- pub fn mq_timedsend (
4213
- mqd : :: mqd_t ,
4214
- msg_ptr : * const :: c_char ,
4215
- msg_len : :: size_t ,
4216
- msg_prio : :: c_uint ,
4217
- abs_timeout : * const :: timespec ,
4218
- ) -> :: c_int ;
4219
- pub fn mq_getattr ( mqd : :: mqd_t , attr : * mut :: mq_attr ) -> :: c_int ;
4220
- pub fn mq_setattr ( mqd : :: mqd_t , newattr : * const :: mq_attr , oldattr : * mut :: mq_attr ) -> :: c_int ;
4221
4256
pub fn epoll_pwait (
4222
4257
epfd : :: c_int ,
4223
4258
events : * mut :: epoll_event ,
@@ -4284,8 +4319,6 @@ extern "C" {
4284
4319
4285
4320
pub fn posix_madvise ( addr : * mut :: c_void , len : :: size_t , advice : :: c_int ) -> :: c_int ;
4286
4321
4287
- pub fn shm_unlink ( name : * const :: c_char ) -> :: c_int ;
4288
-
4289
4322
pub fn seekdir ( dirp : * mut :: DIR , loc : :: c_long ) ;
4290
4323
4291
4324
pub fn telldir ( dirp : * mut :: DIR ) -> :: c_long ;
@@ -4389,7 +4422,7 @@ extern "C" {
4389
4422
attr : * mut pthread_mutexattr_t ,
4390
4423
protocol : :: c_int ,
4391
4424
) -> :: c_int ;
4392
- pub fn pthread_mutex_consistent ( mutex : * mut pthread_mutex_t ) -> :: c_int ;
4425
+
4393
4426
pub fn pthread_mutex_timedlock (
4394
4427
lock : * mut pthread_mutex_t ,
4395
4428
abstime : * const :: timespec ,
@@ -4487,7 +4520,6 @@ extern "C" {
4487
4520
pub fn pthread_sigmask ( how : :: c_int , set : * const sigset_t , oldset : * mut sigset_t ) -> :: c_int ;
4488
4521
pub fn sem_open ( name : * const :: c_char , oflag : :: c_int , ...) -> * mut sem_t ;
4489
4522
pub fn getgrnam ( name : * const :: c_char ) -> * mut :: group ;
4490
- pub fn pthread_cancel ( thread : :: pthread_t ) -> :: c_int ;
4491
4523
pub fn pthread_kill ( thread : :: pthread_t , sig : :: c_int ) -> :: c_int ;
4492
4524
pub fn sem_unlink ( name : * const :: c_char ) -> :: c_int ;
4493
4525
pub fn daemon ( nochdir : :: c_int , noclose : :: c_int ) -> :: c_int ;
@@ -4522,14 +4554,6 @@ extern "C" {
4522
4554
attr : * const pthread_mutexattr_t ,
4523
4555
pshared : * mut :: c_int ,
4524
4556
) -> :: c_int ;
4525
- pub fn pthread_mutexattr_getrobust (
4526
- attr : * const pthread_mutexattr_t ,
4527
- robustness : * mut :: c_int ,
4528
- ) -> :: c_int ;
4529
- pub fn pthread_mutexattr_setrobust (
4530
- attr : * mut pthread_mutexattr_t ,
4531
- robustness : :: c_int ,
4532
- ) -> :: c_int ;
4533
4557
pub fn popen ( command : * const c_char , mode : * const c_char ) -> * mut :: FILE ;
4534
4558
pub fn faccessat (
4535
4559
dirfd : :: c_int ,
@@ -4729,7 +4753,7 @@ cfg_if! {
4729
4753
if #[ cfg( target_env = "uclibc" ) ] {
4730
4754
mod uclibc;
4731
4755
pub use self :: uclibc:: * ;
4732
- } else if #[ cfg( target_env = "musl" ) ] {
4756
+ } else if #[ cfg( any ( target_env = "musl" , target_env = "ohos" ) ) ] {
4733
4757
mod musl;
4734
4758
pub use self :: musl:: * ;
4735
4759
} else if #[ cfg( target_env = "gnu" ) ] {
0 commit comments