[patch v1] add ptmx support to test-container
H.J. Lu
hjl.tools@gmail.com
Fri Mar 21 02:57:17 GMT 2025
On Thu, Mar 20, 2025 at 4:59 PM DJ Delorie <dj@redhat.com> wrote:
>
> "H.J. Lu" <hjl.tools@gmail.com> writes:
> >> +#ifdef __linux__
> >> + devmount (new_root_path, "ptmx");
> >> +#endif
> >
> > I think the ptmx test should be done with header files in
> > sysdeps/generic and sysdeps/unix/sysv/linux to avoid
> > "#ifdef __linux__".
>
> It's not the only __linux__ test in that file, though.
>
> test-container is a neccessarily os-aware program, I don't see making it
> portable across the two kernels we normally support (Linux and HURD) to
> be information other programs would benefit from. Who would benefit
> from a "#define TEST_CONTAINER_NEEDS_DEV_PTMX" ? And keep in mind it
No need for macros. We can add tst-ptmx.h to define inline functions,
devmount_ptmx and mount_ptmx. Then we just do
...
#include <tst-ptmx.h>
...
devmount_ptmx (new_root_path);
...
mount_ptmx ();
...
> would need two macros if we macroized the commands; one for the
> pre-namespace commands and one for the post-namespace ones.
>
> As for existing portability macros, posix_openpt() is generally
> implemented by separate files with their own kernel-specific paths
> within, so there's nothing existing to check for.
>
--
H.J.
More information about the Libc-alpha
mailing list