summaryrefslogtreecommitdiff
path: root/rtl/freebsd/unxfunc.inc
diff options
context:
space:
mode:
Diffstat (limited to 'rtl/freebsd/unxfunc.inc')
-rw-r--r--rtl/freebsd/unxfunc.inc83
1 files changed, 83 insertions, 0 deletions
diff --git a/rtl/freebsd/unxfunc.inc b/rtl/freebsd/unxfunc.inc
new file mode 100644
index 0000000000..69a983f01a
--- /dev/null
+++ b/rtl/freebsd/unxfunc.inc
@@ -0,0 +1,83 @@
+{
+ $Id: unxfunc.inc,v 1.2 2005/02/14 17:13:22 peter Exp $
+ This file is part of the Free Pascal run time library.
+ Copyright (c) 2000 by Marco van de Voort
+ member of the Free Pascal development team.
+
+ See the file COPYING.FPC, included in this distribution,
+ for details about the copyright.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY;without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+**********************************************************************}
+
+{$ifndef HAS_LIBC_PIPING}
+Function PClose(Var F:file) : cint;
+var
+ pl : ^cint;
+ res : cint;
+
+begin
+ fpclose(filerec(F).Handle);
+{ closed our side, Now wait for the other - this appears to be needed ?? }
+ pl:=@(filerec(f).userdata[2]);
+ fpwaitpid(pl^,@res,0);
+ pclose:=res shr 8;
+end;
+
+Function PClose(Var F:text) :cint;
+var
+ pl : ^longint;
+ res : longint;
+
+begin
+ fpclose(Textrec(F).Handle);
+{ closed our side, Now wait for the other - this appears to be needed ?? }
+ pl:=@(textrec(f).userdata[2]);
+ fpwaitpid(pl^,@res,0);
+ pclose:=res shr 8;
+end;
+{$ENDIF}
+
+
+Function AssignPipe(var pipe_in,pipe_out:cint):cint; [public, alias : 'FPC_SYSC_ASSIGNPIPE'];
+{
+ Sets up a pair of file variables, which act as a pipe. The first one can
+ be read from, the second one can be written to.
+ If the operation was unsuccesful, linuxerror is set.
+}
+var
+ ret : longint;
+ errn : cint;
+ {$ifdef FPC_USE_LIBC}
+ fdis : array[0..1] of cint;
+ {$endif}
+begin
+{$ifndef FPC_USE_LIBC}
+ ret:=intAssignPipe(pipe_in,pipe_out,errn);
+ if ret=-1 Then
+ fpseterrno(errn);
+{$ELSE}
+ fdis[0]:=pipe_in;
+ fdis[1]:=pipe_out;
+ ret:=pipe(fdis);
+ pipe_in:=fdis[0];
+ pipe_out:=fdis[1];
+{$ENDIF}
+ AssignPipe:=ret;
+end;
+
+{
+ $Log: unxfunc.inc,v $
+ Revision 1.2 2005/02/14 17:13:22 peter
+ * truncate log
+
+ Revision 1.1 2005/02/13 21:47:56 peter
+ * include file cleanup part 2
+
+ Revision 1.1 2005/02/13 20:01:37 peter
+ * include file cleanup
+
+}