Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BadOS Project
BWL
提交
d2658a36
B
BWL
项目概览
BadOS Project
/
BWL
通知
0
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
BWL
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d2658a36
编写于
7月 21, 2022
作者:
指向BIOS的野指针
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add achievement of the two getters
上级
5a2bc0c8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
6 deletion
+33
-6
includes/bwl.hh
includes/bwl.hh
+2
-2
libs/bsv.cc
libs/bsv.cc
+2
-0
libs/bwl.cc
libs/bwl.cc
+29
-4
未找到文件。
includes/bwl.hh
浏览文件 @
d2658a36
...
...
@@ -25,7 +25,7 @@ namespace bwl
* @param pgid
* @return void*
*/
void
*
getPage
(
id_t
pgid
);
__page
*
getPage
(
id_t
pgid
);
/**
* @brief 获得一个窗口
...
...
@@ -33,7 +33,7 @@ namespace bwl
* @param fid
* @return void*
*/
void
*
getFrame
(
id_t
fid
);
__frame
*
getFrame
(
id_t
fid
);
};
...
...
libs/bsv.cc
浏览文件 @
d2658a36
#define __bwl_server
#include "../includes/bsv.hh"
#include "../dbg/logs.hh"
...
...
libs/bwl.cc
浏览文件 @
d2658a36
#define __bwl_
server
#define __bwl_
client
#include "../includes/bwl.hh"
#include "../includes/pipe.hh"
...
...
@@ -31,6 +31,9 @@ namespace std
namespace
bwl
{
std
::
string
monitor_device
;
namespace
bad_wayland_server
{
pid_t
server_pid
;
...
...
@@ -40,6 +43,7 @@ namespace bwl
void
initBadWayland
(
std
::
string
__monitor_device
)
{
monitor_device
=
__monitor_device
;
std
::
fstream
host
(
BWLDIR
+
"/host"
,
std
::
ios
::
in
);
if
(
!
host
.
good
())
{
...
...
@@ -208,13 +212,34 @@ namespace bwl
return
bad_wayland_server
::
pix_depth
;
}
// TODO这两个getter没有实现
void
*
getPage
(
id_t
pgid
)
__page
*
getPage
(
id_t
pgid
)
{
int
shmf
=
std
::
shm_open
((
SHMPAGEDIR
+
std
::
to_string
(
pgid
)
+
"_shm"
).
c_str
(),
O_RDWR
|
O_CREAT
,
S_IRUSR
|
S_IWUSR
);
if
(
shmf
==
-
1
)
{
return
CREATE_PAGE_FAULT
;
}
__page
*
page
=
(
__page
*
)
std
::
mmap
(
nullptr
,
sizeof
(
__page
),
PROT_READ
,
MAP_SHARED
,
shmf
,
0
);
std
::
close
(
shmf
);
return
page
;
}
void
*
getFrame
(
id_t
fid
)
__frame
*
getFrame
(
id_t
fid
)
{
//映射数据
int
shmf
=
std
::
shm_open
((
SHMFRMDIR
+
std
::
to_string
(
fid
)
+
"_shm"
).
c_str
(),
O_RDWR
|
O_CREAT
,
S_IRUSR
|
S_IWUSR
);
if
(
shmf
==
-
1
)
{
return
CREATE_FRAME_FAULT
;
}
__frame
*
frame
=
(
__frame
*
)
std
::
mmap
(
nullptr
,
sizeof
(
__frame
),
PROT_READ
,
MAP_SHARED
,
shmf
,
0
);
int
namelen
=
frame
->
namelen
;
std
::
munmap
(
frame
,
sizeof
(
__frame
));
frame
=
(
__frame
*
)
std
::
mmap
(
nullptr
,
sizeof
(
__frame
)
+
namelen
+
1
,
PROT_READ
,
MAP_SHARED
,
shmf
,
0
);
std
::
close
(
shmf
);
return
frame
;
}
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录