c/os: fork/exec
This commit is contained in:
36
c/os/os.go
36
c/os/os.go
@@ -108,8 +108,8 @@ func Chroot(path *c.Char) c.Int
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
//go:linkname Environ C.environ
|
||||
func Environ() **c.Char
|
||||
//go:linkname Environ environ
|
||||
var Environ **c.Char
|
||||
|
||||
//go:linkname Getenv C.getenv
|
||||
func Getenv(name *c.Char) *c.Char
|
||||
@@ -208,6 +208,38 @@ func Isatty(fd c.Int) c.Int
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Execl(const char *path, const char *arg0, ..., /*, (char *)0, */)
|
||||
//
|
||||
// Execl requires the full path of the program to be provided.
|
||||
//
|
||||
//go:linkname Execl C.execl
|
||||
func Execl(path *c.Char, __llgo_va_list ...any) c.Int
|
||||
|
||||
// Execle(const char *path, const char *arg0, ..., /* (char *)0, char *const envp[] */)
|
||||
//
|
||||
//go:linkname Execle C.execle
|
||||
func Execle(path *c.Char, __llgo_va_list ...any) c.Int
|
||||
|
||||
// Execlp(const char *file, const char *arg0, ..., /*, (char *)0, */)
|
||||
//
|
||||
// Execlp only needs to provide the program name and it will search for the program in the
|
||||
// paths specified in the PATH environment variable.
|
||||
//
|
||||
//go:linkname Execlp C.execlp
|
||||
func Execlp(file *c.Char, __llgo_va_list ...any) c.Int
|
||||
|
||||
//go:linkname Execv C.execv
|
||||
func Execv(path *c.Char, argv **c.Char) c.Int
|
||||
|
||||
//go:linkname Execve C.execve
|
||||
func Execve(path *c.Char, argv **c.Char, envp **c.Char) c.Int
|
||||
|
||||
//go:linkname Execvp C.execvp
|
||||
func Execvp(file *c.Char, argv **c.Char) c.Int
|
||||
|
||||
//go:linkname Fork C.fork
|
||||
func Fork() c.Int
|
||||
|
||||
//go:linkname Kill C.kill
|
||||
func Kill(pid c.Int, sig c.Int) c.Int
|
||||
|
||||
|
||||
21
c/syscall/syscall.go
Normal file
21
c/syscall/syscall.go
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* http://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.
|
||||
*/
|
||||
|
||||
package syscall
|
||||
|
||||
const (
|
||||
LLGoPackage = "decl"
|
||||
)
|
||||
Reference in New Issue
Block a user