Git Product home page Git Product logo

Comments (8)

jeremyelalouf avatar jeremyelalouf commented on June 27, 2024

Hi @no92,

I would love to contribute here, but I still have some questions regarding portability issues.

The goal is to implement the mincore function. Does it require a specific implementation for different sysdeps, or could one generic implementation suffice?

Additionally, it's possible that I lack knowledge in these subjects, but I am eager to learn. I have a strong background in C, and with a bit more context, I'm confident that I can make a meaningful contribution here!

Let me know! :)

from mlibc.

qookei avatar qookei commented on June 27, 2024

We'd want to leave the actual implementation up to sysdeps. E.g. on Linux mincore is implemented via a system call, and other systems probably want to do their own thing.

from mlibc.

jeremyelalouf avatar jeremyelalouf commented on June 27, 2024

Okay, I see. Totally makes sense!

So here the goal would be to implement the function for all supported os ?

from mlibc.

qookei avatar qookei commented on June 27, 2024

That's kinda out of scope for mlibc, I think Linux is the only system we support that currently implements an mincore syscall, and implementing it ourselves for everyone else would be quite a bit of work on our side. I don't think this even can be implemented without OS support, since it checks for page residency (whether accessing it will not require allocation or loading data from disk), not whether the page is mapped in in general, and pages becoming non-resident is supposed to be transparent, apart from maybe the time it takes to load it back in.

How mlibc deals with this is via sysdeps, which house the system-specific functions required by the various generic libc functions. Most sysdep functions are marked [[gnu::weak]], which means that if they're missing, they resolve to NULL at link time. The actual function that uses the sysdep then checks if that's the case, and if so, bails out with an ENOSYS error (or whatever's appropriate). Once a particular system adds a way to provide the sysdep for mincore, it can be added, and the generic function will just work on it.

Also, I've just had a look, and we apparently have mincore in mlibc itself? I might be missing something, but perhaps @no92 meant to make this issue on the Managarm repo? It'd still be appreciated if you took up the task of doing that, but that's probably gonna be a more involved project than just the mlibc side and the Linux sysdep. I apologize for the confusion if that's the case!

from mlibc.

no92 avatar no92 commented on June 27, 2024

Yeah I didn't notice the linux sysdep. I guess it would be nice to implement it for managarm, as we don't have many cases where a page wouldn't be resident in memory that shouldn't be too hardβ„’.

from mlibc.

jeremyelalouf avatar jeremyelalouf commented on June 27, 2024

@no92 so it would not be in this repo but on the Managarm's one ?

from mlibc.

no92 avatar no92 commented on June 27, 2024

Managarm's sysdeps are implemented in this repo, under sysdeps/managarm.

from mlibc.

jeremyelalouf avatar jeremyelalouf commented on June 27, 2024

Okay, and you think that it's a good first issue ? @no92

from mlibc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.