Este contenido no está disponible en el idioma seleccionado.

2.13. Using the Notification API


The cgroups notification API allows user space applications to receive notifications about the changing status of a cgroup. Currently, the notification API only supports monitoring of the Out of Memory (OOM) control file: memory.oom_control. To create a notification handler, write a C program using the following instructions:
  1. Using the eventfd() function, create a file descriptor for event notifications. For more information, refer to the eventfd(2) man page.
  2. To monitor the memory.oom_control file, open it using the open() function. For more information, refer to the open(2) man page.
  3. Use the write() function to write the following arguments to the cgroup.event_control file of the cgroup whose memory.oom_control file you are monitoring:
    Copy to Clipboard Toggle word wrap
    <event_file_descriptor> <OOM_control_file_descriptor>
    where:
    • event_file_descriptor is used to open the cgroup.event_control file,
    • and OOM_control_file_descriptor is used to open the respective memory.oom_control file.
    For more information on writing to a file, refer to the write(1) man page.
When the above program is started, it will be notified of any OOM situation in the cgroup it is monitoring. Note that OOM notifications only work in non-root cgroups.
For more information on the memory.oom_control tunable parameter, refer to Section 3.7, “memory”. For more information on configuring notifications for OOM control, refer to Example 3.3, “OOM Control and Notifications”.
Volver arriba
Red Hat logoGithubredditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar. Explore nuestras recientes actualizaciones.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

Theme

© 2025 Red Hat, Inc.