From a69791e5e3b463e366199d4ab9fc1b9b0edb247c Mon Sep 17 00:00:00 2001 From: lacatoire Date: Wed, 21 Oct 2026 09:29:27 +0200 Subject: [PATCH] [Sync-En] sem, shmop: document errors on detached segments, auto_release warning and shmop fixes --- reference/sem/entities.ent | 20 ++++++++++++++++++++ reference/sem/functions/sem-get.xml | 12 +++++++++++- reference/sem/functions/shm-detach.xml | 7 ++++++- reference/sem/functions/shm-get-var.xml | 15 +++++++++++---- reference/sem/functions/shm-has-var.xml | 9 +++++++-- reference/sem/functions/shm-put-var.xml | 7 ++++++- reference/sem/functions/shm-remove-var.xml | 7 ++++++- reference/sem/functions/shm-remove.xml | 7 ++++++- reference/shmop/functions/shmop-delete.xml | 14 ++++++++++++-- reference/shmop/functions/shmop-open.xml | 22 ++++++++++++---------- reference/shmop/functions/shmop-write.xml | 6 +++--- 11 files changed, 100 insertions(+), 26 deletions(-) create mode 100644 reference/sem/entities.ent diff --git a/reference/sem/entities.ent b/reference/sem/entities.ent new file mode 100644 index 0000000000..c8a6033c3e --- /dev/null +++ b/reference/sem/entities.ent @@ -0,0 +1,20 @@ + + + + + + + + + Lanza un Error si shm + ya ha sido liberado con shm_detach. + + + + diff --git a/reference/sem/functions/sem-get.xml b/reference/sem/functions/sem-get.xml index 93975ee575..074c9ff0cd 100644 --- a/reference/sem/functions/sem-get.xml +++ b/reference/sem/functions/sem-get.xml @@ -1,6 +1,6 @@ - + @@ -125,6 +125,16 @@ semáforo. + + + Si auto_release está habilitado, las reservas mantenidas por un + objeto SysvSemaphore también se liberan en cuanto el + objeto es liberado, por ejemplo cuando la variable que lo contiene es eliminada + con unset, sobrescrita o sale del ámbito, y no solo al finalizar la petición. + Conserve una referencia al objeto durante todo el tiempo que el semáforo deba + permanecer reservado. + + diff --git a/reference/sem/functions/shm-detach.xml b/reference/sem/functions/shm-detach.xml index bed54c9060..07eb882232 100644 --- a/reference/sem/functions/shm-detach.xml +++ b/reference/sem/functions/shm-detach.xml @@ -1,6 +1,6 @@ - + @@ -45,6 +45,11 @@ + + &reftitle.errors; + &ext.sem.shm-detached-error; + + &reftitle.changelog; diff --git a/reference/sem/functions/shm-get-var.xml b/reference/sem/functions/shm-get-var.xml index 3113000ac8..45b0034177 100644 --- a/reference/sem/functions/shm-get-var.xml +++ b/reference/sem/functions/shm-get-var.xml @@ -1,6 +1,6 @@ - + @@ -17,8 +17,8 @@ shm_get_var devuelve la variable - identificada por variable_key, en - el segmento de memoria compartida identificado por shm_identifier. + identificada por key, en + el segmento de memoria compartida identificado por shm. La variable siempre está presente en la memoria compartida. @@ -50,9 +50,16 @@ &reftitle.returnvalues; Devuelve la variable correspondiente a la clave dada. + Si la clave no existe, se emite un E_WARNING + y se devuelve &false;. + + &reftitle.errors; + &ext.sem.shm-detached-error; + + &reftitle.changelog; @@ -82,7 +89,7 @@ shm_has_var shm_put_var - + - + @@ -35,7 +35,7 @@ key - El nombre de la variable. + La clave de la variable. @@ -49,6 +49,11 @@ + + &reftitle.errors; + &ext.sem.shm-detached-error; + + &reftitle.changelog; diff --git a/reference/sem/functions/shm-put-var.xml b/reference/sem/functions/shm-put-var.xml index 285874ec57..3bb787c0f7 100644 --- a/reference/sem/functions/shm-put-var.xml +++ b/reference/sem/functions/shm-put-var.xml @@ -1,6 +1,6 @@ - + @@ -70,6 +70,11 @@ + + &reftitle.errors; + &ext.sem.shm-detached-error; + + &reftitle.changelog; diff --git a/reference/sem/functions/shm-remove-var.xml b/reference/sem/functions/shm-remove-var.xml index cb64cce52b..328ae10ee0 100644 --- a/reference/sem/functions/shm-remove-var.xml +++ b/reference/sem/functions/shm-remove-var.xml @@ -1,6 +1,6 @@ - + @@ -51,6 +51,11 @@ + + &reftitle.errors; + &ext.sem.shm-detached-error; + + &reftitle.changelog; diff --git a/reference/sem/functions/shm-remove.xml b/reference/sem/functions/shm-remove.xml index 2a05a1fef4..373bc5c161 100644 --- a/reference/sem/functions/shm-remove.xml +++ b/reference/sem/functions/shm-remove.xml @@ -1,6 +1,6 @@ - + @@ -42,6 +42,11 @@ + + &reftitle.errors; + &ext.sem.shm-detached-error; + + &reftitle.changelog; diff --git a/reference/shmop/functions/shmop-delete.xml b/reference/shmop/functions/shmop-delete.xml index 28ed1c88ab..0d6fc177a9 100644 --- a/reference/shmop/functions/shmop-delete.xml +++ b/reference/shmop/functions/shmop-delete.xml @@ -1,6 +1,6 @@ - + @@ -14,7 +14,9 @@ Shmopshmop - shmop_delete se utiliza para destruir un bloque de memoria compartida. + shmop_delete marca un bloque de memoria compartida para su + eliminación. El bloque solo se destruye cuando todos los procesos se han + desvinculado de él. @@ -38,6 +40,14 @@ + + &reftitle.errors; + + Si el bloque no puede marcarse para su eliminación, por ejemplo porque el + usuario actual no es su propietario, se emite un E_WARNING. + + + &reftitle.changelog; diff --git a/reference/shmop/functions/shmop-open.xml b/reference/shmop/functions/shmop-open.xml index 652d9c86d5..8348a96643 100644 --- a/reference/shmop/functions/shmop-open.xml +++ b/reference/shmop/functions/shmop-open.xml @@ -1,6 +1,6 @@ - + @@ -49,7 +49,7 @@ - "c" para creación (utiliza IPC_CREATE) + "c" para creación (utiliza IPC_CREAT) utilice esta opción para crear un nuevo bloque, o, si un segmento con el mismo identificador existe, intentar acceder a él en modo lectura y escritura. @@ -66,9 +66,9 @@ "n" crea un nuevo segmento de memoria compartida - (utiliza IPC_CREATE|IPC_EXCL). Utilice esta opción + (utiliza IPC_CREAT|IPC_EXCL). Utilice esta opción cuando se quiera crear un nuevo segmento de memoria - compartida a menos que ya exista uno corrupto con la + compartida, pero que falle si ya existe uno con la misma opción. Esto es muy útil por razones de seguridad, para evitar agujeros de seguridad que exploten la carrera por los recursos. @@ -115,8 +115,9 @@ &reftitle.errors; - Si mode es inválido, o si size es inferior o igual a cero, - se lanza una ValueError. + Si mode es inválido, o si size es inferior o igual a cero + para los modos "c" y "n", + se lanza una ValueError. En otros casos de fallo, se emite un E_WARNING. @@ -135,15 +136,16 @@ 8.0.0 - shmop ahora espera una instancia de Shmop - anteriormente se esperaba un resource. + En caso de éxito, esta función devuelve ahora una instancia de Shmop; + anteriormente se devolvía un resource. 8.0.0 - Si mode es inválido, o si size es inferior o igual a cero, - se lanza una ValueError; anteriormente, se emitía un E_WARNING en su lugar, + Si mode es inválido, o si size es inferior o igual a cero + para los modos "c" y "n", + se lanza una ValueError; anteriormente, se emitía un E_WARNING en su lugar, y la función devolvía &false;. diff --git a/reference/shmop/functions/shmop-write.xml b/reference/shmop/functions/shmop-write.xml index 81f185699f..61a659f109 100644 --- a/reference/shmop/functions/shmop-write.xml +++ b/reference/shmop/functions/shmop-write.xml @@ -1,6 +1,6 @@ - + @@ -62,8 +62,8 @@ &reftitle.errors; - Si offset está fuera de límite, o si un segmento de memoria compartida - de solo lectura debe ser escrito, se levanta una ValueError. + Si offset está fuera de rango, se lanza una ValueError. + Si el segmento de memoria compartida se abrió en modo solo lectura, se lanza un Error.