* UnixType changes. Please report problems to me.

This commit is contained in:
marco 2004-03-04 22:15:16 +00:00
parent afcb1d6c14
commit 93622ec2e8
18 changed files with 264 additions and 41 deletions

View File

@ -16,6 +16,11 @@
Unit BaseUnix;
Interface
Uses UnixType;
{$i aliasptp.inc}
{$packrecords C}
{$define oldreaddir} // Keep using readdir system call instead
// of userland getdents stuff.
@ -76,7 +81,10 @@ end.
{
$Log$
Revision 1.8 2004-01-04 21:04:08 jonas
Revision 1.9 2004-03-04 22:15:16 marco
* UnixType changes. Please report problems to me.
Revision 1.8 2004/01/04 21:04:08 jonas
* declare C-library routines as external in libc for Darwin (so we
generate proper import entries)

View File

@ -21,7 +21,9 @@
{ POSIX STRUCTURES }
{***********************************************************************}
{$ifdef FPC_IS_SYSTEM}
{$i ptypes.inc}
{$ENDIF}
{$ifdef cpupowerpc}
{$ifdef netbsd}
@ -42,6 +44,7 @@ CONST // OS specific parameters for general<fd,sig>set behaviou
ln2bitsinword = 5; { 32bit : ln(32)/ln(2)=5 }
ln2bitmask = 1 shl ln2bitsinword - 1;
wordsinfdset = FD_MAXFDSET DIV BITSINWORD; // words in fdset_t
wordsinsigset = SIG_MAXSIG DIV BITSINWORD;
TYPE
{ system information services }
@ -214,7 +217,10 @@ CONST
{
$Log$
Revision 1.8 2004-02-29 13:46:52 marco
Revision 1.9 2004-03-04 22:15:16 marco
* UnixType changes. Please report problems to me.
Revision 1.8 2004/02/29 13:46:52 marco
* forgotten?
Revision 1.7 2004/01/04 20:08:45 jonas

View File

@ -22,11 +22,15 @@ Interface
{$define FPC_USE_SYSCALL}
{$endif}
{$I ptypes.inc}
{ I ptypes.inc}
{$Packrecords C}
type psize_t=^size_t;
// type psize_t=^size_t;
Type size_t=dword;
psize_t=^dword;
cint = longint;
cuint = dword;
{
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@ -148,7 +152,10 @@ end.
{
$Log$
Revision 1.6 2003-12-30 12:26:21 marco
Revision 1.7 2004-03-04 22:15:16 marco
* UnixType changes. Please report problems to me.
Revision 1.6 2003/12/30 12:26:21 marco
* FPC_USE_LIBC
Revision 1.5 2003/11/19 17:11:40 marco

View File

@ -1,5 +1,5 @@
#
# Don't edit, this file is generated by FPCMake Version 1.1 [2004/02/22]
# Don't edit, this file is generated by FPCMake Version 1.1 [2004/01/05]
#
default: all
MAKEFILETARGETS=linux go32v2 win32 os2 freebsd beos netbsd amiga atari sunos qnx netware openbsd wdosx palmos macos darwin emx watcom
@ -185,14 +185,11 @@ override FPCDIR:=$(FPCDIR)/..
ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
override FPCDIR:=$(FPCDIR)/..
ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
override FPCDIR:=$(BASEDIR)
ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
override FPCDIR=c:/pp
endif
endif
endif
endif
endif
ifndef CROSSDIR
CROSSDIR:=$(FPCDIR)/cross/$(FULL_TARGET)
endif
@ -235,7 +232,7 @@ GRAPHDIR=$(INC)/graph
ifndef USELIBGGI
USELIBGGI=NO
endif
override TARGET_UNITS+=$(SYSTEMUNIT) objpas strings syscall sysctl baseunix unixutil unix rtlconst initc dos dl termio objects printer sysutils typinfo systhrds types classes math varutils cpu mmx charset ucomplex crt getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard console serial variants sysctl dateutils sysconst cthreads
override TARGET_UNITS+=$(SYSTEMUNIT) objpas strings syscall sysctl unixtype baseunix unixutil unix rtlconst initc dos dl termio objects printer sysutils typinfo systhrds types classes math varutils cpu mmx charset ucomplex crt getopts heaptrc lineinfo errors sockets gpm ipc terminfo video mouse keyboard console serial variants sysctl dateutils sysconst cthreads
override TARGET_LOADERS+=prt0 cprt0 gprt0
override TARGET_RSTS+=math varutils typinfo classes variants dateutils sysconst
override INSTALL_FPCPACKAGE=y y
@ -1368,6 +1365,7 @@ dateutils$(PPUEXT): $(OBJPASDIR)/dateutils.pp baseunix$(PPUEXT) $(SYSTEMUNIT)$(P
strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
$(PROCINC)/strings.inc $(PROCINC)/stringss.inc\
$(SYSTEMUNIT)$(PPUEXT)
unixtype$(PPUEXT): $(UNIXINC)/unixtype.pp $(BSDINC)/ctypes.inc ptypes.inc $(SYSTEMUNIT)$(PPUEXT)
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 \

View File

@ -10,7 +10,7 @@ fpcpackage=y
[target]
loaders=prt0 cprt0 gprt0
units=$(SYSTEMUNIT) objpas strings syscall sysctl baseunix unixutil \
units=$(SYSTEMUNIT) objpas strings syscall sysctl unixtype baseunix unixutil \
unix rtlconst initc \
dos dl termio objects printer \
sysutils typinfo systhrds types classes math varutils \
@ -141,6 +141,8 @@ strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
# System Dependent Units
#
unixtype$(PPUEXT): $(UNIXINC)/unixtype.pp $(BSDINC)/ctypes.inc ptypes.inc $(SYSTEMUNIT)$(PPUEXT)
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 \
@ -244,3 +246,4 @@ sysctl$(PPUEXT) : $(BSDINC)/sysctl.pp $(SYSTEMUNIT)$(PPUEXT)
cthreads$(PPUEXT) : $(UNIXINC)/cthreads.pp systhrds$(PPUEXT)

View File

@ -99,12 +99,15 @@ CONST
SYS_NMLN = 32; {BSD utsname struct limit}
SIG_MAXSIG = 128; // highest signal version
wordsinsigset = 4; // words in sigset_t
// wordsinsigset = 4; // words in sigset_t
{
$Log$
Revision 1.9 2004-01-04 20:08:45 jonas
Revision 1.10 2004-03-04 22:15:16 marco
* UnixType changes. Please report problems to me.
Revision 1.9 2004/01/04 20:08:45 jonas
* moved SIG_MAXSIG and wordsinsigset constants from bunxtype.inc to
ptypes.inc (already there for Darwin)

View File

@ -160,12 +160,14 @@ begin
end;
{$else}
{$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]);
@ -185,6 +187,7 @@ begin
fpwaitpid(pl^,@res,0);
pclose:=res shr 8;
end;
{$ENDIF}
{$endif}
// can't have oldfpccall here, linux doesn't need it.
@ -275,7 +278,10 @@ end;
{
$Log$
Revision 1.18 2004-01-01 17:07:21 marco
Revision 1.19 2004-03-04 22:15:16 marco
* UnixType changes. Please report problems to me.
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

View File

@ -1,5 +1,5 @@
#
# Don't edit, this file is generated by FPCMake Version 1.1 [2004/02/22]
# Don't edit, this file is generated by FPCMake Version 1.1 [2004/01/05]
#
default: all
MAKEFILETARGETS=linux go32v2 win32 os2 freebsd beos netbsd amiga atari sunos qnx netware openbsd wdosx palmos macos darwin emx watcom
@ -185,14 +185,11 @@ override FPCDIR:=$(FPCDIR)/..
ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
override FPCDIR:=$(FPCDIR)/..
ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
override FPCDIR:=$(BASEDIR)
ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
override FPCDIR=c:/pp
endif
endif
endif
endif
endif
ifndef CROSSDIR
CROSSDIR:=$(FPCDIR)/cross/$(FULL_TARGET)
endif
@ -242,7 +239,7 @@ GRAPHDIR=$(INC)/graph
ifndef USELIBGGI
USELIBGGI=NO
endif
override TARGET_UNITS+=$(SYSTEMUNIT) baseunix strings systhrds objpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc $(CPU_UNITS) dos crt objects printer ggigraph sysutils typinfo math varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconst
override TARGET_UNITS+=$(SYSTEMUNIT) unixtype baseunix strings systhrds objpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc $(CPU_UNITS) dos crt objects printer ggigraph sysutils typinfo math varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconst
override TARGET_LOADERS+=prt0 dllprt0 cprt0 gprt0 cprt21 gprt21
override TARGET_RSTS+=math varutils typinfo variants systhrds sysconst rtlconst
override CLEAN_UNITS+=syslinux linux
@ -1386,6 +1383,7 @@ strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
unix$(PPUEXT) : unix.pp strings$(PPUEXT) baseunix$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
sysc11.inc systypes.inc sysconst.inc $(UNIXINC)/timezone.inc $(SYSTEMUNIT)$(PPUEXT) \
unixsysc.inc
unixtype$(PPUEXT) : $(UNIXINC)/unixtype.pp ptypes.inc ctypes.inc $(SYSTEMUNIT)$(PPUEXT)
baseunix$(PPUEXT) : errno.inc bunxtype.inc ptypes.inc ctypes.inc \
signal.inc $(UNIXINC)/bunxh.inc bunxmain.inc ostypes.inc \
bunxfunc.inc $(CPU_TARGET)/syscallh.inc $(CPU_TARGET)/sysnr.inc \

View File

@ -7,7 +7,7 @@ main=rtl
[target]
loaders=prt0 dllprt0 cprt0 gprt0 cprt21 gprt21
units=$(SYSTEMUNIT) baseunix strings systhrds objpas syscall unixutil \
units=$(SYSTEMUNIT) unixtype baseunix strings systhrds objpas syscall unixutil \
heaptrc lineinfo \
$(LINUXUNIT1) termio unix $(LINUXUNIT2) initc $(CPU_UNITS) \
dos crt objects printer ggigraph \
@ -165,6 +165,8 @@ unix$(PPUEXT) : unix.pp strings$(PPUEXT) baseunix$(PPUEXT) $(INC)/textrec.inc $(
sysc11.inc systypes.inc sysconst.inc $(UNIXINC)/timezone.inc $(SYSTEMUNIT)$(PPUEXT) \
unixsysc.inc
unixtype$(PPUEXT) : $(UNIXINC)/unixtype.pp ptypes.inc ctypes.inc $(SYSTEMUNIT)$(PPUEXT)
baseunix$(PPUEXT) : errno.inc bunxtype.inc ptypes.inc ctypes.inc \
signal.inc $(UNIXINC)/bunxh.inc bunxmain.inc ostypes.inc \
bunxfunc.inc $(CPU_TARGET)/syscallh.inc $(CPU_TARGET)/sysnr.inc \

View File

@ -16,6 +16,11 @@
Unit BaseUnix;
Interface
Uses UnixType;
{$i aliasptp.inc}
{$define oldreaddir} // Keep using readdir system call instead
// of userland getdents stuff.
{$define usedomain} // Allow uname with "domain" entry.
@ -74,7 +79,10 @@ end.
{
$Log$
Revision 1.8 2004-01-04 21:04:08 jonas
Revision 1.9 2004-03-04 22:15:16 marco
* UnixType changes. Please report problems to me.
Revision 1.8 2004/01/04 21:04:08 jonas
* declare C-library routines as external in libc for Darwin (so we
generate proper import entries)

View File

@ -18,12 +18,14 @@
{ Base Unix Structures }
{***********************************************************************}
{$IFDEF FPC_IS_SYSTEM}
{$i ptypes.inc}
{$ENDIF}
CONST
// SYS_NMLM = 65;
UTSNAME_LENGTH = SYS_NMLM;
UTSNAME_LENGTH = SYS_NMLN;
UTSNAME_NODENAME_LENGTH = UTSNAME_LENGTH;
{$ifdef usedomain}
UTSNAME_DOMAIN_LENGTH = UTSNAME_LENGTH;
@ -31,11 +33,6 @@ CONST
FD_MAXFDSET = 1024;
BITSINWORD = 8*sizeof(longint);
{$ifdef FPC_USE_LIBC}
SIG_MAXSIG = 1024; // highest signal version
{$else}
SIG_MAXSIG = 128; // highest signal version
{$endif}
wordsinsigset = SIG_MAXSIG DIV BITSINWORD; // words in sigset_t
wordsinfdset = FD_MAXFDSET DIV BITSINWORD; // words in fdset_t
ln2bitsinword = 5; { 32bit : ln(32)/ln(2)=5 }
@ -271,7 +268,10 @@ const
{
$Log$
Revision 1.8 2004-02-22 15:00:27 marco
Revision 1.9 2004-03-04 22:15:16 marco
* UnixType changes. Please report problems to me.
Revision 1.8 2004/02/22 15:00:27 marco
* genfdset word count added. Small fix for libc maxsigsetsize
Revision 1.7 2004/01/31 16:17:38 florian

View File

@ -139,14 +139,22 @@ CONST
{ System limits, POSIX value in parentheses, used for buffer and stack allocation }
{ took idefix' values}
ARG_MAX = 131072; {4096} { Maximum number of argument size }
NAME_MAX = 255; {14} { Maximum number of bytes in filename }
PATH_MAX = 4095; {255} { Maximum number of bytes in pathname }
SYS_NMLM = 65;
ARG_MAX = 131072; {4096} { Maximum number of argument size }
NAME_MAX = 255; {14} { Maximum number of bytes in filename }
PATH_MAX = 4095; {255} { Maximum number of bytes in pathname }
SYS_NMLN = 65;
{$ifdef FPC_USE_LIBC}
SIG_MAXSIG = 1024; // highest signal version
{$else}
SIG_MAXSIG = 128; // highest signal version
{$endif}
{
$Log$
Revision 1.7 2004-01-11 09:56:20 jonas
Revision 1.8 2004-03-04 22:15:16 marco
* UnixType changes. Please report problems to me.
Revision 1.7 2004/01/11 09:56:20 jonas
* moved tstatfs from systypes.inc to ptypes.inc to fix make cycle with
-dFPC_USE_LIBC (systypes.inc is now completely commented out)

49
rtl/unix/aliasctp.inc Normal file
View File

@ -0,0 +1,49 @@
{
$Id$
This file is part of the Free Pascal run time library.
Copyright (c) 2004 by Marco van de Voort
Member of the Free Pascal development team
Aliases for basic types for C interfacing, for reloading them
in other units from unit unixtype in a typesafe way.
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
cInt8 = UnixType.cInt8;
cUInt8 = UnixType.cUInt8;
cUInt16 = UnixType.cUInt16;
cInt16 = UnixType.cInt16;
cInt32 = UnixType.cInt32;
cUInt32 = UnixType.cUInt32;
cInt64 = UnixType.cInt64;
cUInt64 = UnixType.cUInt64;
cuchar = UnixType.cuchar;
cInt = UnixType.cInt;
cUInt = UnixType.cUInt;
cLong = UnixType.cLong;
cuLong = UnixType.cuLong;
cshort = UnixType.cshort;
cushort = UnixType.cushort;
pcInt = UnixType.pcInt;
pcUInt = UnixType.pcUInt;
pcLong = UnixType.pcLong;
pculong = UnixType.pculong;
pcshort = UnixType.pcshort;
pcushort= UnixType.pcushort;
{
$Log$
Revision 1.1 2004-03-04 22:15:16 marco
* UnixType changes. Please report problems to me.
}

85
rtl/unix/aliasptp.inc Normal file
View File

@ -0,0 +1,85 @@
{
$Id$
This file is part of the Free Pascal run time library.
Copyright (c) 2004 by Marco van de Voort
Member of the Free Pascal development team
Aliases for Unix base types and constants, to import them into
multiple units in a typesafe way.
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.
**********************************************************************}
{$i aliasctp.inc}
type
dev_t = UnixType.dev_t;
TDev = UnixType.TDev;
pDev = UnixType.pDev;
gid_t = UnixType.gid_t;
TGid = UnixType.TGid;
pGid = UnixType.pGid;
ino_t = UnixType.ino_t;
TIno = UnixType.TIno;
pIno = UnixType.pIno;
mode_t = UnixType.mode_t;
TMode = UnixType.TMode;
pMode = UnixType.pMode;
nlink_t = UnixType.nlink_t;
TnLink = UnixType.TnLink;
pnLink = UnixType.pnLink;
off_t = UnixType.off_t;
TOff = UnixType.TOff;
pOff = UnixType.pOff;
pid_t = UnixType.pid_t;
TPid = UnixType.TPid;
pPid = UnixType.pPid;
size_t = UnixType.size_t;
TSize = UnixType.TSize;
pSize = UnixType.pSize;
ssize_t = UnixType.ssize_t;
TsSize = UnixType.TsSize;
psSize = UnixType.psSize;
uid_t = UnixType.uid_t;
TUid = UnixType.TUid;
pUid = UnixType.pUid;
clock_t = UnixType.clock_t;
TClock = UnixType.TClock;
pClock = UnixType.pClock;
time_t = UnixType.time_t;
TTime = UnixType.TTime;
pTime = UnixType.pTime;
ptime_t = UnixType.ptime_t;
socklen_t= UnixType.socklen_t;
TSocklen = UnixType.TSocklen;
pSocklen = UnixType.pSocklen;
timeval = UnixType.timeval;
ptimeval = UnixType.ptimeval;
TTimeVal = UnixType.TTimeVal;
timespec = UnixType.timespec;
ptimespec= UnixType.ptimespec;
Ttimespec= UnixType.Ttimespec;
CONST
ARG_MAX = UnixType.ARG_MAX;
NAME_MAX = UnixType.NAME_MAX;
PATH_MAX = UnixType.PATH_MAX;
SYS_NMLN = UnixType.SYS_NMLN;
SIG_MAXSIG = UnixType.SIG_MAXSIG;
// wordsinsigset = UnixType.wordsinsigset;
{
$Log$
Revision 1.1 2004-03-04 22:15:16 marco
* UnixType changes. Please report problems to me.
}

View File

@ -66,7 +66,7 @@ Procedure AddDisk(const path:string);
Implementation
Uses
Strings,UnixUtil,Unix,BaseUnix;
Strings,UnixUtil,Unix,BaseUnix,UnixType;
{******************************************************************************
--- Link C Lib if set ---
@ -832,7 +832,10 @@ End.
{
$Log$
Revision 1.30 2004-02-18 22:00:45 peter
Revision 1.31 2004-03-04 22:15:16 marco
* UnixType changes. Please report problems to me.
Revision 1.30 2004/02/18 22:00:45 peter
* dirptr changed to pointer
Revision 1.29 2004/02/18 19:08:27 florian

View File

@ -33,7 +33,7 @@ uses
implementation
Uses UnixUtil,Baseunix;
Uses UnixUtil,Baseunix,UnixType;
{$Define OS_FILEISREADONLY} // Specific implementation for Unix.
@ -629,7 +629,10 @@ end.
{
$Log$
Revision 1.36 2004-02-13 10:50:23 marco
Revision 1.37 2004-03-04 22:15:16 marco
* UnixType changes. Please report problems to me.
Revision 1.36 2004/02/13 10:50:23 marco
* Hopefully last large changes to fpexec and friends.
- naming conventions changes from Michael.
- shell functions get alternative under ifdef.

View File

@ -16,7 +16,9 @@
Unit Unix;
Interface
Uses UnixUtil,BaseUnix;
Uses UnixUtil,BaseUnix,UnixType;
{$i aliasptp.inc}
{$define POSIXWORKAROUND}
{ Get Types and Constants }
@ -1740,8 +1742,8 @@ End.
{
$Log$
Revision 1.67 2004-03-03 17:23:06 olle
* tiny tiny flaw fix
Revision 1.68 2004-03-04 22:15:17 marco
* UnixType changes. Please report problems to me.
Revision 1.66 2004/02/16 13:21:18 marco
* fpexec for popen

34
rtl/unix/unixtype.pp Normal file
View File

@ -0,0 +1,34 @@
{
$Id$
This file is part of the Free Pascal run time library.
(c) 2004 by Marco van de Voort
member of the Free Pascal development team.
THIS UNIT IS NOT FOR USE BY ENDUSERS. IT IS USED TO AVOID CERTAIN
CIRCULAR REFERENCE PROBLEMS.
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.
**********************************************************************}
unit unixtype;
Interface
{$i ptypes.inc}
Implementation
End.
{
$Log$
Revision 1.1 2004-03-04 22:15:17 marco
* UnixType changes. Please report problems to me.
}