I have been studying the current RTEMS files and comparing them with the FreeBSD implementation. At the moment, I have a working getgrent.c replacement and a getgrnam.c replacement that still keep the current RTEMS file split, and the psxpasswd01 test passes with these changes.
While reading the FreeBSD source, I noticed that the group-related non-_r interfaces such as getgrnam() and getgrgid() are implemented within getgrent.c, rather than being kept in separate source files.
Before I continue, I would like to ask about the preferred direction for RTEMS:
Should I keep the current RTEMS file layout and continue with separate files such as getgrent.c and getgrnam.c, while only reusing/adapting FreeBSD logic internally?
Or would it be preferable to also reorganize the RTEMS source layout to more closely follow the current FreeBSD structure, for example by merging the group-related non-_r wrappers into getgrent.c?
My current inclination is to keep the existing RTEMS file split unless there is a preference to change it, since that seems like the smaller structural change. If so, I would likely follow the same layout approach for the passwd-related files as well for consistency.
However, I wanted to confirm before moving further.
There are instructions in the README.md inside contrib/ on how to import source. It also includes how to import something that does not have a version number but a revision or date instead.
Thanks for the guidance. I followed the suggested approach and opened a draft MR here:
The series imports the FreeBSD passwd/group sources under contrib as unchanged reference material, with the upstream branch, hash, and source URLs recorded in the import commit.
The implementation reworks the passwd/group entry APIs under libcsupport/src and keeps the RTEMS-specific default /etc/passwd and /etc/group initialization in a separate BSD-licensed helper file.
Validation performed on aarch64/zynqmp_qemu:
./waf
psxpasswd01
pwdgrp01
pwdgrp02
All passed.
The MR is currently marked as Draft. The POSIX Users Guide documentation update mentioned in the issue is not included yet. I can add it to this MR after initial review, or submit it as a follow-up patch if preferred.
I think there was some misunderstanding. The goal should be to import the code from freebsd and then use it directly, with minimal in-place modifications protected by ifdef __rtems__ and similar.
Thanks for the clarification. I misunderstood the intended approach and treated the FreeBSD import as reference material instead of using the imported code directly.
I will rework the draft MR so that the passwd/group implementation is based directly on the FreeBSD sources, with RTEMS-specific changes kept as small as possible and guarded with __rtems__ conditionals where appropriate.
I will keep the MR as Draft while reworking the series.