Pascal / BaseUnix / FpChown
FpAccess, FpAlarm, FpChdir, FpChmod, » FpChown, FpClose, FpClosedir, FpDup, FpDup2, FpExecv, FpExecve, FpExit, FpFcntl, pfdfillset, fpFD_CLR, fpFD_ISSET, fpFD_SET, fpFD_ZERO, FpFork, FPFStat, FpFtruncate, FpGetcwd, FpGetegid, FpGetEnv, fpgeterrno, FpGeteuid, FpGetgid, FpGetgroups, FpGetpgrp, FpGetpid, FpGetppid, fpGetPriority, FpGetuid, FpIOCtl, FpKill, FpLink, FpLseek, fpLstat, FpMkdir, FpMkfifo, Fpmmap, Fpmunmap, FpNanoSleep, fpNice, FpOpen, FpOpendir, FpPause, FpPipe, FpRead, FpReaddir, fpReadLink, FpRename, FpRmdir, fpSelect, fpseterrno, FpSetgid, fpSetPriority, FpSetsid, fpsettimeofday, FpSetuid,
Funcion: FpChown()
Sintaxis:
function FpChown(
 
  path: pChar;
 
  owner: TUid;
 
  group: TGid
 
):cInt;
 
function FpChow

Descripcion: Cambia el propietario de un archivo, define si User ID y Group ID de el archivo en el path a el Owner, Group.

Si la ejecucion de la funcion fue correcta, esta retorna zero. Si retorna un valor que no es zero, indica que ocurrio un error.

ERRORES:
sys_eaccess --> The requested access is denied, either to the file or one of the directories in its path.
sys_einval --> Mode was incorrect.
sys_enoent --> A directory component in Path doesn't exist or is a dangling symbolic link.
sys_enotdir --> A directory component in Path is not a directory.
sys_enomem --> Insufficient kernel memory.
sys_eloop --> Path has a circular symbolic link.

Ejemplo:
Program Example24;
 
{ Program to demonstrate the Chown function. }
 
Uses BaseUnix;
 
Var UID : TUid;
    GID : TGid;
    F : Text;
 
begin
 
  Writeln ('This will only work if you are root.');
  Write ('Enter a UID : ');readln(UID);
  Write ('Enter a GID : ');readln(GID);
  Assign (f,'test.txt');
  Rewrite (f);
  Writeln (f,'The owner of this file should become : ');
  Writeln (f,'UID : ',UID);
  Writeln (f,'GID : ',GID);
  Close (F);
  if fpChown ('test.txt',UID,GID)<>0 then
    if fpgeterrno=ESysEPERM then
      Writeln ('You are not root !')
    else
      Writeln ('Chmod failed with exit code : ',fpgeterrno)
  else
    Writeln ('Changed owner successfully !');
end.

Librerias Pascal

Libreria crt - CRT - Pantalla y teclado del PASCAL de Turbo que maneja la unidad
Libreria dos - DOS - Interface Turbo Pascal MS-DOS
Libreria Graph - Unidad para manipular los graficos de la pantalla compatible con TP
Libreria Objects - Objetos basicos compatible con TP
Libreria math - Rutinas adicionales matematicas
Libreria Printer - Provee de acceso a la impresora
Libreria strings - Rutinas para el manejo de cadenas
Libreria BaseUnix - Funcionalidad Basica de Linux
Libreria System - Manejo de Archivos - Funciones para la manipulacion de archivos en Pascal