unxfunc.inc 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by Michael Van Canneyt,
  5. member of the Free Pascal development team.
  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. Function AssignPipe(var pipe_in,pipe_out:cint):cint; [public, alias : 'FPC_SYSC_ASSIGNPIPE'];
  13. {
  14. Sets up a pair of file variables, which act as a pipe. The first one can
  15. be read from, the second one can be written to.
  16. If the operation was unsuccesful, linuxerror is set.
  17. }
  18. var
  19. pip : tpipe;
  20. begin
  21. {$ifdef FPC_USE_LIBC}
  22. assignpipe:=pipe(pip);
  23. {$else}
  24. assignPipe:=do_SysCall(SysCall_nr_pipe,TSysParam(@pip));
  25. {$endif}
  26. pipe_in:=pip[0];
  27. pipe_out:=pip[1];
  28. end;
  29. Function PClose(Var F:text) :cint;
  30. var
  31. pl : ^cint;
  32. res : cint;
  33. begin
  34. fpclose(Textrec(F).Handle);
  35. { closed our side, Now wait for the other - this appears to be needed ?? }
  36. pl:=@(textrec(f).userdata[2]);
  37. fpwaitpid(pl^,@res,0);
  38. pclose:=res shr 8;
  39. end;
  40. Function PClose(Var F:file) : cint;
  41. var
  42. pl : ^cint;
  43. res : cint;
  44. begin
  45. fpclose(filerec(F).Handle);
  46. { closed our side, Now wait for the other - this appears to be needed ?? }
  47. pl:=@(filerec(f).userdata[2]);
  48. fpwaitpid(pl^,@res,0);
  49. pclose:=res shr 8;
  50. end;
  51. {
  52. $Log$
  53. Revision 1.2 2005-02-14 17:13:30 peter
  54. * truncate log
  55. Revision 1.1 2005/02/13 21:47:56 peter
  56. * include file cleanup part 2
  57. Revision 1.1 2005/02/13 20:01:38 peter
  58. * include file cleanup
  59. }