# Kotlin Native calls the Linux C wait() function?

**URL:** <https://discuss.kotlinlang.org/t/kotlin-native-calls-the-linux-c-wait-function/24323>\
**Category:** Native\
**Created:** [March 4, 2022, 5:53pm UTC](https://discuss.kotlinlang.org/t/kotlin-native-calls-the-linux-c-wait-function/24323 "2022-03-04T17:53:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xunanmu](https://avatars.discourse-cdn.com/v4/letter/x/3ec8ea/32.png) [@xunanmu](https://discuss.kotlinlang.org/u/xunanmu)\
**Post date:** [March 4, 2022, 5:53pm UTC](https://discuss.kotlinlang.org/t/kotlin-native-calls-the-linux-c-wait-function/24323/1 "2022-03-04T17:53:58Z")

</div>

This is of type cvalue

```auto
public fun wait( __stat_loc: kotlinx.cinterop.CValue<platform.posix.__ WAIT_STATUS>): platform.posix.__pid_t /* = kotlin.Int */ { /* compiled code */ }

```

this is wait class

```auto
public final class wait public constructor(rawPtr: kotlinx.cinterop.NativePtr /* = kotlin.native.internal.NativePtr */) : kotlinx.cinterop.CStructVar {
    public companion object : kotlinx.cinterop.CStructVar.Type {
    }

    public final val __wait_stopped: platform.posix.anonymousStruct21 /* compiled code */

    public final val __wait_terminated: platform.posix.anonymousStruct20 /* compiled code */

    public final var w_status: kotlin.Int /* compiled code */
}

```

this is linux C wait() function

```auto
       #include <sys/wait.h>

       pid_t wait(int *wstatus);
       pid_t waitpid(pid_t pid, int *wstatus, int options);

       int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options);
                       /* This is the glibc and POSIX interface; see
                          NOTES for information on the raw system call. */

```

I don’t know how kotlin native calls the wait () function and gets the child process status code.

---

<div class="post-metadata">

**Author:** ![642751484](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/642751484/32/9234_2.png) [@642751484](https://discuss.kotlinlang.org/u/642751484)\
**Post date:** [March 31, 2022, 7:40pm UTC](https://discuss.kotlinlang.org/t/kotlin-native-calls-the-linux-c-wait-function/24323/2 "2022-03-31T19:40:51Z")

</div>

i want to know call system() of C/C++,for your question ,i hava no idea,because i am a fledgling
