* beos support from Olivier Coursiere

git-svn-id: trunk@7443 -
This commit is contained in:
peter 2007-05-24 07:16:17 +00:00
parent 6a51ea7eac
commit dd3fdac68e
12 changed files with 113 additions and 3 deletions

View File

@ -206,6 +206,12 @@ FOR FPC THESE ARE THE TRANSLATIONS
{$DEFINE OS_UNIX}
{$ENDIF}
{$IFDEF BEOS}
{$UNDEF OS_DOS}
{$DEFINE OS_BEOS}
{$DEFINE OS_UNIX}
{$ENDIF}
{------------------------------------------------}
{ FPC Netware COMPILER changes operating system }
{------------------------------------------------}

View File

@ -16,6 +16,8 @@ dirs_netbsd=gdbint libasync \
mysql ibase postgres oracle odbc imagemagick httpd
dirs_openbsd=gdbint libasync \
mysql ibase postgres oracle odbc imagemagick httpd
dirs_beos=gdbint libasync graph \
mysql ibase postgres odbc sqlite pthreads imagemagick
dirs_freebsd=gdbint libasync graph \
mysql ibase postgres oracle odbc sqlite pthreads imagemagick httpd
dirs_darwin=libasync \

View File

@ -219,6 +219,30 @@ interface
{$LINKLIB user32}
{$endif win32}
{$ifdef beos}
{ still need some work... stollen from netbsd}
{$undef NotImplemented}
{$LINKLIB gdb}
{$ifdef GDB_HAS_SIM}
{$LINKLIB sim}
{$endif GDB_HAS_SIM}
{$LINKLIB bfd}
{$LINKLIB readline}
{$LINKLIB opcodes}
{$LINKLIB history}
{$LINKLIB iberty}
{$LINKLIB ncurses}
{$LINKLIB m}
{$LINKLIB iberty}
{$LINKLIB intl}
{$ifdef GDB_USES_EXPAT_LIB}
{$LINKLIB expat}
{$endif GDB_USES_EXPAT_LIB}
{ does not seem to exist on netbsd LINKLIB dl}
{$LINKLIB c}
{$LINKLIB gcc}
{$endif beos}
{$ifdef go32v2}
{$define supportexceptions}
{$endif go32v2}

View File

@ -14,6 +14,7 @@ fpcpackage=y
[compiler]
sourcedir_linux=unix
sourcedir_beos=unix
sourcedir_freebsd=unix
sourcedir_darwin=unix
sourcedir_solaris=unix

View File

@ -9,6 +9,7 @@ version=2.0.0
[require]
packages=paszlib hash
packages_linux=netdb libasync pthreads
packages_beos=netdb libasync pthreads
packages_freebsd=netdb libasync pthreads
packages_darwin=netdb libasync pthreads
packages_solaris=netdb libasync pthreads
@ -34,6 +35,7 @@ units=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext \
iostream zstream cachecls avl_tree \
eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream \
streamex blowfish zipper streamio inicol pooledmm libtar streamcoll
units_beos=process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf
units_freebsd=process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf daemonapp
units_darwin=process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf daemonapp
units_solaris=process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf daemonapp

View File

@ -815,8 +815,45 @@ end;
{$ifdef beos}
{$i osposixh.inc}
{$i syscall.inc}
{$i beos.inc}
{ ------------------------- Images --------------------------- }
type
// Descriptive formats
status_t = Longint;
team_id = Longint;
image_id = Longint;
{ image types }
const
B_APP_IMAGE = 1;
B_LIBRARY_IMAGE = 2;
B_ADD_ON_IMAGE = 3;
B_SYSTEM_IMAGE = 4;
type
image_info = packed record
id : image_id;
_type : longint;
sequence: longint;
init_order: longint;
init_routine: pointer;
term_routine: pointer;
device: dev_t;
node: ino_t;
name: array[0..MAXPATHLEN-1] of char;
{ name: string[255];
name2: string[255];
name3: string[255];
name4: string[255];
name5: string[5];
}
text: pointer;
data: pointer;
text_size: longint;
data_size: longint;
end;
function get_next_image_info(team: team_id; var cookie:longint; var info:image_info; size: size_t) : status_t;cdecl; external 'root' name '_get_next_image_info';
function LoadElf32Beos:boolean;

View File

@ -72,6 +72,10 @@ function geterrnolocation: pcint; cdecl;external clib name '__error';
function geterrnolocation: pcint; cdecl;external clib name '___errno';
{$endif}
{$ifdef beos}
function geterrnolocation: pcint; cdecl;external 'root' name '_errnop';
{$endif}
function fpgetCerrno:cint;
begin

View File

