linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/filesystems: Assume that TIOCGPTPEER is defined
@ 2025-11-26 18:07 Mark Brown
  0 siblings, 0 replies; only message in thread
From: Mark Brown @ 2025-11-26 18:07 UTC (permalink / raw)
  To: Shuah Khan, Christian Brauner
  Cc: linux-fsdevel, linux-kselftest, linux-kernel, Mark Brown

The devpts_pts selftest has an ifdef in case an architecture does not
define TIOCGPTPEER, but the handling for this is broken since we need
errno to be set to EINVAL in order to skip the test as we should. Given
that this ioctl() has been defined since v4.15 we may as well just assume
it's there rather than write handling code which will probably never get
used.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 tools/testing/selftests/filesystems/devpts_pts.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/testing/selftests/filesystems/devpts_pts.c b/tools/testing/selftests/filesystems/devpts_pts.c
index b1fc9b916ace..cad7da1bd7ca 100644
--- a/tools/testing/selftests/filesystems/devpts_pts.c
+++ b/tools/testing/selftests/filesystems/devpts_pts.c
@@ -100,7 +100,7 @@ static int resolve_procfd_symlink(int fd, char *buf, size_t buflen)
 static int do_tiocgptpeer(char *ptmx, char *expected_procfd_contents)
 {
 	int ret;
-	int master = -1, slave = -1, fret = -1;
+	int master = -1, slave, fret = -1;
 
 	master = open(ptmx, O_RDWR | O_NOCTTY | O_CLOEXEC);
 	if (master < 0) {
@@ -119,9 +119,7 @@ static int do_tiocgptpeer(char *ptmx, char *expected_procfd_contents)
 		goto do_cleanup;
 	}
 
-#ifdef TIOCGPTPEER
 	slave = ioctl(master, TIOCGPTPEER, O_RDWR | O_NOCTTY | O_CLOEXEC);
-#endif
 	if (slave < 0) {
 		if (errno == EINVAL) {
 			fprintf(stderr, "TIOCGPTPEER is not supported. "

---
base-commit: ac3fd01e4c1efce8f2c054cdeb2ddd2fc0fb150d
change-id: 20251126-selftests-filesystems-devpts-tiocgptpeer-fbd30e579859

Best regards,
--  
Mark Brown <broonie@kernel.org>


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-11-26 18:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-26 18:07 [PATCH] selftests/filesystems: Assume that TIOCGPTPEER is defined Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).