Skip to content

Commit a819a6a

Browse files
committed
lkl: Remove gettid from host_ops
host_ops.gettid is not called anywhere except in a boot test. The boot test just checks to see if gettid returns a non-zero tid, which makes no sense. I suspect host_ops.gettid was added for some historical reason, but it can now be safely removed. This commit removes it as well as the silly test. Signed-off-by: Ruihan Li <lrh2000@pku.edu.cn>
1 parent 7a3e989 commit a819a6a

4 files changed

Lines changed: 0 additions & 36 deletions

File tree

arch/lkl/include/uapi/asm/host_ops.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,6 @@ enum lkl_prot {
110110
* @iomem_acess - reads or writes to and I/O memory region; addr must be in the
111111
* range returned by ioremap
112112
*
113-
* @gettid - returns the host thread id of the caller, which need not
114-
* be the same as the handle returned by thread_create
115-
*
116113
* @jmp_buf_set - runs the give function and setups a jump back point by saving
117114
* the context in the jump buffer; jmp_buf_longjmp can be called from the give
118115
* function or any callee in that function to return back to the jump back
@@ -177,8 +174,6 @@ struct lkl_host_operations {
177174
int (*iomem_access)(const volatile void *addr, void *val, int size,
178175
int write);
179176

180-
long (*gettid)(void);
181-
182177
void (*jmp_buf_set)(struct lkl_jmp_buf *jmpb, void (*f)(void));
183178
void (*jmp_buf_longjmp)(struct lkl_jmp_buf *jmpb, int val);
184179

tools/lkl/lib/nt-host.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,6 @@ static void print(const char *str, int len)
241241
write(1, str, len);
242242
}
243243

244-
static long gettid(void)
245-
{
246-
return GetCurrentThreadId();
247-
}
248-
249244
static void *mem_alloc(unsigned long size)
250245
{
251246
return malloc(size);
@@ -281,7 +276,6 @@ struct lkl_host_operations lkl_host_ops = {
281276
.ioremap = lkl_ioremap,
282277
.iomem_access = lkl_iomem_access,
283278
.virtio_devices = lkl_virtio_devs,
284-
.gettid = gettid,
285279
.jmp_buf_set = jmp_buf_set,
286280
.jmp_buf_longjmp = jmp_buf_longjmp,
287281
};

tools/lkl/lib/posix-host.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -448,15 +448,6 @@ static void panic(void)
448448
assert(0);
449449
}
450450

451-
static long _gettid(void)
452-
{
453-
#ifdef __FreeBSD__
454-
return (long)pthread_self();
455-
#else
456-
return syscall(SYS_gettid);
457-
#endif
458-
}
459-
460451
static void *page_alloc(unsigned long size)
461452
{
462453
void *addr;
@@ -607,7 +598,6 @@ struct lkl_host_operations lkl_host_ops = {
607598
.ioremap = lkl_ioremap,
608599
.iomem_access = lkl_iomem_access,
609600
.virtio_devices = lkl_virtio_devs,
610-
.gettid = _gettid,
611601
.jmp_buf_set = jmp_buf_set,
612602
.jmp_buf_longjmp = jmp_buf_longjmp,
613603
.memcpy = posix_memcpy,

tools/lkl/tests/boot.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -385,20 +385,6 @@ static int lkl_test_semaphore(void)
385385
return ret;
386386
}
387387

388-
static int lkl_test_gettid(void)
389-
{
390-
long tid = lkl_host_ops.gettid();
391-
lkl_test_logf("%ld", tid);
392-
393-
/* As far as I know, thread IDs are non-zero on all reasonable
394-
* systems. */
395-
if (tid) {
396-
return TEST_SUCCESS;
397-
} else {
398-
return TEST_FAILURE;
399-
}
400-
}
401-
402388
static void test_thread(void *data)
403389
{
404390
int *pipe_fds = (int*) data;
@@ -753,7 +739,6 @@ struct lkl_test tests[] = {
753739
LKL_TEST(chdir_root),
754740
LKL_TEST(umount_fs_proc),
755741
LKL_TEST(lo_ifup),
756-
LKL_TEST(gettid),
757742
LKL_TEST(syscall_thread),
758743
/*
759744
* Wine has an issue where the FlsCallback is not called when

0 commit comments

Comments
 (0)