Skip to content

libct/system: move to internal - #5579

Open
kolyshkin wants to merge 5 commits into
opencontainers:mainfrom
kolyshkin:libct-system-internal
Open

kolyshkin wants to merge 5 commits into
opencontainers:mainfrom
kolyshkin:libct-system-internal

Conversation

@kolyshkin

@kolyshkin kolyshkin commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

libcontainer/system (and its kernelversion subpackage) is only used by runc itself, so there is no reason to keep it as part of the public API. This moves it to internal packages, as suggested by internal/sys/doc.go:

  • libcontainer/system/kernelversion → internal/kernelversion;
  • libcontainer/system → internal/sys, except for the basic syscall wrappers (SetKeepCaps, ClearKeepCaps, Setctty, SetSubreaper, SetLinuxPersonality), which go to internal/linux;
  • GetPtyPeer (an exact copy of linux.GetPtyPeer) and GetSubreaper (unused) are not moved.

The moves are done as pure renames in separate commits, so git log --follow and git blame keep working. Deprecated wrappers (and type aliases) are added back to the old locations by the last commit, to be removed in runc 1.7.

Related: #3028.

@kolyshkin
kolyshkin force-pushed the libct-system-internal branch from 31b2109 to 93c3870 Compare October 26, 2026 08:53
@kolyshkin kolyshkin added this to the 1.6.0-rc.2 milestone Oct 26, 2026
@kolyshkin

Copy link
Copy Markdown
Contributor Author

tentatively added to 1.6.0-rc.2

This package is only used by runc itself (in utils_linux.go), and there
is no reason to have it as part of the public API, so move it to
internal/kernelversion.

A deprecated wrapper is added back by a later commit.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
All the code in libcontainer/system is only used by runc itself, and
there is no reason to have it as part of the public API. In addition,
internal/sys/doc.go already says that whatever might belong to
libcontainer/system should go to internal/sys instead.

Move it to internal/sys, as is. Some of it is moved further down to
internal/linux by the next commit, and deprecated wrappers are added
back by a later commit.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
As per internal/sys/doc.go, basic syscall wrappers belong in
internal/linux, so move SetKeepCaps, ClearKeepCaps, Setctty,
SetSubreaper, and SetLinuxPersonality there.

While at it, remove:
 - GetPtyPeer, which is an exact copy of linux.GetPtyPeer;
 - GetSubreaper, which is not used.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Previous commits moved all of libcontainer/system and its kernelversion
subpackage to internal packages. Since these were part of the public
API, add back the wrappers (and type aliases) for external users,
marked as deprecated, to be removed in runc 1.7.

GetSubreaper is kept as is, since it is not used by runc and thus was
removed from internal/sys.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin
kolyshkin force-pushed the libct-system-internal branch from 93c3870 to 98b7824 Compare October 27, 2026 20:01
@kolyshkin
kolyshkin marked this pull request as ready for review October 27, 2026 20:01
The code moved from libcontainer/system is now considered new by
lint-extra, which results in a bunch of warnings. Fix those:

 - add missing doc comments to exported functions, types and constants;
 - rename internal sys.Stat_t to sys.StatT (the deprecated
   libcontainer/system.Stat_t alias keeps the old name).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant