-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for compiling NetBSD & OpenBSD (#851)
Reviewed-by: Alexander Jung <[email protected]> Approved-by: Alexander Jung <[email protected]>
- Loading branch information
Showing
18 changed files
with
392 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
// Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. | ||
// Licensed under the BSD-3-Clause License (the "License"). | ||
// You may not use this file expect in compliance with the License. | ||
package exec | ||
|
||
import ( | ||
"syscall" | ||
) | ||
|
||
func hostAttributes() *syscall.SysProcAttr { | ||
// the Setpgid flag is used to prevent the child process from exiting when | ||
// the parent is killed | ||
return &syscall.SysProcAttr{ | ||
Setpgid: true, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
// Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. | ||
// Licensed under the BSD-3-Clause License (the "License"). | ||
// You may not use this file expect in compliance with the License. | ||
package exec | ||
|
||
import ( | ||
"syscall" | ||
) | ||
|
||
func hostAttributes() *syscall.SysProcAttr { | ||
// the Setpgid flag is used to prevent the child process from exiting when | ||
// the parent is killed | ||
return &syscall.SysProcAttr{ | ||
Setpgid: true, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
// Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. | ||
// Licensed under the BSD-3-Clause License (the "License"). | ||
// You may not use this file except in compliance with the License. | ||
package initrd | ||
|
||
import ( | ||
"context" | ||
) | ||
|
||
type ociimage struct{} | ||
|
||
// NewFromOCIImage creates a new initrd from a remote container image. | ||
func NewFromOCIImage(ctx context.Context, path string, opts ...InitrdOption) (Initrd, error) { | ||
return nil, nil | ||
} | ||
|
||
// Build implements Initrd. | ||
func (initrd *ociimage) Name() string { | ||
return "OCI image" | ||
} | ||
|
||
// Build implements Initrd. | ||
func (initrd *ociimage) Build(ctx context.Context) (string, error) { | ||
return "", nil | ||
} | ||
|
||
// Env implements Initrd. | ||
func (initrd *ociimage) Env() []string { | ||
return nil | ||
} | ||
|
||
// Args implements Initrd. | ||
func (initrd *ociimage) Args() []string { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
// Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. | ||
// Licensed under the BSD-3-Clause License (the "License"). | ||
// You may not use this file except in compliance with the License. | ||
package initrd | ||
|
||
import ( | ||
"context" | ||
) | ||
|
||
type ociimage struct{} | ||
|
||
// NewFromOCIImage creates a new initrd from a remote container image. | ||
func NewFromOCIImage(ctx context.Context, path string, opts ...InitrdOption) (Initrd, error) { | ||
return nil, nil | ||
} | ||
|
||
// Build implements Initrd. | ||
func (initrd *ociimage) Name() string { | ||
return "OCI image" | ||
} | ||
|
||
// Build implements Initrd. | ||
func (initrd *ociimage) Build(ctx context.Context) (string, error) { | ||
return "", nil | ||
} | ||
|
||
// Env implements Initrd. | ||
func (initrd *ociimage) Env() []string { | ||
return nil | ||
} | ||
|
||
// Args implements Initrd. | ||
func (initrd *ociimage) Args() []string { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
// Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. | ||
// Licensed under the BSD-3-Clause License (the "License"). | ||
// You may not use this file except in compliance with the License. | ||
package network | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
|
||
networkv1alpha1 "kraftkit.sh/api/network/v1alpha1" | ||
) | ||
|
||
var defaultStrategyName = "bridge" | ||
|
||
// hostSupportedStrategies returns the map of known supported drivers for the | ||
// given host. | ||
func hostSupportedStrategies() map[string]*Strategy { | ||
return map[string]*Strategy{ | ||
"bridge": { | ||
NewNetworkV1alpha1: func(ctx context.Context, opts ...any) (networkv1alpha1.NetworkService, error) { | ||
return nil, errors.New("network service is not supported on netBSD") | ||
}, | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
// Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. | ||
// Licensed under the BSD-3-Clause License (the "License"). | ||
// You may not use this file except in compliance with the License. | ||
package network | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
|
||
networkv1alpha1 "kraftkit.sh/api/network/v1alpha1" | ||
) | ||
|
||
var defaultStrategyName = "bridge" | ||
|
||
// hostSupportedStrategies returns the map of known supported drivers for the | ||
// given host. | ||
func hostSupportedStrategies() map[string]*Strategy { | ||
return map[string]*Strategy{ | ||
"bridge": { | ||
NewNetworkV1alpha1: func(ctx context.Context, opts ...any) (networkv1alpha1.NetworkService, error) { | ||
return nil, errors.New("network service is not supported on openBSD") | ||
}, | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
// Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. | ||
// Licensed under the BSD-3-Clause License (the "License"). | ||
// You may not use this file except in compliance with the License. | ||
package platform | ||
|
||
func unixVariantStrategies() map[Platform]*Strategy { | ||
return map[Platform]*Strategy{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
// Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. | ||
// Licensed under the BSD-3-Clause License (the "License"). | ||
// You may not use this file except in compliance with the License. | ||
package platform | ||
|
||
func unixVariantStrategies() map[Platform]*Strategy { | ||
return map[Platform]*Strategy{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.