-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-99987: fcntl add the F_KINFO
constant for FreeBSD 13.1 and onwards.
#99988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fcntl()
does not contain code specific to other operations. The user is expected to provide a buffer object of the correct size and properly initialized.
d778702
to
af9ce0d
Compare
e060767
to
ed72a9b
Compare
- removing custom code out of `fcntl.fcntl`. - F_GETPATH requires MAXPATHLEN or greater so we increase the buffer size to be able to cater with F_KINFO greater size. - `fcntl.kinfoalloc` preallocate a proper kinfo_file buffer. - `fcntl.kinfodict` returns a handy representation of the data.
ed72a9b
to
efafa69
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand why do you want to add kinfoalloc()
and kinfodict()
, but for now there are no precedents for other operations. See for example the use of F_SETLK
in tests and in third-party examples. They use struct.pack()
and struct.unpack()
. The format string, unfortunately, is platform depending.
If we came with better solution, it should be universal, and cover all other fcntl()
and ioctl()
operations. It is a different and much larger issue. Let limit this issue for adding F_KINFO
(and maybe other constants?).
@@ -57,6 +57,8 @@ descriptor. | |||
``FICLONERANGE`` constants, which allow to share some data of one file with | |||
another file by reflinking on some filesystems (e.g., btrfs, OCFS2, and | |||
XFS). This behavior is commonly referred to as "copy-on-write". | |||
On FreeBSD >= 13.1, the :mod:`fcntl` module exposes the ``F_KINFO`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be versionchanged:: 3.13
now.
|
Oh, nested unions in the middle of structure. They hate us. It means also that the complete unpacker that supports all fields should be super complex. Does it support binary compatibility with FreeBSD < 12? If yes, then the first element in the union should have the largest size, and we can ignore alternatives. |
F_KINFO
constant for FreeBSD (from 13.1 release) #99987