Provided by: manpages-es-dev_4.21.0-2_all bug

NOMBRE

       brk, sbrk - cambia el tamaño del segmento de datos

BIBLIOTECA

       Biblioteca Estándar C (libc, -lc)

SINOPSIS

       #include <unistd.h>

       int brk(void *direccón);
       void *sbrk(intptr_t incremento);

   Requisitos de Macros de Prueba de Características para glibc (véase feature_test_macros(7)):

       brk(), sbrk():
           A partir de glibc 2.19:
               _DEFAULT_SOURCE
                   || ((_XOPEN_SOURCE >= 500) &&
                       ! (_POSIX_C_SOURCE >= 200112L))
           Desde glibc 2.12 hasta glibc 2.19:
               _BSD_SOURCE || _SVID_SOURCE
                   || ((_XOPEN_SOURCE >= 500) &&
                       ! (_POSIX_C_SOURCE >= 200112L))
           Antes de glibc 2.12:
               _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500

DESCRIPCIÓN

       brk()   and sbrk()  change the location of the program break, which defines the end of the process's data
       segment (i.e., the program break is the first location after the end of the uninitialized data  segment).
       Increasing  the  program  break  has the effect of allocating memory to the process; decreasing the break
       deallocates memory.

       brk() establece el final del segmento de datos al valor especificado  por  addr,  cuando  este  valor  es
       razonable,  el  sistema  dispone de suficiente memoria y el proceso no excede su límite máximo para datos
       (véase setrlimit(2)).

       sbrk() aumenta el espacio de datos del programa en increment bytes. Se  puede  llamar  a  sbrk()  con  un
       increment  de  0  para  averiguar  la  dirección  actual  del comienzo de la zona de memoria dinámica del
       segumento de datos.

VALOR DEVUELTO

       En caso de éxito, brk() retorna cero. En caso de error se devuelve -1, y errno se define como ENOMEM.

       On success, sbrk()  returns the previous program break.  (If the break was increased, then this value  is
       a  pointer  to the start of the newly allocated memory).  On error, (void *) -1 is returned, and errno is
       set to ENOMEM.

ESTÁNDARES

       4.3BSD; SUSv1, marcado a extinguir en SUSv2, eliminado en POSIX.1-2001.

NOTAS

       Avoid using brk()  and sbrk(): the malloc(3)  memory allocation package is the portable  and  comfortable
       way of allocating memory.

       Various  systems  use  various  types  for  the  argument of sbrk().  Common are int, ssize_t, ptrdiff_t,
       intptr_t.

   Diferencias núcleo / biblioteca C
       The return value described above for brk()  is the behavior provided by the glibc  wrapper  function  for
       the  Linux brk()  system call.  (On most other implementations, the return value from brk()  is the same;
       this return value was also specified in SUSv2.)  However, the actual Linux system call  returns  the  new
       program  break  on  success.   On  failure, the system call returns the current break.  The glibc wrapper
       function does some work (i.e., checks whether the new break is less than addr)  to provide the 0  and  -1
       return values described above.

       On  Linux,  sbrk()   is implemented as a library function that uses the brk()  system call, and does some
       internal bookkeeping so that it can return the old break value.

VÉASE TAMBIÉN

       execve(2), getrlimit(2), end(3), malloc(3)

TRADUCCIÓN

       La  traducción  al  español  de  esta  página  del  manual  fue  creada  por   Miguel   Angel   Sepulveda
       <angel@vivaldi.princeton.edu>,  Gerardo Aburruzaga García <gerardo.aburruzaga@uca.es>, Miguel Pérez Ibars
       <mpi79470@alu.um.es> y Marcos Fouces <marcos@debian.org>

       Esta traducción es documentación libre;  lea  la  GNU General Public License Version 3  o  posterior  con
       respecto a las condiciones de copyright.  No existe NINGUNA RESPONSABILIDAD.

       Si  encuentra  algún  error  en  la  traducción  de esta página del manual, envíe un correo electrónico a
       debian-l10n-spanish@lists.debian.org.

Páginas de manual de Linux 6.03                 4 Diciembre 2022                                          brk(2)