bunxovl.inc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2002 by Marco van de Voort
  5. Some generic overloads for stringfunctions in the baseunix unit.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {$I textrec.inc}
  13. {$I filerec.inc}
  14. Function FpLink (existing : AnsiString; newone : AnsiString): cInt;
  15. Begin
  16. FpLink:=FpLink(pchar(existing),pchar(newone));
  17. End;
  18. Function FpMkfifo (path : AnsiString; Mode : TMode): cInt;
  19. Begin
  20. FpMkfifo:=FpMkfifo(pchar(path),mode);
  21. End;
  22. Function FpChmod (path : AnsiString; Mode : TMode): cInt;
  23. Begin
  24. FpChmod:=FpChmod(pchar(path),mode);
  25. End;
  26. Function FpChown (path : AnsiString; owner : TUid; group : TGid): cInt;
  27. Begin
  28. FpChown:=FpChown(pchar(path),owner,group);
  29. End;
  30. Function FpUtime (path : AnsiString; times : putimbuf): cInt;
  31. Begin
  32. FpUtime:=FpUtime(pchar(path),times);
  33. End;
  34. Function FpGetcwd (path:AnsiString; siz:TSize):AnsiString;
  35. Begin
  36. FpGetcwd:=FpGetcwd(pchar(path),siz);
  37. End;
  38. Function FpExecve (path : AnsiString; argv : ppchar; envp: ppchar): cInt;
  39. Begin
  40. FpExecve:=FpExecve (pchar(path),argv,envp);
  41. End;
  42. Function FpExecv (path : AnsiString; argv : ppchar): cInt;
  43. Begin
  44. FpExecv:=FpExecv (pchar(path),argv);
  45. End;
  46. Function FpOpendir (dirname : AnsiString): pDir;
  47. Begin
  48. FpOpenDir:=FpOpenDir(dirname);
  49. End;
  50. Function FpChdir (path : AnsiString): cInt;
  51. Begin
  52. FpChDir:=FpChdir(pchar(Path));
  53. End;
  54. Function FpOpen (path : AnsiString; flags : cInt; Mode: TMode):cInt;
  55. Begin
  56. FpOpen:=FpOpen(pchar(Path),flags,mode);
  57. End;
  58. Function FpMkdir (path : AnsiString; Mode: TMode):cInt;
  59. Begin
  60. FpMkdir:=FpMkdir(pchar(Path),mode);
  61. End;
  62. Function FpUnlink (path : AnsiString): cInt;
  63. Begin
  64. FpUnlink:=FpUnlink(pchar(path));
  65. End;
  66. Function FpRmdir (path : AnsiString): cInt;
  67. Begin
  68. FpRmdir:=FpRmdir(pchar(path));
  69. End;
  70. Function FpRename (old : AnsiString;newpath: AnsiString): cInt;
  71. Begin
  72. FpRename:=FpRename(pchar(old),pchar(newpath));
  73. End;
  74. Function FpStat (path: AnsiString; var buf : stat): cInt;
  75. begin
  76. FpStat:=FpStat(pchar(path),buf);
  77. End;
  78. Function FpAccess (pathname : AnsiString; aMode : cInt): cInt;
  79. Begin
  80. FpAccess:=FpAccess(pchar(pathname),amode);
  81. End;
  82. Function FPFStat(var F:Text;Var Info:stat):Boolean;
  83. {
  84. Get all information on a text file, and return it in info.
  85. }
  86. begin
  87. FPFStat:=FPFstat(TextRec(F).Handle,INfo)>0;
  88. end;
  89. Function FPFStat(var F:File;Var Info:stat):Boolean;
  90. {
  91. Get all information on a untyped file, and return it in info.
  92. }
  93. begin
  94. FPFStat:=FPFstat(FileRec(F).Handle,Info)>0;
  95. end;
  96. Function FpSignal(signum:longint;Handler:signalhandler):signalhandler;
  97. var sa,osa : sigactionrec;
  98. begin
  99. sa.sa_handler:=handler;
  100. FillChar(sa.sa_mask,sizeof(sigset),#0);
  101. sa.sa_flags := 0;
  102. { if (sigintr and signum) =0 then
  103. {restart behaviour needs libc}
  104. sa.sa_flags :=sa.sa_flags or SA_RESTART;
  105. }
  106. FPSigaction(signum,@sa,@osa);
  107. if getErrNo<>0 then
  108. fpsignal:=NIL
  109. else
  110. fpsignal:=osa.sa_handler;
  111. end;
  112. {
  113. $Log$
  114. Revision 1.2 2003-06-01 16:28:41 marco
  115. * Enhancements to make the compiler baseunix using.
  116. Revision 1.1 2002/12/18 16:49:02 marco
  117. * New RTL. Linux system unit and baseunix operational.
  118. }