Skip to content

[libc]重新梳理read write桩函数实现#5268

Merged
BernardXiong merged 5 commits into
RT-Thread:masterfrom
mysterywolf:SYSCALL
Nov 15, 2021
Merged

[libc]重新梳理read write桩函数实现#5268
BernardXiong merged 5 commits into
RT-Thread:masterfrom
mysterywolf:SYSCALL

Conversation

@mysterywolf

@mysterywolf mysterywolf commented Nov 10, 2021

Copy link
Copy Markdown
Member

拉取/合并请求描述:(PR description)

以下的内容不应该在提交PR时的message修改,修改下述message,PR会被直接关闭。请在提交PR后,浏览器查看PR并对以下检查项逐项check,没问题后逐条在页面上打钩。
The following content must not be changed in the submitted PR message. Otherwise, the PR will be closed immediately. After submitted PR, please use a web browser to visit PR, and check items one by one, and ticked them if no problem.

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 本拉取/合并请求代码是高质量的 Code in this PR is of high quality
  • 本拉取/合并使用formatting等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification

@mysterywolf mysterywolf added urgent 🏃 urgent bug This PR/issue is a bug in the current code. Status: waiting for test Waiting test for this PR. and removed bug This PR/issue is a bug in the current code. labels Nov 11, 2021
@xiangxistu

xiangxistu commented Nov 11, 2021

Copy link
Copy Markdown
Member

#5267 ,未添加新测试内容的测试用例可以通过;新添加的测试用例逻辑,不能通过。
@mysterywolf

4dc01ee6cea9d595ab84992f3dbc874

image

  • a+,追加的参数,貌似没有正确识别处理,文件追加书写的操作不正常;
  • 对于 fopen 的参数测试一栏,都只是打开文件,并没有对文件进行操作,仅判断入参是否正确;
  • stderr,stdout 的输出符合要求; stdin 貌似没有阻塞作用,而且 getchar() 函数也没有阻塞作用了;

@mysterywolf

Copy link
Copy Markdown
Member Author

我这边测试结果 是 stdin和getchar是可以正常工作的,a附加数据也是可以正常工作的, wb+写入也没啥问题

int test(void)
{
    FILE *ftest;
    const char *p = "hello world\n";

    ftest = fopen("test.txt","wb+");
    fwrite(p, 1, strlen(p), ftest);
    fclose(ftest);

    ftest = fopen("test.txt","a");
    fwrite(p, 1, strlen(p), ftest);
    fclose(ftest);
    return 0;
}

MSH_CMD_EXPORT(test,test);

@mysterywolf

Copy link
Copy Markdown
Member Author

记得测试的时候把画圈的那个勾上,这个会自动勾选fread fopen所需的所有选项
a9bfe6bf48f6d004e4f381160126802

@mysterywolf mysterywolf changed the title [libc][gcc] 重新梳理fread fwrite桩函数实现 [libc]重新梳理fread fwrite桩函数实现 Nov 12, 2021
@mysterywolf mysterywolf changed the title [libc]重新梳理fread fwrite桩函数实现 [libc]重新梳理read write桩函数实现 Nov 12, 2021

@xiangxistu xiangxistu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gcc 下测试通过

image

@Guozhanxin Guozhanxin added reviewed PR has been reviewed. and removed Status: waiting for test Waiting test for this PR. labels Nov 15, 2021
Comment thread components/libc/compilers/armlibc/syscalls.c Outdated
@Guozhanxin Guozhanxin added the +1 Agree +1 label Nov 15, 2021
@BernardXiong BernardXiong merged commit 0bcab28 into RT-Thread:master Nov 15, 2021
@mysterywolf mysterywolf deleted the SYSCALL branch November 15, 2021 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

important reviewed PR has been reviewed. urgent 🏃 urgent +1 Agree +1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants