Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib/nolibc: scanf and fscanf functions #977

Closed

Conversation

RaduNichita
Copy link
Contributor

Adding scanf and fscanf function to nolibc, since their symbols were exported, but no implementation was provided.

Prerequisite checklist

  • Read the contribution guidelines regarding submitting new changes to the project;
  • Tested your changes against relevant architectures and platforms;
  • Ran the checkpatch.uk on your commit series before opening this PR;
  • Updated relevant documentation.

Base target

  • Architecture(s): x86_64 and aarch64
  • Platform(s): [e.g. kvm, xen and linuxu
  • Application(s): N/A

Additional configuration

Description of changes

Added a proper implementation for the scanf and fscanf functions. The idea behind from reading from the serial port was highly inspired from here

You can test the PR by trying to call the scanf and fscanf functions with various parameters. For example,

#include <stdio.h>

int main()
{
  int x;
  short y;

  fscanf(stdin, "%d%hu", &x, &y);
  printf("x = %d and y = %hu\n", x, y);

  return 0;
}

@RaduNichita RaduNichita requested a review from a team as a code owner July 12, 2023 22:56
@razvand razvand self-assigned this Jul 13, 2023
@razvand razvand added kind/enhancement New feature or request area/lib Internal Unikraft Microlibrary lib/nolibc Only neccessary subset of libc functionality lang/c Issues or PRs to do with C/C++ labels Jul 13, 2023
@razvand razvand added this to the v0.14.0 (Prometheus) milestone Jul 13, 2023
Adding scanf and fscanf function to nolibc, since their symbols were
exported, but no implementation was provided.

Signed-off-by: Radu Nichita <radunichita99@gmail.com>
Copy link

@adinamariav adinamariav left a comment

Choose a reason for hiding this comment

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

Looks great imo.
Reviewed-by: Adina-Maria Vaman adinamaariav22@gmail.com

@razvand razvand removed the request for review from a team July 24, 2023 19:42
Copy link
Contributor

@razvand razvand left a comment

Choose a reason for hiding this comment

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

Approved-by: Razvan Deaconescu razvand@unikraft.io

@unikraft-bot unikraft-bot added the ci/merged Merged by CI label Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/lib Internal Unikraft Microlibrary ci/merged Merged by CI kind/enhancement New feature or request lang/c Issues or PRs to do with C/C++ lib/nolibc Only neccessary subset of libc functionality
Projects
Status: Done!
Development

Successfully merging this pull request may close these issues.

None yet

4 participants