Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Musl
提交
3b885564
T
Third Party Musl
项目概览
OpenHarmony
/
Third Party Musl
8 个月 前同步成功
通知
37
Star
125
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Musl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
3b885564
编写于
8月 27, 2021
作者:
O
openharmony_ci
提交者:
Gitee
8月 27, 2021
浏览文件
操作
浏览文件
下载
差异文件
!97 支持sys模块api接口:ftok、nice、getlogin、getgrgid、getgrnam等
Merge pull request !97 from wangjianjun/sys
上级
e0f847e3
d3d2eedd
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
0 addition
and
232 deletion
+0
-232
porting/liteos_a/user/src/ipc/ftok.c
porting/liteos_a/user/src/ipc/ftok.c
+0
-12
porting/liteos_a/user/src/passwd/getgr_r.c
porting/liteos_a/user/src/passwd/getgr_r.c
+0
-51
porting/liteos_a/user/src/passwd/getgrent.c
porting/liteos_a/user/src/passwd/getgrent.c
+0
-43
porting/liteos_a/user/src/passwd/getpw_r.c
porting/liteos_a/user/src/passwd/getpw_r.c
+0
-44
porting/liteos_a/user/src/passwd/getpwent.c
porting/liteos_a/user/src/passwd/getpwent.c
+0
-41
porting/liteos_a/user/src/unistd/getlogin.c
porting/liteos_a/user/src/unistd/getlogin.c
+0
-9
porting/liteos_a/user/src/unistd/getlogin_r.c
porting/liteos_a/user/src/unistd/getlogin_r.c
+0
-14
porting/liteos_a/user/src/unistd/nice.c
porting/liteos_a/user/src/unistd/nice.c
+0
-18
未找到文件。
porting/liteos_a/user/src/ipc/ftok.c
已删除
100644 → 0
浏览文件 @
e0f847e3
#include <sys/ipc.h>
#include <sys/stat.h>
#include <unsupported_api.h>
key_t
ftok
(
const
char
*
path
,
int
id
)
{
struct
stat
st
;
unsupported_api
(
__FUNCTION__
);
if
(
stat
(
path
,
&
st
)
<
0
)
return
-
1
;
return
((
st
.
st_ino
&
0xffff
)
|
((
st
.
st_dev
&
0xff
)
<<
16
)
|
((
id
&
0xffu
)
<<
24
));
}
porting/liteos_a/user/src/passwd/getgr_r.c
已删除
100644 → 0
浏览文件 @
e0f847e3
#include "pwf.h"
#include <pthread.h>
#include <unsupported_api.h>
#define FIX(x) (gr->gr_##x = gr->gr_##x-line+buf)
static
int
getgr_r
(
const
char
*
name
,
gid_t
gid
,
struct
group
*
gr
,
char
*
buf
,
size_t
size
,
struct
group
**
res
)
{
char
*
line
=
0
;
size_t
len
=
0
;
char
**
mem
=
0
;
size_t
nmem
=
0
;
int
rv
=
0
;
size_t
i
;
int
cs
;
pthread_setcancelstate
(
PTHREAD_CANCEL_DISABLE
,
&
cs
);
rv
=
__getgr_a
(
name
,
gid
,
gr
,
&
line
,
&
len
,
&
mem
,
&
nmem
,
res
);
if
(
*
res
&&
size
<
len
+
(
nmem
+
1
)
*
sizeof
(
char
*
)
+
32
)
{
*
res
=
0
;
rv
=
ERANGE
;
}
if
(
*
res
)
{
buf
+=
(
16
-
(
uintptr_t
)
buf
)
%
16
;
gr
->
gr_mem
=
(
void
*
)
buf
;
buf
+=
(
nmem
+
1
)
*
sizeof
(
char
*
);
memcpy
(
buf
,
line
,
len
);
FIX
(
name
);
FIX
(
passwd
);
for
(
i
=
0
;
mem
[
i
];
i
++
)
gr
->
gr_mem
[
i
]
=
mem
[
i
]
-
line
+
buf
;
gr
->
gr_mem
[
i
]
=
0
;
}
free
(
mem
);
free
(
line
);
pthread_setcancelstate
(
cs
,
0
);
if
(
rv
)
errno
=
rv
;
return
rv
;
}
int
getgrnam_r
(
const
char
*
name
,
struct
group
*
gr
,
char
*
buf
,
size_t
size
,
struct
group
**
res
)
{
unsupported_api
(
__FUNCTION__
);
return
getgr_r
(
name
,
0
,
gr
,
buf
,
size
,
res
);
}
int
getgrgid_r
(
gid_t
gid
,
struct
group
*
gr
,
char
*
buf
,
size_t
size
,
struct
group
**
res
)
{
return
getgr_r
(
0
,
gid
,
gr
,
buf
,
size
,
res
);
}
porting/liteos_a/user/src/passwd/getgrent.c
已删除
100644 → 0
浏览文件 @
e0f847e3
#include <unsupported_api.h>
#include "pwf.h"
static
FILE
*
f
;
static
char
*
line
,
**
mem
;
static
struct
group
gr
;
void
setgrent
()
{
unsupported_api
(
__FUNCTION__
);
if
(
f
)
fclose
(
f
);
f
=
0
;
}
weak_alias
(
setgrent
,
endgrent
);
struct
group
*
getgrent
()
{
struct
group
*
res
;
size_t
size
=
0
,
nmem
=
0
;
unsupported_api
(
__FUNCTION__
);
if
(
!
f
)
f
=
fopen
(
"/etc/group"
,
"rbe"
);
if
(
!
f
)
return
0
;
__getgrent_a
(
f
,
&
gr
,
&
line
,
&
size
,
&
mem
,
&
nmem
,
&
res
);
return
res
;
}
struct
group
*
getgrgid
(
gid_t
gid
)
{
struct
group
*
res
;
size_t
size
=
0
,
nmem
=
0
;
unsupported_api
(
__FUNCTION__
);
__getgr_a
(
0
,
gid
,
&
gr
,
&
line
,
&
size
,
&
mem
,
&
nmem
,
&
res
);
return
res
;
}
struct
group
*
getgrnam
(
const
char
*
name
)
{
struct
group
*
res
;
size_t
size
=
0
,
nmem
=
0
;
__getgr_a
(
name
,
0
,
&
gr
,
&
line
,
&
size
,
&
mem
,
&
nmem
,
&
res
);
return
res
;
}
porting/liteos_a/user/src/passwd/getpw_r.c
已删除
100644 → 0
浏览文件 @
e0f847e3
#include "pwf.h"
#include <pthread.h>
#include <unsupported_api.h>
#define FIX(x) (pw->pw_##x = pw->pw_##x-line+buf)
static
int
getpw_r
(
const
char
*
name
,
uid_t
uid
,
struct
passwd
*
pw
,
char
*
buf
,
size_t
size
,
struct
passwd
**
res
)
{
char
*
line
=
0
;
size_t
len
=
0
;
int
rv
=
0
;
int
cs
;
pthread_setcancelstate
(
PTHREAD_CANCEL_DISABLE
,
&
cs
);
rv
=
__getpw_a
(
name
,
uid
,
pw
,
&
line
,
&
len
,
res
);
if
(
*
res
&&
size
<
len
)
{
*
res
=
0
;
rv
=
ERANGE
;
}
if
(
*
res
)
{
memcpy
(
buf
,
line
,
len
);
FIX
(
name
);
FIX
(
passwd
);
FIX
(
gecos
);
FIX
(
dir
);
FIX
(
shell
);
}
free
(
line
);
pthread_setcancelstate
(
cs
,
0
);
if
(
rv
)
errno
=
rv
;
return
rv
;
}
int
getpwnam_r
(
const
char
*
name
,
struct
passwd
*
pw
,
char
*
buf
,
size_t
size
,
struct
passwd
**
res
)
{
unsupported_api
(
__FUNCTION__
);
return
getpw_r
(
name
,
0
,
pw
,
buf
,
size
,
res
);
}
int
getpwuid_r
(
uid_t
uid
,
struct
passwd
*
pw
,
char
*
buf
,
size_t
size
,
struct
passwd
**
res
)
{
return
getpw_r
(
0
,
uid
,
pw
,
buf
,
size
,
res
);
}
porting/liteos_a/user/src/passwd/getpwent.c
已删除
100644 → 0
浏览文件 @
e0f847e3
#include "pwf.h"
#include <unsupported_api.h>
static
FILE
*
f
;
static
char
*
line
;
static
struct
passwd
pw
;
static
size_t
size
;
void
setpwent
()
{
unsupported_api
(
__FUNCTION__
);
if
(
f
)
fclose
(
f
);
f
=
0
;
}
weak_alias
(
setpwent
,
endpwent
);
struct
passwd
*
getpwent
()
{
struct
passwd
*
res
;
unsupported_api
(
__FUNCTION__
);
if
(
!
f
)
f
=
fopen
(
"/etc/passwd"
,
"rbe"
);
if
(
!
f
)
return
0
;
__getpwent_a
(
f
,
&
pw
,
&
line
,
&
size
,
&
res
);
return
res
;
}
struct
passwd
*
getpwuid
(
uid_t
uid
)
{
struct
passwd
*
res
;
unsupported_api
(
__FUNCTION__
);
__getpw_a
(
0
,
uid
,
&
pw
,
&
line
,
&
size
,
&
res
);
return
res
;
}
struct
passwd
*
getpwnam
(
const
char
*
name
)
{
struct
passwd
*
res
;
__getpw_a
(
name
,
0
,
&
pw
,
&
line
,
&
size
,
&
res
);
return
res
;
}
porting/liteos_a/user/src/unistd/getlogin.c
已删除
100644 → 0
浏览文件 @
e0f847e3
#include <unistd.h>
#include <stdlib.h>
#include <unsupported_api.h>
char
*
getlogin
(
void
)
{
unsupported_api
(
__FUNCTION__
);
return
getenv
(
"LOGNAME"
);
}
porting/liteos_a/user/src/unistd/getlogin_r.c
已删除
100644 → 0
浏览文件 @
e0f847e3
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <unsupported_api.h>
int
getlogin_r
(
char
*
name
,
size_t
size
)
{
char
*
logname
=
getlogin
();
unsupported_api
(
__FUNCTION__
);
if
(
!
logname
)
return
ENXIO
;
/* or...? */
if
(
strlen
(
logname
)
>=
size
)
return
ERANGE
;
strcpy
(
name
,
logname
);
return
0
;
}
porting/liteos_a/user/src/unistd/nice.c
已删除
100644 → 0
浏览文件 @
e0f847e3
#include <unistd.h>
#include <sys/resource.h>
#include <limits.h>
#include "syscall.h"
#include <unsupported_api.h>
int
nice
(
int
inc
)
{
int
prio
=
inc
;
unsupported_api
(
__FUNCTION__
);
// Only query old priority if it can affect the result.
// This also avoids issues with integer overflow.
if
(
inc
>
-
2
*
NZERO
&&
inc
<
2
*
NZERO
)
prio
+=
getpriority
(
PRIO_PROCESS
,
0
);
if
(
prio
>
NZERO
-
1
)
prio
=
NZERO
-
1
;
if
(
prio
<
-
NZERO
)
prio
=
-
NZERO
;
return
setpriority
(
PRIO_PROCESS
,
0
,
prio
)
?
-
1
:
prio
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录