@ -75,7 +75,11 @@ const
function fpmmap (addr:pointer;len:size_t;prot:cint;flags:cint;fd:cint;ofs:off_t):pointer; cdecl; external clib name 'mmap'+suffix64bit;
function fpmunmap (addr:pointer;len:size_t):cint; cdecl; external clib name 'munmap';
function FpIOCtl (Handle:cint;Ndx: culong;Data: Pointer):cint; cdecl; external clib name 'ioctl';
{$ifdef beos}
Function FPSelect (N:cint;readfds,writefds,exceptfds:pfdSet;TimeOut:PTimeVal):cint; cdecl; external 'net' name 'select';
{$else}
Function FPSelect (N:cint;readfds,writefds,exceptfds:pfdSet;TimeOut:PTimeVal):cint; cdecl; external clib name 'select';
{$endif}
function fpgetenv (name : pchar):pchar; cdecl; external clib name 'getenv';
Function FpKill (pid : TPid; sig: cInt): cInt; cdecl; external clib name 'kill';
Function FpGetpid : TPid; cdecl;external clib name 'getpid';
@ -99,7 +103,10 @@ const
{$linklib aio}
Function FPnanosleep (const rqtp: ptimespec; rmtp: ptimespec): cint; cdecl; external 'rt' name 'nanosleep';
{$else solaris}
{$ifndef beos}
Function FPnanosleep (const rqtp: ptimespec; rmtp: ptimespec): cint; cdecl; external clib name 'nanosleep';
{$else}
{$endif}
{$endif solaris}
function fpNice (N:cint):cint; cdecl; external clib name 'nice';
Function fpGetPriority (Which,Who:cint):cint; cdecl; external clib name 'getpriority';
@ -107,7 +114,11 @@ const
Function fpSymlink (oldname,newname:pchar):cint; cdecl; external clib name 'symlink';
Function fpReadLink (name,linkname:pchar;maxlen:size_t):cint; cdecl; external clib name 'readlink';
Function FpUmask (cmask : TMode): TMode; cdecl; external clib name 'umask';
{$ifndef beos}
function fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint; cdecl; external clib name 'settimeofday';
{$else}
// function fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint;
{$endif}
function FpGetRLimit(resource : cInt; rlim : PRLimit) : cInt; cdecl; external clib name 'getrlimit';
{$ifdef HAS_UGETRLIMIT}
{ there is no ugetrlimit libc call, just map it to the getrlimit call in these cases }

View File

@ -44,10 +44,14 @@ const
EsockEINVAL = EsysEINVAL;
EsockEACCESS = ESysEAcces;
EsockEMFILE = ESysEmfile;
{$ifndef beos}
EsockEMSGSIZE = ESysEMsgSize;
{$endif beos}
EsockENOBUFS = ESysENoBufs;
EsockENOTCONN = ESysENotConn;
{$ifndef beos}
EsockENOTSOCK = ESysENotSock;
{$endif beos}
EsockEPROTONOSUPPORT = ESysEProtoNoSupport;
EsockEWOULDBLOCK = ESysEWouldBlock;

View File

@ -55,6 +55,7 @@ var
exit;
end;
end
{$ifndef beos}
else if (ino_t(d^.d_fileno)=myino) and (st.st_dev=mydev) then
begin
fpclosedir(dirstream^);
@ -62,6 +63,7 @@ var
mysearch:=true;
exit;
end;
{$endif}
end;
d:=fpReaddir(dirstream^);
end;
@ -73,8 +75,10 @@ begin
TTYName:='';
if (fpfstat(handle,st)=-1) or (isatty (handle)<>1) then
exit;
{$ifndef beos}
mydev:=st.st_dev;
myino:=st.st_ino;
{$endif}
mysearch('/dev');
end;

View File

@ -570,13 +570,17 @@ end;
Function fpFlock (var T : text;mode : cint) : cint;
begin
{$ifndef beos}
fpFlock:=fpFlock(TextRec(T).Handle,mode);
{$endif}
end;
Function fpFlock (var F : File;mode : cint) :cint;
begin
{$ifndef beos}
fpFlock:=fpFlock(FileRec(F).Handle,mode);
{$endif}
end;
Function SelectText(var T:Text;TimeOut :PTimeval):cint;
@ -623,11 +627,13 @@ begin
fpseterrno(ESysEBADF);
exit;
end;
{$if not(defined(bsd)) and not(defined(solaris)) }
{$if not(defined(bsd)) and not(defined(solaris)) and not(defined(beos)) }
p^.dd_nextoff:=fplseek(p^.dd_fd,loc,seek_set);
{$endif}
{$if not(defined(beos))}
p^.dd_size:=0;
p^.dd_loc:=0;
{$endif}
end;
function TellDir(p:pdir):TOff;
@ -638,7 +644,9 @@ begin
telldir:=-1;
exit;
end;
{$ifndef beos}
telldir:=fplseek(p^.dd_fd,0,seek_cur)
{$endif}
{ We could try to use the nextoff field here, but on my 1.2.13
kernel, this gives nothing... This may have to do with
the readdir implementation of libc... I also didn't find any trace of

View File

@ -18,11 +18,18 @@ type filedesarray=array[0..1] of cint;
{$ifdef solaris}
Function fpFlock (fd,mode : longint) : cint;{$ifdef IN_SYSTEM}forward;{$endif IN_SYSTEM}
{$else solaris}
{$ifndef beos}
Function fpFlock (fd,mode : longint) : cint; cdecl; external clib name 'flock';
{$endif beos}
{$endif solaris}
{$ifndef beos}
Function fStatFS(Fd:Longint;Var Info:tstatfs):cint; cdecl; external clib name 'fstatfs';
{$endif beos}
Function fsync (fd : cint) : cint; cdecl; external clib name 'fsync';
{$ifndef beos}
Function StatFS (Path:pchar;Var Info:tstatfs):cint; cdecl; external clib name 'statfs';
{$endif beos}
function pipe (var fildes: filedesarray):cint; cdecl; external clib name 'pipe';
function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; cdecl; external clib name 'gettimeofday';