Closed jiridanek closed 1 year ago
Indeed, it should be straightforward to just copy and change the code for getuid
. There's a bit of boilerplate because of indirection. We have two different backends for posix functions:
NFIPosixSupport
) - calls down to a native C wrapper function that calls the libc function. That's the default. The C functions wrappers are defined in posix.c
.EmulatedPosixSupport
) - tries to implement the call using Java API. You can get it with --python.PosixModuleBackend=java
If you want to add a new posix call, you need to add a new method to PosixSupportLibrary
and implement it in all 4 Truffle library implementations (NFIPosixSupport
, EmulatedPosixSupport
, ImageBuildtimePosixSupport
, LoggingPosixSupport
), then add a builtin to PosixModuleBuiltins
that calls the function. Feel free to drop by on the #graalpy
slack channel if you have any questions.
PR merged
The following code in pyfakefs does not run, https://github.com/pytest-dev/pyfakefs/blob/fa36aee5d072b4f80d9ad0a0dc9091e4e2e2e193/pyfakefs/helpers.py#L43-L44
I am intending to have a look on Friday and maybe send a PR, if I can figure this out. If it is indeed the case that
os.getuid()
is implemented andos.getgid()
is not, it should not be hard to add that (by analogy)pyfakefs stacktrace