Skip to contentSkip to conversation

proc: test /proc/thread-self symlink

PATCH New Alexey Dobriyan 1 participant 1 message Jun 27, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 proc: test /proc/thread-self symlink

Same story: I have WIP patch to make it faster, so better have a test as well.

---

 tools/testing/selftests/proc/.gitignore    |    1 
 tools/testing/selftests/proc/Makefile      |    1 
 tools/testing/selftests/proc/proc.h        |    5 ++
 tools/testing/selftests/proc/thread-self.c |   64 +++++++++++++++++++++++++++++
 4 files changed, 71 insertions(+)
tools/testing/selftests/proc/.gitignore +1 -0
@@ -10,3 +10,4 @@
 /proc-uptime-002
 /read
 /self
+/thread-self
tools/testing/selftests/proc/Makefile +1 -0
@@ -14,5 +14,6 @@ TEST_GEN_PROGS += proc-uptime-001
 TEST_GEN_PROGS += proc-uptime-002
 TEST_GEN_PROGS += read
 TEST_GEN_PROGS += self
+TEST_GEN_PROGS += thread-self
 
 include ../lib.mk
tools/testing/selftests/proc/proc.h +5 -0
@@ -14,6 +14,11 @@ static inline pid_t sys_getpid(void)
 	return syscall(SYS_getpid);
 }
 
+static inline pid_t sys_gettid(void)
+{
+	return syscall(SYS_gettid);
+}
+
 static inline bool streq(const char *s1, const char *s2)
 {
 	return strcmp(s1, s2) == 0;

new file mode 100644

tools/testing/selftests/proc/thread-self.c new file +64 -0

64 lines not on this page · raw message