Scroll to navigation

chdir(2) System Calls Manual chdir(2)

NOMBRE

chdir, fchdir - cambia el directorio de trabajo

BIBLIOTECA

Biblioteca Estándar C (libc, -lc)

SINOPSIS

#include <unistd.h>
int chdir(const char *path);
int fchdir(int fd);

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

fchdir():


_XOPEN_SOURCE >= 500
|| /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L
|| /* glibc up to and including 2.19: */ _BSD_SOURCE

DESCRIPCIÓN

chdir() changes the current working directory of the calling process to the directory specified in path.

fchdir() is identical to chdir(); the only difference is that the directory is given as an open file descriptor.

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

Depediendo del sistema de ficheros, se pueden devolver otros errores. Los errores más comunes para chdir() se listan a continuación:

Search permission is denied for one of the components of path. (See also path_resolution(7).)
path apunta fuera de su espacio de direcciones accesible.
Ocurrió un error de E/S.
Se han encontrado demasiados enlaces simbólicos al resolver path.
path es demasiado largo.
The directory specified in path does not exist.
No hay disponible suficiente memoria del núcleo.
Un componente del camino path no es un directorio.

Los errores más comunes para fchdir() se muestran a continuación:

Se ha denegado el permiso de búsqueda sobre el directorio abierto en fd.
fd no es un descriptor de archivo válido.
fd does not refer to a directory.

ESTÁNDARES

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

NOTAS

The current working directory is the starting point for interpreting relative pathnames (those not starting with '/').

A child process created via fork(2) inherits its parent's current working directory. The current working directory is left unchanged by execve(2).

VÉASE TAMBIÉN

chroot(2), getcwd(3), path_resolution(7)

TRADUCCIÓN

La traducción al español de esta página del manual fue creada por Miguel Angel Sepulveda <angel@vivaldi.princeton.edu>, Juan Piernas <piernas@ditec.um.es> y Miguel Pérez Ibars <mpi79470@alu.um.es>

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.

5 Febrero 2023 Páginas de manual de Linux 6.03