Skip to content

Commit

Permalink
bpo-26835: Add file sealing constants to fcntl (pythonGH-13694)
Browse files Browse the repository at this point in the history
Co-authored-by: nanjekyejoannah <[email protected]>
  • Loading branch information
tiran and nanjekyejoannah authored May 31, 2019
1 parent ffed76b commit 8cbb5b6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Doc/library/fcntl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ descriptor.
Operations in this module used to raise an :exc:`IOError` where they now
raise an :exc:`OSError`.

.. versionchanged:: 3.8
The fcntl module now contains ``F_ADD_SEALS``, ``F_GET_SEALS``, and
``F_SEAL_*`` constants for sealing of :func:`os.memfd_create` file
descriptors.

The module defines the following functions:

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The fcntl module now contains file sealing constants for sealing of memfds.
10 changes: 9 additions & 1 deletion Modules/fcntlmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,15 @@ all_ins(PyObject* m)
if (PyModule_AddIntMacro(m, I_PLINK)) return -1;
if (PyModule_AddIntMacro(m, I_PUNLINK)) return -1;
#endif

#ifdef F_ADD_SEALS
/* Linux: file sealing for memfd_create() */
if (PyModule_AddIntMacro(m, F_ADD_SEALS)) return -1;
if (PyModule_AddIntMacro(m, F_GET_SEALS)) return -1;
if (PyModule_AddIntMacro(m, F_SEAL_SEAL)) return -1;
if (PyModule_AddIntMacro(m, F_SEAL_SHRINK)) return -1;
if (PyModule_AddIntMacro(m, F_SEAL_GROW)) return -1;
if (PyModule_AddIntMacro(m, F_SEAL_WRITE)) return -1;
#endif
return 0;
}

Expand Down

0 comments on commit 8cbb5b6

Please sign in to comment.