mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 18:09:30 +02:00
* first port that shows some life based on FPC_USE_LIBC
This commit is contained in:
parent
0db9132414
commit
21eb38dfc2
1380
rtl/openbsd/Makefile
Normal file
1380
rtl/openbsd/Makefile
Normal file
File diff suppressed because it is too large
Load Diff
237
rtl/openbsd/Makefile.fpc
Normal file
237
rtl/openbsd/Makefile.fpc
Normal file
@ -0,0 +1,237 @@
|
||||
#
|
||||
# Makefile.fpc for Free Pascal OpenBSD RTL
|
||||
#
|
||||
|
||||
[package]
|
||||
main=rtl
|
||||
|
||||
[install]
|
||||
fpcpackage=y
|
||||
|
||||
[target]
|
||||
loaders=prt0 cprt0
|
||||
units=$(SYSTEMUNIT) objpas strings syscall baseunix \
|
||||
$(LINUXUNIT) unix initc systhrds \
|
||||
dos crt objects printer \
|
||||
sysutils classes typinfo math varutils \
|
||||
charset ucomplex getopts heaptrc lineinfo \
|
||||
errors sockets gpm ipc terminfo \
|
||||
video mouse keyboard serial variants types systhrds sysctl sysconst
|
||||
units_netbsd_i386=mmx cpu
|
||||
rsts=math varutils typinfo variants classes sysconst
|
||||
|
||||
[require]
|
||||
nortl=y
|
||||
|
||||
[install]
|
||||
fpcpackage=y
|
||||
|
||||
[default]
|
||||
fpcdir=../..
|
||||
target=netbsd
|
||||
|
||||
[compiler]
|
||||
includedir=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(TARGETPROCINC)
|
||||
sourcedir=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC)
|
||||
targetdir=.
|
||||
|
||||
[lib]
|
||||
libname=libfprtl.so
|
||||
libversion=1.0
|
||||
libunits=$(SYSTEMUNIT) objpas strings \
|
||||
unix \
|
||||
dos crt objects printer \
|
||||
sysutils typinfo math \
|
||||
cpu mmx getopts heaptrc \
|
||||
errors sockets ipc
|
||||
|
||||
[prerules]
|
||||
RTL=..
|
||||
INC=$(RTL)/inc
|
||||
PROCINC=$(RTL)/$(CPU_TARGET)
|
||||
BSDINC=$(RTL)/bsd
|
||||
BSDPROCINC=$(BSDINC)/$(CPU_TARGET)
|
||||
UNIXINC=$(RTL)/unix
|
||||
UNITPREFIX=rtl
|
||||
TARGETPROCINC=$(RTL)/netbsd/$(CPU_TARGET)
|
||||
|
||||
ifeq ($(findstring 1.0.,$(FPC_VERSION)),)
|
||||
SYSTEMUNIT=system
|
||||
LINUXUNIT=
|
||||
PRT0=prt0
|
||||
else
|
||||
SYSTEMUNIT=sysbsd
|
||||
LINUXUNIT=
|
||||
override FPCOPT+=-dUNIX
|
||||
PRT0=prt0_10
|
||||
endif
|
||||
|
||||
# Use new feature from 1.0.5 version
|
||||
# that generates release PPU files
|
||||
# which will not be recompiled
|
||||
ifdef RELEASE
|
||||
override FPCOPT+=-Ur
|
||||
endif
|
||||
|
||||
# Paths
|
||||
OBJPASDIR=$(RTL)/objpas
|
||||
GRAPHDIR=$(INC)/graph
|
||||
|
||||
# Use new graph unit ?
|
||||
# NEWGRAPH=YES
|
||||
# Use LibGGI ?
|
||||
# Use
|
||||
#
|
||||
ifndef USELIBGGI
|
||||
USELIBGGI=NO
|
||||
endif
|
||||
|
||||
|
||||
[rules]
|
||||
# Get the system independent include file names.
|
||||
# This will set the following variables :
|
||||
# SYSINCNAMES
|
||||
include $(INC)/makefile.inc
|
||||
SYSINCDEPS=$(addprefix $(INC)/,$(SYSINCNAMES))
|
||||
|
||||
# Get the processor dependent include file names.
|
||||
# This will set the following variables :
|
||||
# CPUINCNAMES
|
||||
include $(PROCINC)/makefile.cpu
|
||||
SYSCPUDEPS=$(addprefix $(PROCINC)/,$(CPUINCNAMES))
|
||||
|
||||
# Put system unit dependencies together.
|
||||
SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
|
||||
|
||||
|
||||
#
|
||||
# Loaders
|
||||
#
|
||||
|
||||
prt0$(OEXT) : $(CPU_TARGET)/$(PRT0).as
|
||||
$(AS) -o prt0$(OEXT) $(CPU_TARGET)/$(PRT0).as
|
||||
|
||||
cprt0$(OEXT) : $(CPU_TARGET)/cprt0.as
|
||||
$(AS) -o cprt0$(OEXT) $(CPU_TARGET)/cprt0.as
|
||||
|
||||
#
|
||||
# System Units (System, Objpas, Strings)
|
||||
#
|
||||
|
||||
$(SYSTEMUNIT)$(PPUEXT) : $(BSDINC)/$(SYSTEMUNIT).pp sysconst.inc systypes.inc syscalls.inc $(SYSDEPS)
|
||||
$(COMPILER) -Us -Sg $(BSDINC)/$(SYSTEMUNIT).pp
|
||||
|
||||
objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp
|
||||
|
||||
strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
|
||||
$(PROCINC)/strings.inc $(PROCINC)/stringss.inc\
|
||||
$(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
#
|
||||
# System Dependent Units
|
||||
#
|
||||
|
||||
baseunix$(PPUEXT) : errno.inc $(BSDINC)/bunxtype.inc ptypes.inc $(BSDINC)/ctypes.inc \
|
||||
signal.inc $(UNIXINC)/bunxh.inc $(BSDINC)/bunxmain.inc $(BSDINC)/ostypes.inc \
|
||||
$(BSDINC)/bunxfunc.inc $(BSDPROCINC)/syscallh.inc sysnr.inc \
|
||||
$(BSDINC)/ostypes.inc $(BSDINC)/ossysch.inc $(BSDINC)/bunxmacr.inc $(UNIXINC)/gensigset.inc \
|
||||
$(UNIXINC)/genfuncs.inc $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
|
||||
unix$(PPUEXT) : $(UNIXINC)/unix.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
|
||||
syscalls.inc systypes.inc sysconst.inc $(UNIXINC)/timezone.inc \
|
||||
unixsysc.inc baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
|
||||
#
|
||||
# TP7 Compatible RTL Units
|
||||
#
|
||||
|
||||
dos$(PPUEXT) : $(UNIXINC)/dos.pp $(INC)/filerec.inc $(INC)/textrec.inc strings$(PPUEXT) \
|
||||
unix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
crt$(PPUEXT) : $(UNIXINC)/crt.pp $(INC)/textrec.inc unix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
objects$(PPUEXT) : $(INC)/objects.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
printer$(PPUEXT) : $(UNIXINC)/printer.pp $(INC)/textrec.inc unix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
#
|
||||
# Graph
|
||||
#
|
||||
|
||||
#
|
||||
# Delphi Compatible Units
|
||||
#
|
||||
|
||||
sysutils$(PPUEXT) : $(UNIXINC)/sysutils.pp $(wildcard $(OBJPASDIR)/sysutils/*.inc) \
|
||||
objpas$(PPUEXT) unix$(PPUEXT) errors$(PPUEXT) sysconst$(PPUEXT)
|
||||
$(COMPILER) -Fi$(OBJPASDIR)/sysutils $(UNIXINC)/sysutils.pp
|
||||
|
||||
classes$(PPUEXT) : classes.pp $(wildcard $(OBJPASDIR)/classes/*.inc) \
|
||||
sysutils$(PPUEXT) typinfo$(PPUEXT)
|
||||
$(COMPILER) -Fi$(OBJPASDIR)/classes classes.pp
|
||||
|
||||
typinfo$(PPUEXT): $(OBJPASDIR)/typinfo.pp objpas$(PPUEXT)
|
||||
$(COMPILER) -Sg $(OBJPASDIR)/typinfo.pp
|
||||
|
||||
math$(PPUEXT): $(OBJPASDIR)/math.pp objpas$(PPUEXT) sysutils$(PPUEXT)
|
||||
$(COMPILER) $(OBJPASDIR)/math.pp
|
||||
|
||||
gettext$(PPUEXT): $(OBJPASDIR)/gettext.pp objpas$(PPUEXT) sysutils$(PPUEXT)
|
||||
$(COMPILER) $(OBJPASDIR)/gettext.pp
|
||||
|
||||
varutils$(PPUEXT) : $(OBJPASDIR)/cvarutil.inc $(OBJPASDIR)/varutils.inc \
|
||||
$(OBJPASDIR)/varutilh.inc varutils.pp
|
||||
$(COMPILER) -I$(OBJPASDIR) $(UNIXINC)/varutils.pp
|
||||
|
||||
types$(PPUEXT) : $(OBJPASDIR/types.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $(OBJPASDIR)/types.pp
|
||||
|
||||
#
|
||||
# Other system-independent RTL Units
|
||||
#
|
||||
|
||||
cpu$(PPUEXT) : $(PROCINC)/cpu.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
mmx$(PPUEXT) : $(PROCINC)/mmx.pp cpu$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
getopts$(PPUEXT) : $(INC)/getopts.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
heaptrc$(PPUEXT) : $(INC)/heaptrc.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) -Sg $(INC)/heaptrc.pp
|
||||
|
||||
lineinfo$(PPUEXT) : $(INC)/lineinfo.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
charset$(PPUEXT) : $(INC)/charset.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
ucomplex$(PPUEXT) : $(INC)/ucomplex.pp math$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
#
|
||||
# Other system-dependent RTL Units
|
||||
#
|
||||
|
||||
sockets$(PPUEXT) : $(UNIXINC)/sockets.pp $(INC)/textrec.inc $(INC)/filerec.inc \
|
||||
unix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
errors$(PPUEXT) : $(UNIXINC)/errors.pp strings$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
ipc$(PPUEXT) : $(UNIXINC)/ipc.pp unix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
terminfo$(PPUEXT) : terminfo.pp unix$(PPUEXT)
|
||||
|
||||
callspec$(PPUEXT) : $(INC)/callspec.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
sysctl$(PPUEXT) : $(BSDINC)/sysctl.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
syscall$(PPUEXT) : $(UNIXINC)/syscall.pp
|
||||
|
||||
sysconst$(PPUEXT) : $(OBJPASDIR)/sysconst.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $(OBJPASDIR)/sysconst.pp
|
||||
|
||||
cthreads$(PPUEXT) : $(UNIXINC)/cthreads.pp systhrds$(PPUEXT)
|
||||
|
||||
rtlconst$(PPUEXT) : $(OBJPASDIR)/rtlconst.pp
|
||||
$(COMPILER): $(OBJPASDIR)/rtlconst.pp
|
||||
|
150
rtl/openbsd/errno.inc
Normal file
150
rtl/openbsd/errno.inc
Normal file
@ -0,0 +1,150 @@
|
||||
{
|
||||
$Id$
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 1999-2000 by Michael Van Canneyt,
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
{
|
||||
|
||||
Errno.inc : define all error numbers, kernel version 1.2.13
|
||||
|
||||
}
|
||||
Const
|
||||
|
||||
|
||||
ESysEPERM = 1; { Operation not permitted }
|
||||
ESysENOENT = 2; { No such file or directory }
|
||||
ESysESRCH = 3; { No such process }
|
||||
ESysEINTR = 4; { Interrupted system call }
|
||||
ESysEIO = 5; { Input/output error }
|
||||
ESysENXIO = 6; { Device not configured }
|
||||
ESysE2BIG = 7; { Argument list too long }
|
||||
ESysENOEXEC = 8; { Exec format error }
|
||||
ESysEBADF = 9; { Bad file descriptor }
|
||||
ESysECHILD = 10; { No child processes }
|
||||
ESysEDEADLK = 11; { Resource deadlock avoided }
|
||||
{ 11 was EAGAIN }
|
||||
ESysENOMEM = 12; { Cannot allocate memory }
|
||||
ESysEACCES = 13; { Permission denied }
|
||||
ESysEFAULT = 14; { Bad address }
|
||||
ESysENOTBLK = 15; { Block device required }
|
||||
ESysEBUSY = 16; { Device busy }
|
||||
ESysEEXIST = 17; { File exists }
|
||||
ESysEXDEV = 18; { Cross-device link }
|
||||
ESysENODEV = 19; { Operation not supported by device }
|
||||
ESysENOTDIR = 20; { Not a directory }
|
||||
ESysEISDIR = 21; { Is a directory }
|
||||
ESysEINVAL = 22; { Invalid argument }
|
||||
ESysENFILE = 23; { Too many open files in system }
|
||||
ESysEMFILE = 24; { Too many open files }
|
||||
ESysENOTTY = 25; { Inappropriate ioctl for device }
|
||||
ESysETXTBSY = 26; { Text file busy }
|
||||
ESysEFBIG = 27; { File too large }
|
||||
ESysENOSPC = 28; { No space left on device }
|
||||
ESysESPIPE = 29; { Illegal seek }
|
||||
ESysEROFS = 30; { Read-only file system }
|
||||
ESysEMLINK = 31; { Too many links }
|
||||
ESysEPIPE = 32; { Broken pipe }
|
||||
|
||||
{ math software }
|
||||
ESysEDOM = 33; { Numerical argument out of domain }
|
||||
ESysERANGE = 34; { Result too large }
|
||||
|
||||
{ non-blocking and interrupt i/o }
|
||||
ESysEAGAIN = 35; { Resource temporarily unavailable }
|
||||
ESysEWOULDBLOCK = ESysEAGAIN; { Operation would block }
|
||||
ESysEINPROGRESS = 36; { Operation now in progress }
|
||||
ESysEALREADY = 37; { Operation already in progress }
|
||||
|
||||
{ ipc/network software - - argument errors }
|
||||
ESysENOTSOCK = 38; { Socket operation on non-socket }
|
||||
ESysEDESTADDRREQ = 39; { Destination address required }
|
||||
ESysEMSGSIZE = 40; { Message too long }
|
||||
ESysEPROTOTYPE = 41; { Protocol wrong type for socket }
|
||||
ESysENOPROTOOPT = 42; { Protocol not available }
|
||||
ESysEPROTONOSUPPORT = 43; { Protocol not supported }
|
||||
ESysESOCKTNOSUPPORT = 44; { Socket type not supported }
|
||||
ESysEOPNOTSUPP = 45; { Operation not supported }
|
||||
ESysENOTSUP = ESysEOPNOTSUPP; { Operation not supported }
|
||||
ESysEPFNOSUPPORT = 46; { Protocol family not supported }
|
||||
ESysEAFNOSUPPORT = 47; { Address family not supported by protocol family }
|
||||
ESysEADDRINUSE = 48; { Address already in use }
|
||||
ESysEADDRNOTAVAIL = 49; { Can't assign requested address }
|
||||
|
||||
{ ipc/network software - - operational errors }
|
||||
ESysENETDOWN = 50; { Network is down }
|
||||
ESysENETUNREACH = 51; { Network is unreachable }
|
||||
ESysENETRESET = 52; { Network dropped connection on reset }
|
||||
ESysECONNABORTED = 53; { Software caused connection abort }
|
||||
ESysECONNRESET = 54; { Connection reset by peer }
|
||||
ESysENOBUFS = 55; { No buffer space available }
|
||||
ESysEISCONN = 56; { Socket is already connected }
|
||||
ESysENOTCONN = 57; { Socket is not connected }
|
||||
ESysESHUTDOWN = 58; { Can't send after socket shutdown }
|
||||
ESysETOOMANYREFS = 59; { Too many references: can't splice }
|
||||
ESysETIMEDOUT = 60; { Operation timed out }
|
||||
ESysECONNREFUSED = 61; { Connection refused }
|
||||
|
||||
ESysELOOP = 62; { Too many levels of symbolic links }
|
||||
ESysENAMETOOLONG = 63; { File name too long }
|
||||
|
||||
{ should be rearranged }
|
||||
ESysEHOSTDOWN = 64; { Host is down }
|
||||
ESysEHOSTUNREACH = 65; { No route to host }
|
||||
ESysENOTEMPTY = 66; { Directory not empty }
|
||||
|
||||
{ quotas & mush }
|
||||
ESysEPROCLIM = 67; { Too many processes }
|
||||
ESysEUSERS = 68; { Too many users }
|
||||
ESysEDQUOT = 69; { Disc quota exceeded }
|
||||
|
||||
{ Network File System }
|
||||
ESysESTALE = 70; { Stale NFS file handle }
|
||||
ESysEREMOTE = 71; { Too many levels of remote in path }
|
||||
ESysEBADRPC = 72; { RPC struct is bad }
|
||||
ESysERPCMISMATCH = 73; { RPC version wrong }
|
||||
ESysEPROGUNAVAIL = 74; { RPC prog. not avail }
|
||||
ESysEPROGMISMATCH = 75; { Program version wrong }
|
||||
ESysEPROCUNAVAIL = 76; { Bad procedure for program }
|
||||
|
||||
ESysENOLCK = 77; { No locks available }
|
||||
ESysENOSYS = 78; { Function not implemented }
|
||||
|
||||
ESysEFTYPE = 79; { Inappropriate file type or format }
|
||||
ESysEAUTH = 80; { Authentication error }
|
||||
ESysENEEDAUTH = 81; { Need authenticator }
|
||||
ESysEIDRM = 82; { Identifier removed }
|
||||
ESysENOMSG = 83; { No message of desired type }
|
||||
ESysEOVERFLOW = 84; { Value too large to be stored in data type }
|
||||
ESysECANCELED = 85; { Operation canceled }
|
||||
ESysEILSEQ = 86; { Illegal byte sequence }
|
||||
ESysELAST = 86; { Must be equal largest errno }
|
||||
|
||||
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 2004-01-22 13:55:02 marco
|
||||
* first port that shows some life based on FPC_USE_LIBC
|
||||
|
||||
Revision 1.1 2003/06/01 16:35:28 marco
|
||||
* Several small fixes to harmonize the *BSD rtls and Linux.
|
||||
|
||||
Revision 1.4 2003/01/21 14:03:03 marco
|
||||
* Hmm, still was linux version in 1.1?
|
||||
|
||||
Revision 1.3 2003/01/03 00:06:39 marco
|
||||
* Fixed
|
||||
|
||||
Revision 1.2 2002/09/07 16:01:17 peter
|
||||
* old logs removed and tabs fixed
|
||||
|
||||
}
|
195
rtl/openbsd/signal.inc
Normal file
195
rtl/openbsd/signal.inc
Normal file
@ -0,0 +1,195 @@
|
||||
{
|
||||
$Id$
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 1999-2000 by Jonas Maebe,
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
|
||||
Const { For sending a signal }
|
||||
|
||||
SA_NOCLDSTOP = 8;
|
||||
SA_ONSTACK = $001; { take signal on signal stack }
|
||||
SA_RESTART = $002; { restart system call on signal return }
|
||||
SA_RESETHAND = $004; { reset to SIG_DFL when taking signal }
|
||||
SA_NODEFER = $010; { don't mask the signal we're delivering }
|
||||
SA_NOCLDWAIT = $020; { don't keep zombies around }
|
||||
SA_SIGINFO = $040; { signal handler with SA_SIGINFO args }
|
||||
SA_USERTRAMP = $100; { SUNOS compat: Do not bounce off kernel's sigtramp }
|
||||
|
||||
SIG_BLOCK = 1;
|
||||
SIG_UNBLOCK = 2;
|
||||
SIG_SETMASK = 3;
|
||||
|
||||
{BSD Checked}
|
||||
SIG_DFL = 0 ;
|
||||
SIG_IGN = 1 ;
|
||||
SIG_ERR = -1 ;
|
||||
|
||||
SIGHUP = 1;
|
||||
SIGINT = 2;
|
||||
SIGQUIT = 3;
|
||||
SIGILL = 4;
|
||||
SIGTRAP = 5;
|
||||
SIGABRT = 6;
|
||||
SIGIOT = 6;
|
||||
SIGEMT = 7;
|
||||
SIGFPE = 8;
|
||||
SIGKILL = 9;
|
||||
SIGBUS = 10;
|
||||
SIGSEGV = 11;
|
||||
SIGSYS = 12;
|
||||
SIGPIPE = 13;
|
||||
SIGALRM = 14;
|
||||
SIGTERM = 15;
|
||||
SIGURG = 16;
|
||||
SIGSTOP = 17;
|
||||
SIGTSTP = 18;
|
||||
SIGCONT = 19;
|
||||
SIGCHLD = 20;
|
||||
SIGTTIN = 21;
|
||||
SIGTTOU = 22;
|
||||
SIGIO = 23;
|
||||
SIGXCPU = 24;
|
||||
SIGXFSZ = 25;
|
||||
SIGVTALRM = 26;
|
||||
SIGPROF = 27;
|
||||
SIGWINCH = 28;
|
||||
SIGINFO = 29;
|
||||
SIGUSR1 = 30;
|
||||
SIGUSR2 = 31;
|
||||
|
||||
|
||||
{$packrecords C}
|
||||
const
|
||||
SI_PAD_SIZE = ((128/sizeof(longint)) - 3);
|
||||
|
||||
{
|
||||
* The sequence of the fields/registers in struct sigcontext should match
|
||||
* those in mcontext_t.
|
||||
}
|
||||
|
||||
type sigset_t = array[0..3] of cardinal;
|
||||
|
||||
PSigContextRec = ^SigContextRec;
|
||||
SigContextRec = record
|
||||
sc_mask : sigset_t; { signal mask to restore }
|
||||
sc_onstack : longint; { sigstack state to restore }
|
||||
|
||||
sc_gs : longint; { machine state (struct trapframe): }
|
||||
sc_fs : longint;
|
||||
sc_es : longint;
|
||||
sc_ds : longint;
|
||||
sc_edi : longint;
|
||||
sc_esi : longint;
|
||||
sc_ebp : longint;
|
||||
sc_isp : longint;
|
||||
sc_ebx : longint;
|
||||
sc_edx : longint;
|
||||
sc_ecx : longint;
|
||||
sc_eax : longint;
|
||||
sc_trapno : longint;
|
||||
sc_err : longint;
|
||||
sc_eip : longint;
|
||||
sc_cs : longint;
|
||||
sc_efl : longint;
|
||||
sc_esp : longint;
|
||||
sc_ss : longint;
|
||||
{
|
||||
* XXX FPU state is 27 * 4 bytes h/w, 1 * 4 bytes s/w (probably not
|
||||
* needed here), or that + 16 * 4 bytes for emulators (probably all
|
||||
* needed here). The "spare" bytes are mostly not spare.
|
||||
}
|
||||
en_cw : cardinal; { control word (16bits used) }
|
||||
en_sw : cardinal; { status word (16bits) }
|
||||
en_tw : cardinal; { tag word (16bits) }
|
||||
en_fip : cardinal; { floating point instruction pointer }
|
||||
en_fcs : word; { floating code segment selector }
|
||||
en_opcode : word; { opcode last executed (11 bits ) }
|
||||
en_foo : cardinal; { floating operand offset }
|
||||
en_fos : cardinal; { floating operand segment selector }
|
||||
fpr_acc : array[0..79] of char;
|
||||
fpr_ex_sw : cardinal;
|
||||
fpr_pad : array[0..63] of char;
|
||||
end;
|
||||
|
||||
SignalHandler = Procedure(Sig : Longint);cdecl;
|
||||
PSignalHandler = ^SignalHandler;
|
||||
SignalRestorer = Procedure;cdecl;
|
||||
PSignalRestorer = ^SignalRestorer;
|
||||
|
||||
{$ifdef powerpc}
|
||||
TSigaction= procedure(Sig: Longint); cdecl;
|
||||
{$else}
|
||||
{$define BSDHandler}
|
||||
{$ifdef BSDHandler}
|
||||
TSigAction = procedure(Sig: Longint; code:longint;var SigContext: SigContextRec);cdecl;
|
||||
{$else}
|
||||
TSigAction = procedure(Sig: Longint; var sininfo:tsiginfo_t;var SigContext: SigContextRec);cdecl;
|
||||
{$endif}
|
||||
{$endif}
|
||||
|
||||
Sigset=sigset_t;
|
||||
TSigset=sigset_t;
|
||||
PSigSet = ^SigSet;
|
||||
|
||||
SigActionRec = packed record
|
||||
// Handler : record
|
||||
sa_handler : TSigAction;
|
||||
// case byte of
|
||||
// 0: (Sh: SignalHandler);
|
||||
// 1: (Sa: TSigAction);
|
||||
// end;
|
||||
Sa_Flags : Longint;
|
||||
Sa_Mask : SigSet;
|
||||
end;
|
||||
|
||||
PSigActionRec = ^SigActionRec;
|
||||
|
||||
{
|
||||
Change action of process upon receipt of a signal.
|
||||
Signum specifies the signal (all except SigKill and SigStop).
|
||||
If Act is non-nil, it is used to specify the new action.
|
||||
If OldAct is non-nil the previous action is saved there.
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 2004-01-22 13:55:02 marco
|
||||
* first port that shows some life based on FPC_USE_LIBC
|
||||
|
||||
Revision 1.4 2004/01/04 15:55:47 marco
|
||||
* additions
|
||||
|
||||
Revision 1.3 2004/01/04 01:11:28 marco
|
||||
* a new qod port of the freebsd rtl. To be refined in the coming days.
|
||||
|
||||
Revision 1.2 2003/01/21 15:39:45 marco
|
||||
* NetBSD first rtl. Still not 100%, but close
|
||||
|
||||
Revision 1.1.2.1 2001/08/10 11:07:17 pierre
|
||||
New NetBSD files taken and adapted from FreeBSD
|
||||
|
||||
Revision 1.1.2.1 2000/09/16 11:19:08 marco
|
||||
* Moved files from BSD to FreeBSD directory, with some small changes
|
||||
|
||||
Revision 1.1.2.1 2000/09/10 16:18:41 marco
|
||||
initial version
|
||||
|
||||
Revision 1.2 2000/03/31 23:11:23 pierre
|
||||
* TSigAction Context param is the full record not a pointer
|
||||
|
||||
Revision 1.1 2000/03/31 13:24:28 jonas
|
||||
* signal handling using sigaction when compiled with -dnewsignal
|
||||
(allows multiple signals to be received in one run)
|
||||
|
||||
}
|
124
rtl/openbsd/syscalls.inc
Normal file
124
rtl/openbsd/syscalls.inc
Normal file
@ -0,0 +1,124 @@
|
||||
{
|
||||
$Id$
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 1999-2000 by Michael Van Canneyt,
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 2004-01-22 13:55:02 marco
|
||||
* first port that shows some life based on FPC_USE_LIBC
|
||||
|
||||
Revision 1.8 2004/01/04 01:11:28 marco
|
||||
* a new qod port of the freebsd rtl. To be refined in the coming days.
|
||||
|
||||
Revision 1.7 2003/10/17 20:57:10 olle
|
||||
* Changed m68k to cpum68k, i386 to cpui386
|
||||
|
||||
Revision 1.6 2003/08/21 22:22:11 olle
|
||||
- removed parameter from fpc_iocheck
|
||||
|
||||
Revision 1.5 2003/05/30 19:58:40 marco
|
||||
* Getting NetBSD/i386 to compile.
|
||||
|
||||
Revision 1.3 2003/01/21 15:39:45 marco
|
||||
* NetBSD first rtl. Still not 100%, but close
|
||||
|
||||
Revision 1.2 2003/01/17 22:13:47 marco
|
||||
* some updates
|
||||
|
||||
Revision 1.1.2.4 2002/09/20 07:04:44 pierre
|
||||
* avoid compiler warning
|
||||
|
||||
Revision 1.1.2.3 2002/01/23 09:10:05 marco
|
||||
* Similar truncate test. truncate tests from testsuite now seem to pass
|
||||
|
||||
Revision 1.1.2.2 2001/08/29 09:43:07 marco
|
||||
* first lseek fix. Still not 100%, but don't know exact problem yet.
|
||||
|
||||
Revision 1.1.2.1 2001/08/14 20:22:53 pierre
|
||||
New file
|
||||
|
||||
Revision 1.1.2.7 2001/04/04 10:38:36 marco
|
||||
* Small fix to readdir. Is this *the* bug?
|
||||
|
||||
Revision 1.1.2.6 2001/03/14 17:19:10 marco
|
||||
* Readdir compiles (some conflicts in Linux). Untested. Use NewReaddir to enable
|
||||
|
||||
Revision 1.1.2.5 2001/03/12 20:37:50 marco
|
||||
* [Solaris] Now cycles for FreeBSD (wrong version Linux unit commited)
|
||||
|
||||
Revision 1.1.2.4 2001/03/12 14:57:38 marco
|
||||
* [solaris] added some sys functions to decrease amount of ifdefs needed
|
||||
|
||||
Revision 1.1.2.3 2000/09/19 09:58:49 marco
|
||||
* Mkdir fix
|
||||
|
||||
Revision 1.1.2.2 2000/09/18 12:14:41 marco
|
||||
* An addw in the do_syscall(integer) caused warnings. Fixed
|
||||
|
||||
Revision 1.1.2.1 2000/09/16 11:19:08 marco
|
||||
* Moved files from BSD to FreeBSD directory, with some small changes
|
||||
|
||||
Revision 1.1.2.1 2000/09/10 16:12:14 marco
|
||||
Initial signals, sockets and clone
|
||||
|
||||
Revision 1.1 2000/07/13 06:30:32 michael
|
||||
+ Initial import
|
||||
|
||||
Revision 1.15 2000/04/16 16:08:53 marco
|
||||
* Fixes (mainly opendir/Readdir/closedir)
|
||||
|
||||
Revision 1.14 2000/04/14 17:04:13 marco
|
||||
* Working!
|
||||
|
||||
Revision 1.13 2000/04/10 15:46:52 marco
|
||||
* worked all day. probably a lot changed
|
||||
|
||||
Revision 1.11 2000/04/05 13:58:40 marco
|
||||
* syscall variablenames reintroduced.
|
||||
|
||||
Revision 1.10 2000/03/16 16:18:12 marco
|
||||
* Last changes before next test. ppc386 -h works with these srcs.
|
||||
|
||||
Revision 1.9 2000/03/02 15:34:07 marco
|
||||
* added a syscall for 5 longints
|
||||
|
||||
Revision 1.8 2000/03/01 20:03:57 marco
|
||||
* small fixes for syslinux
|
||||
|
||||
Revision 1.7 2000/03/01 17:28:40 marco
|
||||
* some changes due to updating linux.pp to new syscall
|
||||
|
||||
Revision 1.6 2000/02/27 23:45:39 marco
|
||||
* Redone the syscalls
|
||||
|
||||
Revision 1.5 2000/02/04 16:53:26 marco
|
||||
* Finished Linux (and rest syscalls) roughly. Some things still need to be
|
||||
tested, and checked (off_t calls specially)
|
||||
|
||||
Revision 1.4 2000/02/03 17:04:47 marco
|
||||
* additions fixes due to port linux
|
||||
|
||||
Revision 1.3 2000/02/02 18:07:27 marco
|
||||
* Ported except for readdir which is 200 lines C code in FBSD linux
|
||||
emulator
|
||||
|
||||
Revision 1.2 2000/02/02 16:35:10 marco
|
||||
* Ported more functions. Half done now.
|
||||
|
||||
Revision 1.1 2000/02/02 15:41:56 marco
|
||||
* Initial BSD version. Still needs a lot of work.
|
||||
|
||||
}
|
157
rtl/openbsd/sysconst.inc
Normal file
157
rtl/openbsd/sysconst.inc
Normal file
@ -0,0 +1,157 @@
|
||||
{
|
||||
$Id$
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 1999-2000 by Michael Van Canneyt,
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
{BSD version, only the blocks with BSD in the comment are updated}
|
||||
|
||||
const
|
||||
{ For getting/setting priority }
|
||||
Prio_Process = 0;
|
||||
Prio_PGrp = 1;
|
||||
Prio_User = 2;
|
||||
|
||||
{ Things for LSEEK call, same in linux and BSD }
|
||||
Seek_set = 0;
|
||||
Seek_Cur = 1;
|
||||
Seek_End = 2;
|
||||
{ Things for OPEN call - after include/sys/fcntl.h, BSD updated.
|
||||
BSD specifies these constants in hex }
|
||||
Open_Accmode = 3;
|
||||
Open_RdOnly = 0;
|
||||
Open_WrOnly = 1;
|
||||
Open_RdWr = 2;
|
||||
Open_NonBlock = 4;
|
||||
Open_Append = 8;
|
||||
Open_ShLock = $10;
|
||||
Open_ExLock = $20;
|
||||
Open_ASync = $40;
|
||||
Open_FSync = $80;
|
||||
Open_NoFollow = $100;
|
||||
Open_Create = $200; {BSD convention}
|
||||
Open_Creat = $200; {Linux convention}
|
||||
Open_Trunc = $400;
|
||||
Open_Excl = $800;
|
||||
Open_NOCTTY = $8000;
|
||||
|
||||
{ The waitpid uses the following options:}
|
||||
Wait_NoHang = 1;
|
||||
Wait_UnTraced = 2;
|
||||
Wait_Any = -1;
|
||||
Wait_MyPGRP = 0;
|
||||
{ Constants to check stat.mode - checked all STAT constants with BSD}
|
||||
STAT_IFMT = $f000; {00170000 }
|
||||
STAT_IFSOCK = $c000; {0140000 }
|
||||
STAT_IFLNK = $a000; {0120000 }
|
||||
STAT_IFREG = $8000; {0100000 }
|
||||
STAT_IFBLK = $6000; {0060000 }
|
||||
STAT_IFDIR = $4000; {0040000 }
|
||||
STAT_IFCHR = $2000; {0020000 }
|
||||
STAT_IFIFO = $1000; {0010000 }
|
||||
STAT_ISUID = $0800; {0004000 }
|
||||
STAT_ISGID = $0400; {0002000 }
|
||||
STAT_ISVTX = $0200; {0001000}
|
||||
{ Constants to check permissions all }
|
||||
STAT_IRWXO = $7;
|
||||
STAT_IROTH = $4;
|
||||
STAT_IWOTH = $2;
|
||||
STAT_IXOTH = $1;
|
||||
|
||||
STAT_IRWXG = STAT_IRWXO shl 3;
|
||||
STAT_IRGRP = STAT_IROTH shl 3;
|
||||
STAT_IWGRP = STAT_IWOTH shl 3;
|
||||
STAT_IXGRP = STAT_IXOTH shl 3;
|
||||
|
||||
STAT_IRWXU = STAT_IRWXO shl 6;
|
||||
STAT_IRUSR = STAT_IROTH shl 6;
|
||||
STAT_IWUSR = STAT_IWOTH shl 6;
|
||||
STAT_IXUSR = STAT_IXOTH shl 6;
|
||||
|
||||
{ Constants to test the type of filesystem }
|
||||
fs_old_ext2 = $ef51;
|
||||
fs_ext2 = $ef53;
|
||||
fs_ext = $137d;
|
||||
fs_iso = $9660;
|
||||
fs_minix = $137f;
|
||||
fs_minix_30 = $138f;
|
||||
fs_minux_V2 = $2468;
|
||||
fs_msdos = $4d44;
|
||||
fs_nfs = $6969;
|
||||
fs_proc = $9fa0;
|
||||
fs_xia = $012FD16D;
|
||||
|
||||
{ Constansts for MMAP }
|
||||
MAP_PRIVATE =2;
|
||||
MAP_ANONYMOUS =$1000;
|
||||
|
||||
{Constansts Termios/Ioctl (used in Do_IsDevice) }
|
||||
IOCtl_TCGETS=$5401; // TCGETS is also in termios.inc, but the sysunix needs only this
|
||||
|
||||
// a type, and a wrong one. only for quick port atm.
|
||||
type
|
||||
TCloneFunc=function(args:pointer):longint;cdecl;
|
||||
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 2004-01-22 13:55:02 marco
|
||||
* first port that shows some life based on FPC_USE_LIBC
|
||||
|
||||
Revision 1.4 2004/01/04 01:11:28 marco
|
||||
* a new qod port of the freebsd rtl. To be refined in the coming days.
|
||||
|
||||
Revision 1.3 2003/01/21 15:39:45 marco
|
||||
* NetBSD first rtl. Still not 100%, but close
|
||||
|
||||
Revision 1.2 2003/01/17 22:13:47 marco
|
||||
* some updates
|
||||
|
||||
Revision 1.1.2.1 2001/08/10 11:07:17 pierre
|
||||
New NetBSD files taken and adapted from FreeBSD
|
||||
|
||||
Revision 1.1.2.3 2001/03/12 14:58:37 marco
|
||||
* [Solaris] some constants moved from sysunix.inc
|
||||
|
||||
Revision 1.1.2.2 2000/11/03 14:58:52 marco
|
||||
* Open_NoCTTY added. Needed for serial.pp
|
||||
|
||||
Revision 1.1.2.1 2000/09/16 11:19:08 marco
|
||||
* Moved files from BSD to FreeBSD directory, with some small changes
|
||||
|
||||
Revision 1.1 2000/07/13 06:30:33 michael
|
||||
+ Initial import
|
||||
|
||||
Revision 1.5 2000/04/10 15:46:52 marco
|
||||
* worked all day. probably a lot changed
|
||||
|
||||
Revision 1.3 2000/02/03 17:05:13 marco
|
||||
* fixes and updates due to linux unit porting
|
||||
|
||||
Revision 1.2 2000/02/02 16:35:29 marco
|
||||
* Checked stat constants
|
||||
|
||||
Revision 1.1 2000/02/02 15:41:28 marco
|
||||
* initial BSD version.
|
||||
|
||||
Revision 1.4 2000/01/07 16:41:41 daniel
|
||||
* copyright 2000
|
||||
|
||||
Revision 1.3 2000/01/07 16:32:28 daniel
|
||||
* copyright 2000 added
|
||||
|
||||
Revision 1.2 1998/05/06 12:38:22 michael
|
||||
+ Removed log from before restored version.
|
||||
|
||||
Revision 1.1.1.1 1998/03/25 11:18:43 root
|
||||
* Restored version
|
||||
}
|
108
rtl/openbsd/sysofft.inc
Normal file
108
rtl/openbsd/sysofft.inc
Normal file
@ -0,0 +1,108 @@
|
||||
|
||||
|
||||
function Fplseek(fd : cint; offset : off_t; whence : cint): off_t; assembler; [public, alias : 'FPC_SYSC_LSEEK'];
|
||||
|
||||
asm
|
||||
stwu r1,-16(r1)
|
||||
mflr r0
|
||||
stw r0,20(r1)
|
||||
mr r11,r4
|
||||
mr r12,r5
|
||||
mr r5,r3
|
||||
mr r9,r6
|
||||
li r3,0
|
||||
mr r7,r11
|
||||
mr r8,r12
|
||||
li r6,0
|
||||
li r4,199
|
||||
// crclr cr1*4+eq
|
||||
crxor 6,6,6
|
||||
li r0,198
|
||||
sc
|
||||
bso .Lcerrorlseek
|
||||
// mr r0,r3
|
||||
// mr r3,r4
|
||||
// mr r4,r0
|
||||
lwz r0,20(r1)
|
||||
mtlr r0
|
||||
addi r1,r1,16
|
||||
blr
|
||||
.Lcerrorlseek:
|
||||
lis r4,Errno@ha
|
||||
stw r3,Errno@l(r4)
|
||||
li r3,-1
|
||||
li r4,-1
|
||||
lwz r0,20(r1)
|
||||
mtlr r0
|
||||
addi r1,r1,16
|
||||
end;
|
||||
|
||||
function Fpftruncate(fd : cint; flength : off_t): cint; assembler; [public, alias : 'FPC_SYSC_FTRUNCATE'];
|
||||
|
||||
asm
|
||||
stwu r1,-16(r1)
|
||||
mflr r0
|
||||
stw r0,20(r1)
|
||||
mr r7,r5
|
||||
mr r8,r6
|
||||
mr r5,r3
|
||||
li r3,0
|
||||
li r4,201
|
||||
li r6,0
|
||||
|
||||
//crclr cr1*4+eq
|
||||
crxor 6,6,6
|
||||
li r0,198
|
||||
sc
|
||||
bso .Lcerrortrunc
|
||||
mr r4,r3
|
||||
lwz r0,20(r1)
|
||||
mtlr r0
|
||||
addi r1,r1,16
|
||||
blr
|
||||
.Lcerrortrunc:
|
||||
lis r4,Errno@ha
|
||||
stw r3,Errno@l(r4)
|
||||
li r3,-1
|
||||
lwz r0,20(r1)
|
||||
mtlr r0
|
||||
addi r1,r1,16
|
||||
end;
|
||||
|
||||
Function Fpmmap(start:pointer;len:size_t;prot:cint;flags:cint;fd:cint;offst:off_t):pointer; assembler; [public, alias: 'FPC_SYSC_MMAP'];
|
||||
|
||||
//Function Fpmmap(adr,len,prot,flags,fdes,off:longint):longint; assembler; [public, alias : 'FPC_SYSC_MMAP'];
|
||||
|
||||
asm
|
||||
stwu r1,-16(r1)
|
||||
mflr r0
|
||||
stw r0,20(r1)
|
||||
mr r0,r5
|
||||
mr r8,r6
|
||||
stw r9,8(r1)
|
||||
stw r10,12(r1)
|
||||
mr r5,r3
|
||||
mr r6,r4
|
||||
mr r9,r7
|
||||
li r3,0
|
||||
mr r7,r0
|
||||
li r4,197
|
||||
li r10,0
|
||||
// crclr cr1*4+eq
|
||||
crxor 6,6,6
|
||||
li r0,198
|
||||
sc
|
||||
bso .Lcerrormmap
|
||||
mr r4,r3
|
||||
lwz r0,20(r1)
|
||||
mtlr r0
|
||||
addi r1,r1,16
|
||||
blr
|
||||
.Lcerrormmap:
|
||||
lis r4,Errno@ha
|
||||
stw r3,Errno@l(r4)
|
||||
li r3,-1
|
||||
lwz r0,20(r1)
|
||||
mtlr r0
|
||||
addi r1,r1,16
|
||||
end;
|
101
rtl/openbsd/systypes.inc
Normal file
101
rtl/openbsd/systypes.inc
Normal file
@ -0,0 +1,101 @@
|
||||
{
|
||||
$Id$
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 1999-2000 by Michael Van Canneyt,
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
type
|
||||
|
||||
TStatfs = packed record
|
||||
spare2, { place holder}
|
||||
bsize, { fundamental block size}
|
||||
iosize, { optimal block size }
|
||||
blocks, { total blocks}
|
||||
bfree, { blocks free}
|
||||
bavail, { block available for mortal users}
|
||||
files, { Total file nodes}
|
||||
ffree : longint; { file nodes free}
|
||||
fsid : array[0..1] of longint;
|
||||
fowner : longint; {mounter uid}
|
||||
ftype : longint;
|
||||
fflags : longint; {copy of mount flags}
|
||||
spare : array [0..1] of longint; { For later use }
|
||||
fstypename : array[0..15] of char;
|
||||
mountpoint : array[0..89] of char;
|
||||
mnfromname : array[0..89] of char;
|
||||
end;
|
||||
PStatFS=^TStatFS;
|
||||
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 2004-01-22 13:55:02 marco
|
||||
* first port that shows some life based on FPC_USE_LIBC
|
||||
|
||||
Revision 1.4 2004/01/04 01:11:28 marco
|
||||
* a new qod port of the freebsd rtl. To be refined in the coming days.
|
||||
|
||||
Revision 1.3 2003/01/21 15:39:45 marco
|
||||
* NetBSD first rtl. Still not 100%, but close
|
||||
|
||||
Revision 1.2 2003/01/17 22:13:47 marco
|
||||
* some updates
|
||||
|
||||
Revision 1.1.2.2 2001/08/30 23:00:18 marco
|
||||
* Fix for stat record.
|
||||
|
||||
Revision 1.1.2.1 2001/08/10 11:07:17 pierre
|
||||
New NetBSD files taken and adapted from FreeBSD
|
||||
|
||||
Revision 1.1.2.5 2001/03/12 15:01:39 marco
|
||||
* [Solaris] introduced dev_t
|
||||
|
||||
Revision 1.1.2.4 2001/01/20 16:54:51 marco
|
||||
* Fixed timeval. Must have thought that long=int64 when I did initial port?
|
||||
|
||||
Revision 1.1.2.3 2000/10/30 14:36:07 marco
|
||||
* timespec from int64 to longint.
|
||||
|
||||
Revision 1.1.2.2 2000/10/24 12:14:37 pierre
|
||||
+ timespec type for syscall_nr_nanosleep
|
||||
|
||||
Revision 1.1.2.1 2000/09/16 11:19:08 marco
|
||||
* Moved files from BSD to FreeBSD directory, with some small changes
|
||||
|
||||
Revision 1.1.2.1 2000/09/10 16:12:14 marco
|
||||
Initial signals, sockets and clone
|
||||
|
||||
Revision 1.1 2000/07/13 06:30:33 michael
|
||||
+ Initial import
|
||||
|
||||
Revision 1.8 2000/04/16 16:08:30 marco
|
||||
* Updated PDir to BSD libc layout. (which is totally different from Linux)
|
||||
|
||||
Revision 1.7 2000/04/10 15:46:52 marco
|
||||
* worked all day. probably a lot changed
|
||||
|
||||
Revision 1.5 2000/03/17 12:58:57 marco
|
||||
* some changes to ftruncate based procs. Added a "0" as extra parameter
|
||||
|
||||
Revision 1.4 2000/02/04 16:55:47 marco
|
||||
* Fixed tdir, some params need to be 32-bit
|
||||
|
||||
Revision 1.3 2000/02/03 17:05:55 marco
|
||||
|
||||
* Some types fixed/ported.
|
||||
|
||||
Revision 1.2 2000/02/02 16:45:38 marco
|
||||
* Typo in STAT record
|
||||
|
||||
Revision 1.1 2000/02/02 16:36:09 marco
|
||||
* Initial version. Copy of linux version, with BSD stat.
|
||||
|
||||
}
|
56
rtl/openbsd/termio.pp
Normal file
56
rtl/openbsd/termio.pp
Normal file
@ -0,0 +1,56 @@
|
||||
{
|
||||
$Id$
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 1999-2000 by Peter Vreman
|
||||
member of the Free Pascal development team.
|
||||
|
||||
See the file COPYING.FPC, included in this distribution,
|
||||
for details about the copyright.
|
||||
|
||||
This file contains the termios interface.
|
||||
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
unit termio;
|
||||
|
||||
interface
|
||||
|
||||
Uses BaseUnix; // load base unix typing
|
||||
|
||||
// load types + consts
|
||||
|
||||
{$i termios.inc}
|
||||
|
||||
// load default prototypes from unix dir.
|
||||
|
||||
{$i termiosh.inc}
|
||||
|
||||
implementation
|
||||
|
||||
{$i textrec.inc}
|
||||
|
||||
// load implementation for prototypes from current dir.
|
||||
{$i termiosproc.inc}
|
||||
|
||||
// load ttyname from unix dir.
|
||||
{$i ttyname.inc}
|
||||
|
||||
end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 2004-01-22 13:55:02 marco
|
||||
* first port that shows some life based on FPC_USE_LIBC
|
||||
|
||||
Revision 1.1 2004/01/04 01:13:23 marco
|
||||
* first 1.1 netbsd rtl, basically freebsd copy and paste with 1.0.10 netbsd structures
|
||||
|
||||
Revision 1.1 2003/11/19 17:15:31 marco
|
||||
* termio new includefile
|
||||
|
||||
|
||||
}
|
377
rtl/openbsd/termios.inc
Normal file
377
rtl/openbsd/termios.inc
Normal file
@ -0,0 +1,377 @@
|
||||
{
|
||||
$Id$
|
||||
This file is part of the Free Pascal run time library.
|
||||
(c) 2000-2003 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.
|
||||
|
||||
Termios header for FreeBSD
|
||||
|
||||
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.
|
||||
}
|
||||
|
||||
CONST
|
||||
|
||||
{
|
||||
* Special Control Characters
|
||||
*
|
||||
* Index into c_cc[] character array.
|
||||
*
|
||||
* Name Subscript Enabled by
|
||||
}
|
||||
VEOF =0;
|
||||
VEOL =1;
|
||||
VEOL2 =2;
|
||||
VERASE =3;
|
||||
VWERASE =4;
|
||||
VKILL =5;
|
||||
VREPRINT =6;
|
||||
{ =7; spare 1 }
|
||||
VINTR =8;
|
||||
VQUIT =9;
|
||||
VSUSP =10;
|
||||
VDSUSP =11;
|
||||
VSTART =12;
|
||||
VSTOP =13;
|
||||
VLNEXT =14;
|
||||
VDISCARD =15;
|
||||
VMIN =16;
|
||||
VTIME =17;
|
||||
VSTATUS =18;
|
||||
{ =19 spare 2 }
|
||||
NCCS =20;
|
||||
|
||||
Type
|
||||
winsize = packed record
|
||||
ws_row,
|
||||
ws_col,
|
||||
ws_xpixel,
|
||||
ws_ypixel : word;
|
||||
end;
|
||||
TWinSize=winsize;
|
||||
|
||||
|
||||
type
|
||||
Termios = packed record
|
||||
c_iflag,
|
||||
c_oflag,
|
||||
c_cflag,
|
||||
c_lflag : longint;
|
||||
c_line : char;
|
||||
c_cc : array[0..NCCS-1] of byte;
|
||||
{$IFDEF BSD}
|
||||
c_ispeed,
|
||||
c_ospeed : longint;
|
||||
{$endif}
|
||||
end;
|
||||
TTermios=Termios;
|
||||
|
||||
CONST
|
||||
|
||||
|
||||
POSIX_VDISABLE=Chr($ff);
|
||||
{
|
||||
|
||||
#define CCEQ(val, c) ((c) == (val) ? (val) != _POSIX_VDISABLE : 0)
|
||||
}
|
||||
|
||||
{ * Input flags - software input processing}
|
||||
|
||||
IGNBRK = $1; { ignore BREAK condition }
|
||||
BRKINT = $2; { map BREAK to SIGINTR }
|
||||
IGNPAR = $4; { ignore (discard) parity errors }
|
||||
PARMRK = $8; { mark parity and framing errors }
|
||||
INPCK = $10; { enable checking of parity errors }
|
||||
ISTRIP = $20; { strip 8th bit off chars }
|
||||
INLCR = $40; { map NL into CR }
|
||||
IGNCR = $80; { ignore CR }
|
||||
ICRNL = $100; { map CR to NL (ala CRMOD) }
|
||||
IXON = $200; { enable output flow control }
|
||||
IXOFF = $400; { enable input flow control }
|
||||
IXANY = $800; { any char will restart after stop }
|
||||
IMAXBEL = $2000; { ring bell on input queue full }
|
||||
|
||||
{
|
||||
* Output flags - software output processing
|
||||
}
|
||||
OPOST = $1; { enable following output processing }
|
||||
ONLCR = $2; { map NL to CR-NL (ala CRMOD) }
|
||||
OXTABS = $4; { expand tabs to spaces }
|
||||
ONOEOT = $8; { discard EOT's (^D) on output) }
|
||||
|
||||
{
|
||||
* Control flags - hardware control of terminal
|
||||
}
|
||||
CIGNORE = $1; { ignore control flags }
|
||||
CSIZE = $300; { character size mask }
|
||||
CS5 = $0; { 5 bits (pseudo) }
|
||||
CS6 = $100; { 6 bits }
|
||||
CS7 = $200; { 7 bits }
|
||||
CS8 = $300; { 8 bits }
|
||||
CSTOPB = $400; { send 2 stop bits }
|
||||
CREAD = $800; { enable receiver }
|
||||
PARENB = $1000; { parity enable }
|
||||
PARODD = $2000; { odd parity, else even }
|
||||
HUPCL = $4000; { hang up on last close }
|
||||
CLOCAL = $8000; { ignore modem status lines }
|
||||
CCTS_OFLOW = $10000; { CTS flow control of output }
|
||||
CRTS_IFLOW = $20000; { RTS flow control of input }
|
||||
CRTSCTS = (CCTS_OFLOW or CRTS_IFLOW);
|
||||
CDTR_IFLOW = $40000; { DTR flow control of input }
|
||||
CDSR_OFLOW = $80000; { DSR flow control of output }
|
||||
CCAR_OFLOW = $100000; { DCD flow control of output }
|
||||
MDMBUF = $100000; { old name for CCAR_OFLOW }
|
||||
|
||||
{
|
||||
* "Local" flags - dumping ground for other state
|
||||
*
|
||||
* Warning: some flags in this structure begin with
|
||||
* the letter "I" and look like they belong in the
|
||||
* input flag.
|
||||
}
|
||||
|
||||
ECHOKE = $1; { visual erase for line kill }
|
||||
ECHOE = $2; { visually erase chars }
|
||||
ECHOK = $4; { echo NL after line kill }
|
||||
ECHO = $8; { enable echoing }
|
||||
ECHONL = $10; { echo NL even if ECHO is off }
|
||||
ECHOPRT = $20; { visual erase mode for hardcopy }
|
||||
ECHOCTL = $40; { echo control chars as ^(Char) }
|
||||
ISIG = $80; { enable signals INTR, QUIT, [D]SUSP }
|
||||
ICANON = $100; { canonicalize input lines }
|
||||
ALTWERASE = $200; { use alternate WERASE algorithm }
|
||||
IEXTEN = $400; { enable DISCARD and LNEXT }
|
||||
EXTPROC = $800; { external processing }
|
||||
TOSTOP = $400000; { stop background jobs from output }
|
||||
FLUSHO = $800000; { output being flushed (state) }
|
||||
NOKERNINFO = $2000000; { no kernel output from VSTATUS }
|
||||
PENDIN =$20000000; { XXX retype pending input (state) }
|
||||
NOFLSH =$80000000; { don't flush after interrupt }
|
||||
|
||||
|
||||
|
||||
{
|
||||
* Commands passed to tcsetattr() for setting the termios structure.
|
||||
}
|
||||
|
||||
CONST
|
||||
|
||||
TCSANOW =0; { make change immediate }
|
||||
TCSADRAIN =1; { drain output, then change }
|
||||
TCSAFLUSH =2; { drain output, flush input }
|
||||
TCSASOFT =$10; { flag - don't alter h.w. state }
|
||||
|
||||
{
|
||||
* Standard speeds
|
||||
}
|
||||
B0 = 0;
|
||||
B50 = 50;
|
||||
B75 = 75;
|
||||
B110 = 110;
|
||||
B134 = 134;
|
||||
B150 = 150;
|
||||
B200 = 200;
|
||||
B300 = 300;
|
||||
B600 = 600;
|
||||
B1200 = 1200;
|
||||
B1800 = 1800;
|
||||
B2400 = 2400;
|
||||
B4800 = 4800;
|
||||
B9600 = 9600;
|
||||
B19200 = 19200;
|
||||
B38400 = 38400;
|
||||
B7200 = 7200;
|
||||
B14400 = 14400;
|
||||
B28800 = 28800;
|
||||
B57600 = 57600;
|
||||
B76800 = 76800;
|
||||
B115200 =115200;
|
||||
B230400 =230400;
|
||||
EXTA = 19200;
|
||||
EXTB = 38400;
|
||||
|
||||
TCIFLUSH =1;
|
||||
TCOFLUSH =2;
|
||||
TCIOFLUSH =3;
|
||||
TCOOFF =1;
|
||||
TCOON =2;
|
||||
TCIOFF =3;
|
||||
TCION =4;
|
||||
|
||||
{
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
speed_t cfgetispeed __P((const struct termios *));
|
||||
speed_t cfgetospeed __P((const struct termios *));
|
||||
int cfsetispeed __P((struct termios *, speed_t));
|
||||
int cfsetospeed __P((struct termios *, speed_t));
|
||||
int tcgetattr __P((int, struct termios *));
|
||||
int tcsetattr __P((int, int, const struct termios *));
|
||||
int tcdrain __P((int));
|
||||
int tcflow __P((int, int));
|
||||
int tcflush __P((int, int));
|
||||
int tcsendbreak __P((int, int));
|
||||
|
||||
#ifndef _POSIX_SOURCE
|
||||
void cfmakeraw __P((struct termios *));
|
||||
int cfsetspeed __P((struct termios *, speed_t));
|
||||
#endif { !_POSIX_SOURCE }
|
||||
__END_DECLS
|
||||
|
||||
#endif { !_KERNEL }
|
||||
|
||||
|
||||
|
||||
struct winsize {
|
||||
unsigned short ws_row; { rows, in characters }
|
||||
unsigned short ws_col; { columns, in characters }
|
||||
unsigned short ws_xpixel; { horizontal size, pixels }
|
||||
unsigned short ws_ypixel; { vertical size, pixels }
|
||||
};
|
||||
|
||||
}
|
||||
IOCTLREAD = $40000000;
|
||||
IOCTLWRITE = $80000000;
|
||||
IOCTLVOID = $20000000;
|
||||
|
||||
TIOCMODG = IOCTLREAD+$47400+ 3; { get modem control state }
|
||||
TIOCMODS = IOCTLWRITE+$47400+ 4; { set modem control state }
|
||||
TIOCM_LE =$0001; { line enable }
|
||||
TIOCM_DTR =$0002; { data terminal ready }
|
||||
TIOCM_RTS =$0004; { request to send }
|
||||
TIOCM_ST =$0010; { secondary transmit }
|
||||
TIOCM_SR =$0020; { secondary receive }
|
||||
TIOCM_CTS =$0040; { clear to send }
|
||||
TIOCM_CAR =$0100; { carrier detect }
|
||||
TIOCM_CD =TIOCM_CAR;
|
||||
TIOCM_RNG =$0200; { ring }
|
||||
TIOCM_RI =TIOCM_RNG;
|
||||
TIOCM_DSR =$0400; { data set ready }
|
||||
{ 8-10 compat }
|
||||
TIOCEXCL =IOCTLVOID+$7400+ 13; { set exclusive use of tty }
|
||||
TIOCNXCL =IOCTLVOID+$7400+ 14; { reset exclusive use of tty }
|
||||
{ 15 unused }
|
||||
TIOCFLUSH =IOCTLWRITE+$47400+ 16; { flush buffers }
|
||||
{ 17-18 compat }
|
||||
TIOCGETA =IOCTLREAD+$2C7400+ 19; { get termios struct }
|
||||
TIOCSETA =IOCTLWRITE+$2C7400+ 20; { set termios struct }
|
||||
TIOCSETAW =IOCTLWRITE+$2C7400+ 21; { drain output, set }
|
||||
TIOCSETAF =IOCTLWRITE+$2C7400+ 22; { drn out, fls in, set }
|
||||
TIOCGETD =IOCTLREAD+$47400+ 26; { get line discipline }
|
||||
TIOCSETD =IOCTLWRITE+$47400+ 27; { set line discipline }
|
||||
{ 127-124 compat }
|
||||
TIOCSBRK =IOCTLVOID+$7400+ 123; { set break bit }
|
||||
TIOCCBRK =IOCTLVOID+$7400+ 122; { clear break bit }
|
||||
TIOCSDTR =IOCTLVOID+$7400+ 121; { set data terminal ready }
|
||||
TIOCCDTR =IOCTLVOID+$7400+ 120; { clear data terminal ready }
|
||||
TIOCGPGRP =IOCTLREAD+$47400+ 119; { get pgrp of tty }
|
||||
TIOCSPGRP =IOCTLWRITE+$47400+ 118; { set pgrp of tty }
|
||||
{ 117-116 compat }
|
||||
TIOCOUTQ =IOCTLREAD+$47400+ 115; { output queue size }
|
||||
TIOCSTI =IOCTLWRITE+$17400+ 114; { simulate terminal input }
|
||||
TIOCNOTTY =IOCTLVOID+$7400+ 113; { void tty association }
|
||||
TIOCPKT =IOCTLWRITE+$47400+ 112; { pty: set/clear packet mode }
|
||||
TIOCPKT_DATA =$00; { data packet }
|
||||
TIOCPKT_FLUSHREAD =$01; { flush packet }
|
||||
TIOCPKT_FLUSHWRITE =$02; { flush packet }
|
||||
TIOCPKT_STOP =$04; { stop output }
|
||||
TIOCPKT_START =$08; { start output }
|
||||
TIOCPKT_NOSTOP =$10; { no more ^S, ^Q }
|
||||
TIOCPKT_DOSTOP =$20; { now do ^S ^Q }
|
||||
TIOCPKT_IOCTL =$40; { state change of pty driver }
|
||||
TIOCSTOP =IOCTLVOID+$7400+ 111; { stop output, like ^S }
|
||||
TIOCSTART =IOCTLVOID+$7400+ 110; { start output, like ^Q }
|
||||
TIOCMSET =IOCTLWRITE+$47400+ 109; { set all modem bits }
|
||||
TIOCMBIS =IOCTLWRITE+$47400+ 108; { bis modem bits }
|
||||
TIOCMBIC =IOCTLWRITE+$47400+ 107; { bic modem bits }
|
||||
TIOCMGET =IOCTLREAD+$47400+ 106; { get all modem bits }
|
||||
TIOCREMOTE =IOCTLWRITE+$47400+ 105; { remote input editing }
|
||||
TIOCGWINSZ =IOCTLREAD+$87400+ 104; { get window size }
|
||||
TIOCSWINSZ =IOCTLWRITE+$87400+ 103; { set window size }
|
||||
TIOCUCNTL =IOCTLWRITE+$47400+ 102; { pty: set/clr usr cntl mode }
|
||||
TIOCSTAT =IOCTLVOID+$7400+ 101; { simulate ^T status message }
|
||||
// UIOCCMD(n) _IO('u', n) { usr cntl op "n" }
|
||||
TIOCCONS =IOCTLWRITE+$47400+ 98; { become virtual console }
|
||||
TIOCSCTTY =IOCTLVOID+$7400+ 97; { become controlling tty }
|
||||
TIOCEXT =IOCTLWRITE+$47400+ 96; { pty: external processing }
|
||||
TIOCSIG =IOCTLVOID+$7400+ 95; { pty: generate signal }
|
||||
TIOCDRAIN =IOCTLVOID+$7400+ 94; { wait till output drained }
|
||||
TIOCMSDTRWAIT =IOCTLWRITE+$47400+ 91; { modem: set wait on close }
|
||||
TIOCMGDTRWAIT =IOCTLREAD+$47400+ 90; { modem: get wait on close }
|
||||
TIOCTIMESTAMP =IOCTLREAD+$87400+ 89; { enable/get timestamp
|
||||
* of last input event }
|
||||
TIOCDCDTIMESTAMP =IOCTLREAD+$87400+ 88; { enable/get timestamp
|
||||
* of last DCd rise }
|
||||
TIOCSDRAINWAIT =IOCTLWRITE+$47400+ 87; { set ttywait timeout }
|
||||
TIOCGDRAINWAIT =IOCTLREAD+$47400+ 86; { get ttywait timeout }
|
||||
|
||||
TTYDISC =0; { termios tty line discipline }
|
||||
SLIPDISC =4; { serial IP discipline }
|
||||
PPPDISC =5; { PPP discipline }
|
||||
NETGRAPHDISC =6; { Netgraph tty node discipline }
|
||||
|
||||
|
||||
{
|
||||
* Defaults on "first" open.
|
||||
}
|
||||
TTYDEF_IFLAG =(BRKINT or ICRNL or IMAXBEL or IXON or IXANY);
|
||||
TTYDEF_OFLAG =(OPOST or ONLCR);
|
||||
TTYDEF_LFLAG =(ECHO or ICANON or ISIG or IEXTEN or ECHOE or ECHOKE or ECHOCTL);
|
||||
TTYDEF_CFLAG =(CREAD or CS8 or HUPCL);
|
||||
TTYDEF_SPEED =(B9600);
|
||||
|
||||
|
||||
|
||||
{
|
||||
* Control Character Defaults
|
||||
}
|
||||
CtrlMask = $1f; {\037}
|
||||
CEOF =chr( ORD('d') and CtrlMask);
|
||||
CEOL =chr( $ff and CtrlMask);{ XXX avoid _POSIX_VDISABLE }
|
||||
CERASE =chr( $7F and CtrlMask);
|
||||
CINTR =chr(ORD('c') and CtrlMask);
|
||||
CSTATUS =chr(ORD('t') and CtrlMask);
|
||||
CKILL =chr(ORD('u') and CtrlMask);
|
||||
CMIN =chr(1);
|
||||
CQUIT =chr(034 and CtrlMask); { FS, ^\ }
|
||||
CSUSP =chr(ORD('z') and CtrlMask);
|
||||
CTIME =chr(0);
|
||||
CDSUSP =chr(ORD('y') and CtrlMask);
|
||||
CSTART =chr(ORD('q') and CtrlMask);
|
||||
CSTOP =chr(ORD('s') and CtrlMask);
|
||||
CLNEXT =chr(ORD('v') and CtrlMask);
|
||||
CDISCARD =chr(ORD('o') and CtrlMask);
|
||||
CWERASE =chr(ORD('w') and CtrlMask);
|
||||
CREPRINT =chr(ORD('r') and CtrlMask);
|
||||
CEOT =CEOF;
|
||||
{ compat }
|
||||
CBRK =CEOL;
|
||||
CRPRNT =CREPRINT;
|
||||
CFLUSH =CDISCARD;
|
||||
|
||||
|
||||
{
|
||||
* TTYDEFCHARS to include an array of default control characters.
|
||||
}
|
||||
ttydefchars : array[0..NCCS-1] OF char =(
|
||||
CEOF, CEOL, CEOL, CERASE, CWERASE, CKILL, CREPRINT,
|
||||
POSIX_VDISABLE, CINTR, CQUIT, CSUSP, CDSUSP, CSTART, CSTOP, CLNEXT,
|
||||
CDISCARD, CMIN, CTIME, CSTATUS, POSIX_VDISABLE);
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 2004-01-22 13:55:02 marco
|
||||
* first port that shows some life based on FPC_USE_LIBC
|
||||
|
||||
Revision 1.3 2004/01/04 01:11:28 marco
|
||||
* a new qod port of the freebsd rtl. To be refined in the coming days.
|
||||
|
||||
Revision 1.4 2004/01/03 12:18:29 marco
|
||||
* a lot of copyright notices and CVS logs added and fixed
|
||||
|
||||
}
|
150
rtl/openbsd/termiosproc.inc
Normal file
150
rtl/openbsd/termiosproc.inc
Normal file
@ -0,0 +1,150 @@
|
||||
{
|
||||
$Id$
|
||||
This file is part of the Free Pascal run time library.
|
||||
(c) 2000-2003 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.
|
||||
|
||||
Termios implementation for FreeBSD
|
||||
|
||||
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.
|
||||
}
|
||||
|
||||
|
||||
{******************************************************************************
|
||||
IOCtl and Termios calls
|
||||
******************************************************************************}
|
||||
|
||||
Function TCGetAttr(fd:cint;var tios:TermIOS):cint;
|
||||
begin
|
||||
TCGETAttr:=fpIoCtl(Fd,TIOCGETA,@tios);
|
||||
end;
|
||||
|
||||
|
||||
Function TCSetAttr(fd:cint;OptAct:cint;const tios:TermIOS):cint;
|
||||
var
|
||||
nr:cint;
|
||||
begin
|
||||
case OptAct of
|
||||
TCSANOW : nr:=TIOCSETA;
|
||||
TCSADRAIN : nr:=TIOCSETAW;
|
||||
TCSAFLUSH : nr:=TIOCSETAF;
|
||||
else
|
||||
begin
|
||||
fpsetErrNo(ESysEINVAL);
|
||||
TCSetAttr:=-1;
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
TCSetAttr:=fpIOCtl(fd,nr,@Tios);
|
||||
end;
|
||||
|
||||
|
||||
Procedure CFSetISpeed(var tios:TermIOS;speed:Cardinal);
|
||||
begin
|
||||
tios.c_ispeed:=speed; {Probably the Bxxxx speed constants}
|
||||
end;
|
||||
|
||||
|
||||
Procedure CFSetOSpeed(var tios:TermIOS;speed:Cardinal);
|
||||
begin
|
||||
tios.c_ospeed:=speed;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Procedure CFMakeRaw(var tios:TermIOS);
|
||||
begin
|
||||
with tios do
|
||||
begin
|
||||
c_iflag:=c_iflag and (not (IMAXBEL or IXOFF or INPCK or BRKINT or
|
||||
PARMRK or ISTRIP or INLCR or IGNCR or ICRNL or IXON or
|
||||
IGNPAR));
|
||||
c_iflag:=c_iflag OR IGNBRK;
|
||||
c_oflag:=c_oflag and (not OPOST);
|
||||
c_lflag:=c_lflag and (not (ECHO or ECHOE or ECHOK or ECHONL or ICANON or
|
||||
ISIG or IEXTEN or NOFLSH or TOSTOP or PENDIN));
|
||||
c_cflag:=(c_cflag and (not (CSIZE or PARENB))) or (CS8 OR cread);
|
||||
c_cc[VMIN]:=1;
|
||||
c_cc[VTIME]:=0;
|
||||
end;
|
||||
end;
|
||||
|
||||
Function TCSendBreak(fd,duration:cint):cint;
|
||||
begin
|
||||
TCSendBreak:=fpIOCtl(fd,TIOCSBRK,nil);
|
||||
end;
|
||||
|
||||
|
||||
Function TCSetPGrp(fd,id:cint):cint;
|
||||
begin
|
||||
TCSetPGrp:=fpIOCtl(fd,TIOCSPGRP,pointer(id));
|
||||
end;
|
||||
|
||||
|
||||
Function TCGetPGrp(fd:cint;var id:cint):cint;
|
||||
begin
|
||||
TCGetPGrp:=fpIOCtl(fd,TIOCGPGRP,@id);
|
||||
end;
|
||||
|
||||
Function TCDrain(fd:cint):cint;
|
||||
begin
|
||||
TCDrain:=fpIOCtl(fd,TIOCDRAIN,nil); {Should set timeout to 1 first?}
|
||||
end;
|
||||
|
||||
|
||||
Function TCFlow(fd,act:cint):cint;
|
||||
begin
|
||||
case act OF
|
||||
TCOOFF : TCFlow:=fpIoctl(fd,TIOCSTOP,nil);
|
||||
TCOOn : TCFlow:=fpIOctl(Fd,TIOCStart,nil);
|
||||
TCIOFF : {N/I}
|
||||
end;
|
||||
end;
|
||||
|
||||
Function TCFlush(fd,qsel:cint):cint;
|
||||
begin
|
||||
TCFlush:=fpIOCtl(fd,TIOCFLUSH,pointer(qsel));
|
||||
end;
|
||||
|
||||
Function IsATTY (Handle:cint):cint;
|
||||
{
|
||||
Check if the filehandle described by 'handle' is a TTY (Terminal)
|
||||
}
|
||||
var
|
||||
t : Termios;
|
||||
begin
|
||||
IsAtty:=TCGetAttr(Handle,t);
|
||||
end;
|
||||
|
||||
|
||||
Function IsATTY(var f: text):cint;
|
||||
{
|
||||
Idem as previous, only now for text variables.
|
||||
}
|
||||
begin
|
||||
IsATTY:=IsaTTY(textrec(f).handle);
|
||||
end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 2004-01-22 13:55:02 marco
|
||||
* first port that shows some life based on FPC_USE_LIBC
|
||||
|
||||
Revision 1.1 2004/01/04 01:13:23 marco
|
||||
* first 1.1 netbsd rtl, basically freebsd copy and paste with 1.0.10 netbsd structures
|
||||
|
||||
Revision 1.3 2004/01/03 12:18:29 marco
|
||||
* a lot of copyright notices and CVS logs added and fixed
|
||||
|
||||
Revision 1.2 2003/12/16 19:43:53 marco
|
||||
* nil <-> 0 changes
|
||||
|
||||
Revision 1.1 2003/11/19 17:15:31 marco
|
||||
* termio new includefile
|
||||
|
||||
}
|
236
rtl/openbsd/unixsock.inc
Normal file
236
rtl/openbsd/unixsock.inc
Normal file
@ -0,0 +1,236 @@
|
||||
{
|
||||
$Id$
|
||||
This file is part of the Free Pascal run time library.
|
||||
(c) 2000-2003 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.
|
||||
|
||||
socket call implementations for FreeBSD
|
||||
|
||||
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.
|
||||
}
|
||||
|
||||
|
||||
{******************************************************************************
|
||||
Basic Socket Functions
|
||||
******************************************************************************}
|
||||
|
||||
Function socket(Domain,SocketType,Protocol:Longint):Longint;
|
||||
begin
|
||||
Socket:=Do_Syscall(syscall_nr_socket,Domain,SocketType,Protocol);
|
||||
end;
|
||||
|
||||
Function CloseSocket (Sock:Longint):Longint;
|
||||
begin
|
||||
if fpclose(Sock)=0 then
|
||||
CloseSocket := 0 else
|
||||
CloseSocket := -1;
|
||||
end;
|
||||
|
||||
Function Send(Sock:Longint;Const Buf;BufLen,Flags:Longint):Longint;
|
||||
begin
|
||||
Send:=do_syscall(syscall_nr_sendto,Sock,Longint(@Buf),BufLen,Flags,0,0);
|
||||
end;
|
||||
|
||||
Function SendTo(Sock:Longint;Const Buf;BufLen,Flags:Longint;Var Addr; AddrLen : Longint):Longint;
|
||||
begin
|
||||
Sendto:=do_syscall(syscall_nr_Sendto,Sock,Longint(@Buf),BufLen,Flags,Longint(@Addr),AddrLen);
|
||||
end;
|
||||
|
||||
Function Recv(Sock:Longint;Var Buf;BufLen,Flags:Longint):Longint;
|
||||
begin
|
||||
Recv:=do_syscall(syscall_nr_Recvfrom,Sock,Longint(@Buf),BufLen,Flags,0,0);
|
||||
end;
|
||||
|
||||
Function RecvFrom(Sock : Longint; Var Buf; Buflen,Flags : Longint; Var Addr ; AddrLen : Integer) : longint;
|
||||
|
||||
begin
|
||||
RecvFrom:=do_syscall(syscall_nr_Recvfrom,Sock,Longint(@buf),buflen,flags,Longint(@Addr),AddrLen);
|
||||
end;
|
||||
|
||||
Function Bind(Sock:Longint;Const Addr;AddrLen:Longint):Boolean;
|
||||
begin
|
||||
Bind:=(do_syscall(syscall_nr_Bind,Sock,Longint(@Addr),AddrLen)=0);
|
||||
end;
|
||||
|
||||
Function Listen(Sock,MaxConnect:Longint):Boolean;
|
||||
begin
|
||||
Listen:=(do_syscall(syscall_nr_Listen,Sock,MaxConnect,0)=0);
|
||||
end;
|
||||
|
||||
Function Accept(Sock:Longint;Var Addr;Var Addrlen:Longint):Longint;
|
||||
begin
|
||||
Accept:=do_syscall(syscall_nr_accept,Sock,longint(@Addr),longint(@AddrLen));
|
||||
If Accept<0 Then
|
||||
Accept:=-1;
|
||||
end;
|
||||
|
||||
Function Connect(Sock:Longint;Const Addr;Addrlen:Longint): boolean;
|
||||
|
||||
begin
|
||||
Connect:=do_syscall(syscall_nr_connect,Sock,longint(@Addr),AddrLen)=0;
|
||||
end;
|
||||
|
||||
|
||||
Function Shutdown(Sock:Longint;How:Longint):Longint;
|
||||
begin
|
||||
ShutDown:=do_syscall(syscall_nr_shutdown,Sock,How);
|
||||
end;
|
||||
|
||||
|
||||
Function GetSocketName(Sock:Longint;Var Addr;Var Addrlen:Longint):Longint;
|
||||
begin
|
||||
GetSocketName:=do_syscall(syscall_nr_GetSockName,Sock,longint(@Addr),longint(@AddrLen));
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Function GetPeerName(Sock:Longint;Var Addr;Var Addrlen:Longint):Longint;
|
||||
begin
|
||||
GetPeerName:=do_syscall(syscall_nr_GetPeerName,Sock,longint(@Addr),longint(@AddrLen));
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Function SetSocketOptions(Sock,Level,OptName:Longint;Const OptVal;optlen:longint):Longint;
|
||||
begin
|
||||
SetSocketOptions:=do_syscall(syscall_nr_SetSockOpt,Sock,Level,OptName,Longint(@OptVal),OptLen,0);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Function GetSocketOptions(Sock,Level,OptName:Longint;Var OptVal;Var optlen:longint):Longint;
|
||||
begin
|
||||
GetSocketOptions:=do_syscall(syscall_nr_GetSockOpt,Sock,Level,OptName,Longint(@OptVal),OptLen,0);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Function SocketPair(Domain,SocketType,Protocol:Longint;var Pair:TSockArray):Longint;
|
||||
begin
|
||||
SocketPair:=do_syscall(syscall_nr_SocketPair,Domain,SocketType,Protocol,longint(@Pair),0,0);
|
||||
end;
|
||||
|
||||
{******************************************************************************
|
||||
UnixSock
|
||||
******************************************************************************}
|
||||
|
||||
Procedure Str2UnixSockAddr(const addr:string;var t:TUnixSockAddr;var len:longint);
|
||||
begin
|
||||
Move(Addr[1],t.Path,length(Addr));
|
||||
t.Family:=AF_UNIX;
|
||||
t.Path[length(Addr)]:=#0;
|
||||
Len:=Length(Addr)+3;
|
||||
end;
|
||||
|
||||
|
||||
Function Bind(Sock:longint;const addr:string):boolean;
|
||||
var
|
||||
UnixAddr : TUnixSockAddr;
|
||||
AddrLen : longint;
|
||||
begin
|
||||
Str2UnixSockAddr(addr,UnixAddr,AddrLen);
|
||||
Bind(Sock,UnixAddr,AddrLen);
|
||||
Bind:=(SocketError=0);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Function DoAccept(Sock:longint;var addr:string):longint;
|
||||
var
|
||||
UnixAddr : TUnixSockAddr;
|
||||
AddrLen : longint;
|
||||
begin
|
||||
AddrLen:=length(addr)+3;
|
||||
DoAccept:=Accept(Sock,UnixAddr,AddrLen);
|
||||
Move(UnixAddr.Path,Addr[1],AddrLen);
|
||||
SetLength(Addr,AddrLen);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Function DoConnect(Sock:longint;const addr:string):Boolean;
|
||||
var
|
||||
UnixAddr : TUnixSockAddr;
|
||||
AddrLen : longint;
|
||||
begin
|
||||
Str2UnixSockAddr(addr,UnixAddr,AddrLen);
|
||||
DoConnect:=Connect(Sock,UnixAddr,AddrLen);
|
||||
end;
|
||||
|
||||
Function Accept(Sock:longint;var addr:string;var SockIn,SockOut:text):Boolean;
|
||||
var
|
||||
s : longint;
|
||||
begin
|
||||
S:=DoAccept(Sock,addr);
|
||||
if S>0 then
|
||||
begin
|
||||
Sock2Text(S,SockIn,SockOut);
|
||||
Accept:=true;
|
||||
end
|
||||
else
|
||||
Accept:=false;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Function Accept(Sock:longint;var addr:string;var SockIn,SockOut:File):Boolean;
|
||||
var
|
||||
s : longint;
|
||||
begin
|
||||
S:=DoAccept(Sock,addr);
|
||||
if S>0 then
|
||||
begin
|
||||
Sock2File(S,SockIn,SockOut);
|
||||
Accept:=true;
|
||||
end
|
||||
else
|
||||
Accept:=false;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Function Connect(Sock:longint;const addr:string;var SockIn,SockOut:text):Boolean;
|
||||
begin
|
||||
Connect:=DoConnect(Sock,addr);
|
||||
If Connect then
|
||||
Sock2Text(Sock,SockIn,SockOut);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Function Connect(Sock:longint;const addr:string;var SockIn,SockOut:file):Boolean;
|
||||
begin
|
||||
Connect:=DoConnect(Sock,addr);
|
||||
if Connect then
|
||||
Sock2File(Sock,SockIn,SockOut);
|
||||
end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 2004-01-22 13:55:02 marco
|
||||
* first port that shows some life based on FPC_USE_LIBC
|
||||
|
||||
Revision 1.4 2004/01/04 01:11:28 marco
|
||||
* a new qod port of the freebsd rtl. To be refined in the coming days.
|
||||
|
||||
Revision 1.9 2004/01/03 12:18:29 marco
|
||||
* a lot of copyright notices and CVS logs added and fixed
|
||||
|
||||
Revision 1.8 2003/09/15 07:09:58 marco
|
||||
* small fixes, round 1
|
||||
|
||||
Revision 1.7 2003/03/23 17:47:15 armin
|
||||
* CloseSocket added
|
||||
|
||||
Revision 1.6 2002/09/07 16:01:18 peter
|
||||
* old logs removed and tabs fixed
|
||||
|
||||
Revision 1.5 2002/02/05 07:54:34 marco
|
||||
* Fixed typo
|
||||
|
||||
}
|
336
rtl/openbsd/unixsysc.inc
Normal file
336
rtl/openbsd/unixsysc.inc
Normal file
@ -0,0 +1,336 @@
|
||||
{
|
||||
$Id$
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
{
|
||||
function clone(func:TCloneFunc;sp:pointer;flags:longint;args:pointer):longint;
|
||||
{NOT IMPLEMENTED YET UNDER BSD}
|
||||
begin // perhaps it is better to implement the hack from solaris then this msg
|
||||
HALT;
|
||||
END;
|
||||
|
||||
if (pointer(func)=nil) or (sp=nil) then
|
||||
begin
|
||||
Lfpseterrno(EsysEInval);
|
||||
exit(-1);
|
||||
end;
|
||||
asm
|
||||
{ Insert the argument onto the new stack. }
|
||||
movl sp,%ecx
|
||||
subl $8,%ecx
|
||||
movl args,%eax
|
||||
movl %eax,4(%ecx)
|
||||
|
||||
{ Save the function pointer as the zeroth argument.
|
||||
It will be popped off in the child in the ebx frobbing below. }
|
||||
movl func,%eax
|
||||
movl %eax,0(%ecx)
|
||||
|
||||
{ Do the system call }
|
||||
pushl %ebx
|
||||
pushl %ebx
|
||||
// movl flags,%ebx
|
||||
movl $251,%eax
|
||||
int $0x80
|
||||
popl %ebx
|
||||
popl %ebx
|
||||
test %eax,%eax
|
||||
jnz .Lclone_end
|
||||
|
||||
{ We're in the new thread }
|
||||
subl %ebp,%ebp { terminate the stack frame }
|
||||
call *%ebx
|
||||
{ exit process }
|
||||
movl %eax,%ebx
|
||||
movl $1,%eax
|
||||
int $0x80
|
||||
|
||||
.Lclone_end:
|
||||
movl %eax,__RESULT
|
||||
end;
|
||||
end;
|
||||
}
|
||||
|
||||
{$ifndef FPC_USE_LIBC}
|
||||
Function fsync (fd : cint) : cint;
|
||||
|
||||
begin
|
||||
fsync:=do_syscall(syscall_nr_fsync,fd);
|
||||
end;
|
||||
|
||||
Function Flock (fd,mode : longint) : cint;
|
||||
|
||||
begin
|
||||
Flock:=do_syscall(syscall_nr_flock,fd,mode);
|
||||
end;
|
||||
|
||||
Function fStatFS(Fd:Longint;Var Info:tstatfs):cint;
|
||||
{
|
||||
Get all information on a fileSystem, and return it in Info.
|
||||
Fd is the file descriptor of a file/directory on the fileSystem
|
||||
you wish to investigate.
|
||||
}
|
||||
|
||||
begin
|
||||
fStatFS:=do_syscall(syscall_nr_fstatfs,fd,longint(@info));
|
||||
end;
|
||||
|
||||
Function StatFS(path:pchar;Var Info:tstatfs):cint;
|
||||
{
|
||||
Get all information on a fileSystem, and return it in Info.
|
||||
Fd is the file descriptor of a file/directory on the fileSystem
|
||||
you wish to investigate.
|
||||
}
|
||||
|
||||
begin
|
||||
StatFS:=do_syscall(syscall_nr_statfs,longint(path),longint(@info));
|
||||
end;
|
||||
|
||||
// needs oldfpccall;
|
||||
Function intAssignPipe(var pipe_in,pipe_out:longint;var errn:cint):cint; {$ifndef ver1_0} oldfpccall;{$endif}
|
||||
{
|
||||
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.
|
||||
}
|
||||
|
||||
begin
|
||||
{$ifdef i386}
|
||||
asm
|
||||
mov $42,%eax
|
||||
int $0x80
|
||||
jb .Lerror
|
||||
mov pipe_in,%ebx
|
||||
mov %eax,(%ebx)
|
||||
mov pipe_out,%ebx
|
||||
mov $0,%eax
|
||||
mov %edx,(%ebx)
|
||||
mov %eax,%ebx
|
||||
jmp .Lexit
|
||||
.Lerror:
|
||||
mov %eax,%ebx
|
||||
mov $-1,%eax
|
||||
.Lexit:
|
||||
mov Errn,%edx
|
||||
mov %ebx,(%edx)
|
||||
end;
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
|
||||
Function PClose(Var F:text) :cint;
|
||||
var
|
||||
pl : ^longint;
|
||||
res : longint;
|
||||
|
||||
begin
|
||||
do_syscall(syscall_nr_close,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;
|
||||
|
||||
Function PClose(Var F:file) : cint;
|
||||
var
|
||||
pl : ^cint;
|
||||
res : cint;
|
||||
|
||||
begin
|
||||
do_syscall(syscall_nr_close,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 MUnMap (P : Pointer; Size : size_t) : cint;
|
||||
|
||||
begin
|
||||
MUnMap:=do_syscall(syscall_nr_munmap,longint(P),Size);
|
||||
end;
|
||||
{$else}
|
||||
|
||||
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}
|
||||
// can't have oldfpccall here, linux doesn't need it.
|
||||
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;
|
||||
|
||||
|
||||
{
|
||||
function intClone(func:TCloneFunc;sp:pointer;flags:longint;args:pointer):longint; {$ifndef ver1_0} oldfpccall; {$endif}
|
||||
|
||||
|
||||
var lerrno : Longint;
|
||||
errset : Boolean;
|
||||
Res : Longint;
|
||||
begin
|
||||
errset:=false;
|
||||
Res:=0;
|
||||
asm
|
||||
pushl %esi
|
||||
movl 12(%ebp), %esi // get stack addr
|
||||
subl $4, %esi
|
||||
movl 20(%ebp), %eax // get __arg
|
||||
movl %eax, (%esi)
|
||||
subl $4, %esi
|
||||
movl 8(%ebp), %eax // get __fn
|
||||
movl %eax, (%esi)
|
||||
pushl 16(%ebp)
|
||||
pushl %esi
|
||||
mov syscall_nr_rfork, %eax
|
||||
int $0x80 // call actualsyscall
|
||||
jb .L2
|
||||
test %edx, %edx
|
||||
jz .L1
|
||||
movl %esi,%esp
|
||||
popl %eax
|
||||
call %eax
|
||||
addl $8, %esp
|
||||
call halt // Does not return
|
||||
.L2:
|
||||
mov %eax,LErrNo
|
||||
mov $true,Errset
|
||||
mov $-1,%eax
|
||||
// jmp .L1
|
||||
.L1:
|
||||
addl $8, %esp
|
||||
popl %esi
|
||||
mov %eax,Res
|
||||
end;
|
||||
If ErrSet Then
|
||||
fpSetErrno(LErrno);
|
||||
intClone:=Res;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
function Clone(func:TCloneFunc;sp:pointer;flags:longint;args:pointer):longint;
|
||||
|
||||
begin
|
||||
Clone:=
|
||||
intclone(tclonefunc(func),sp,flags,args);
|
||||
end;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 2004-01-22 13:55:02 marco
|
||||
* first port that shows some life based on FPC_USE_LIBC
|
||||
|
||||
Revision 1.6 2004/01/04 15:55:47 marco
|
||||
* additions
|
||||
|
||||
Revision 1.5 2004/01/04 01:11:28 marco
|
||||
* a new qod port of the freebsd rtl. To be refined in the coming days.
|
||||
|
||||
Revision 1.18 2004/01/01 17:07:21 marco
|
||||
* few small freebsd fixes backported from debugging linux
|
||||
|
||||
Revision 1.17 2003/12/30 12:32:30 marco
|
||||
*** empty log message ***
|
||||
|
||||
Revision 1.16 2003/11/19 17:11:40 marco
|
||||
* termio unit
|
||||
|
||||
Revision 1.15 2003/11/19 10:12:02 marco
|
||||
* more cleanups
|
||||
|
||||
Revision 1.14 2003/11/17 10:05:51 marco
|
||||
* threads for FreeBSD. Not working tho
|
||||
|
||||
Revision 1.13 2003/11/14 16:21:59 marco
|
||||
* linuxerror elimination
|
||||
|
||||
Revision 1.12 2003/11/09 12:00:16 marco
|
||||
* pipe fix
|
||||
|
||||
Revision 1.11 2003/09/20 12:38:29 marco
|
||||
* FCL now compiles for FreeBSD with new 1.1. Now Linux.
|
||||
|
||||
Revision 1.10 2003/09/15 20:08:49 marco
|
||||
* small fixes. FreeBSD now cycles
|
||||
|
||||
Revision 1.9 2003/09/15 07:09:58 marco
|
||||
* small fixes, round 1
|
||||
|
||||
Revision 1.8 2003/09/14 20:15:01 marco
|
||||
* Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
|
||||
|
||||
Revision 1.7 2003/01/05 19:02:29 marco
|
||||
* Should now work with baseunx. (gmake all works)
|
||||
|
||||
Revision 1.6 2002/10/18 12:19:59 marco
|
||||
* Fixes to get the generic *BSD RTL compiling again + fixes for thread
|
||||
support. Still problems left in fexpand. (inoutres?) Therefore fixed
|
||||
sysposix not yet commited
|
||||
|
||||
Revision 1.5 2002/09/07 16:01:18 peter
|
||||
* old logs removed and tabs fixed
|
||||
|
||||
Revision 1.4 2002/05/06 09:35:09 marco
|
||||
* Some stuff from 1.0.x ported
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user