lkml.org 
[lkml]   [2020]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] ia64: enable HAVE_COPY_THREAD_TLS, switch to kernel_clone_args
From
Date
On 5/14/20 12:32 PM, Christian Brauner wrote:
> Do you have a very minimalistic ia64 userspace preferably without systemd where
> you could simply test. That should give us an idea whether things work:
>
> #define _GNU_SOURCE
> #include <sys/wait.h>
> #include <sys/utsname.h>
> #include <sched.h>
> #include <string.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> #include <sys/mman.h>
>
> #define STACK_SIZE (8 * 1024 * 1024) /* standard stack size for threads in glibc */
>
> int main(int argc, char *argv[])
> {
> char *stack;
> pid_t pid;
>
> stack = mmap(NULL, STACK_SIZE, PROT_READ | PROT_WRITE,
> MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0);
> if (stack == MAP_FAILED)
> exit(EXIT_FAILURE);
>
> /*
> * Note that legacy clone() has different argument ordering on
> * different architectures so this won't work everywhere.
> */
> pid = syscall(189 /* __NR_clone2 */, SIGCHLD, stack, STACK_SIZE, NULL, NULL);
> if (pid < 0)
> exit(EXIT_FAILURE);
> if (pid == 0)
> exit(EXIT_SUCCESS);
> if (wait(NULL) != pid)
> exit(EXIT_FAILURE);
>
> exit(EXIT_SUCCESS);
> }

root@titanium:~# gcc systemd_test.c -o systemd_test
root@titanium:~# ./systemd_test
root@titanium:~# echo $?
1
root@titanium:~#

I can also give you access to this machine.

Adrian

--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer - glaubitz@debian.org
`. `' Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913

\
 
 \ /
  Last update: 2020-05-14 12:36    [W:0.794 / U:0.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site