All Downloads are FREE. Search and download functionalities are using the official Maven repository.

linuxMain.io.matthewnelson.kmp.process.internal.spawn.LinuxPosixSpawn.kt Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2024 Matthew Nelson
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 **/
@file:Suppress("KotlinRedundantDiagnosticSuppress")

package io.matthewnelson.kmp.process.internal.spawn

import kotlinx.cinterop.*
import platform.linux.posix_spawn
import platform.linux.posix_spawnp
import platform.posix.pid_tVar

@Suppress("NOTHING_TO_INLINE")
@OptIn(ExperimentalForeignApi::class)
internal actual inline fun MemScope.posixSpawn(
    program: String,
    pid: CValuesRef,
    fileActions: PosixSpawnFileActions,
    attrs: PosixSpawnAttrs,
    argv: CValuesRef>,
    envp: CValuesRef>,
): Int = posix_spawn(pid, program, fileActions.ref, attrs.ref, argv, envp)

@Suppress("NOTHING_TO_INLINE")
@OptIn(ExperimentalForeignApi::class)
internal actual inline fun MemScope.posixSpawnP(
    program: String,
    pid: CValuesRef,
    fileActions: PosixSpawnFileActions,
    attrs: PosixSpawnAttrs,
    argv: CValuesRef>,
    envp: CValuesRef>,
): Int = posix_spawnp(pid, program, fileActions.ref, attrs.ref, argv, envp)




© 2015 - 2025 Weber Informatics LLC | Privacy Policy