Provided by: manpages-es-dev_4.18.1-1_all bug

NOMBRE

       lockf - aplica, comprueba o elimina un bloqueo POSIX sobre un fichero abierto

BIBLIOTECA

       Biblioteca Estándar C (libc, -lc)

SINOPSIS

       #include <unistd.h>

       int lockf(int fd, int cmd, off_t len);

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

       lockf():
           _XOPEN_SOURCE >= 500
               || /* glibc >= 2.19: */ _DEFAULT_SOURCE
               || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE

DESCRIPCIÓN

       Apply,  test,  or remove a POSIX lock on a section of an open file.  The file is specified
       by fd, a file descriptor open for writing, the action by cmd, and the section consists  of
       byte  positions  pos..pos+len-1 if len is positive, and pos-len..pos-1 if len is negative,
       where pos is the current file position, and if len is zero, the section extends  from  the
       current  file  position  to  infinity,  encompassing  the  present  and future end-of-file
       positions.  In all cases, the section may extend past current end-of-file.

       On Linux, lockf()  is just an interface on top of fcntl(2)  locking.  Many  other  systems
       implement  lockf()   in  this  way,  but note that POSIX.1 leaves the relationship between
       lockf()  and fcntl(2)  locks unspecified.  A portable application  should  probably  avoid
       mixing calls to these interfaces.

       Las operaciones válidas son:

       F_LOCK Establece  un  bloqueo exclusivo en la sección especificada del fichero.  Si (parte
              de) esta sección ya está bloqueada, la llamada se  bloquea  hasta  que  el  bloqueo
              anterior  sea  liberado.   Si  esta  sección  se solapa con una sección previamente
              bloqueada, ambas se fusionan.  Los bloqueos sobre  el  fichero  son  liberados  tan
              pronto  como  el  proceso  que mantiene los bloqueos cierre algunos descriptores de
              fichero para el fichero.  Un proceso hijo no hereda estos bloqueos.

       F_TLOCK
              Igual que F_LOCK pero la llamada nunca se bloquea y devuelve un error en  su  lugar
              si el fichero ya está bloqueado.

       F_ULOCK
              Desbloquea  la  sección  indicada del fichero.  Ésto puede provocar que una sección
              bloqueada se divida en dos secciones bloqueadas.

       F_TEST Test the lock: return 0 if the specified section is  unlocked  or  locked  by  this
              process;  return -1, set errno to EAGAIN (EACCES on some other systems), if another
              process holds a lock.

VALOR DEVUELTO

       En caso de éxito se devuelve cero. En caso de error se devuelve -1, y errno  se  configura
       para indicar el error.

ERRORES

       EACCES o EAGAIN
              El  fichero  está  bloqueado  y  se  especificó  F_TLOCK  o F_TEST, o se prohibe la
              operación porque el fichero ha sido ubicado en memoria por otro proceso.

       EBADF  fd is not an open file descriptor; or cmd is F_LOCK or F_TLOCK  and  fd  is  not  a
              writable file descriptor.

       EDEADLK
              La  orden  fue  F_LOCK  y  esta  operación  de  bloqueo  causaría  una situación de
              interbloqueo.

       EINTR  While waiting to acquire a lock, the call was interrupted by delivery of  a  signal
              caught by a handler; see signal(7).

       EINVAL Se especificó una operación inválida en cmd.

       ENOLCK Demasiados bloqueos de segmento abiertos, la tabla de bloqueos está llena.

ATRIBUTOS

       Para obtener una explicación de los términos usados en esta sección, véase attributes(7).

       ┌────────────────────────────────────────────────┬────────────────────┬───────────────────┐
       │InterfazAtributoValor             │
       ├────────────────────────────────────────────────┼────────────────────┼───────────────────┤
       │lockf()                                         │ Seguridad del hilo │ Multi-hilo seguro │
       └────────────────────────────────────────────────┴────────────────────┴───────────────────┘

ESTÁNDARES

       POSIX.1-2001, POSIX.1-2008, SVr4.

VÉASE TAMBIÉN

       fcntl(2), flock(2)

       locks.txt    and    mandatory-locking.txt   in   the   Linux   kernel   source   directory
       Documentation/filesystems  (on  older  kernels,  these  files  are  directly   under   the
       Documentation directory, and mandatory-locking.txt is called mandatory.txt)

TRADUCCIÓN

       La  traducción  al  español  de  esta  página del manual fue creada por Miguel Pérez Ibars
       <mpi79470@alu.um.es>

       Esta traducción es documentación libre; lea  la  GNU  General  Public  License  Version  3
       ⟨https://www.gnu.org/licenses/gpl-3.0.html⟩  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⟩.