sysunix.inc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by Michael Van Canneyt,
  5. member of the Free Pascal development team.
  6. This is the core of the system unit *nix systems (now FreeBSD
  7. and Unix).
  8. See the file COPYING.FPC, included in this distribution,
  9. for details about the copyright.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. **********************************************************************}
  14. { These things are set in the makefile, }
  15. { But you can override them here.}
  16. { If you use an aout system, set the conditional AOUT}
  17. { $Define AOUT}
  18. {$I system.inc}
  19. { used in syscall to report errors.}
  20. var
  21. Errno : longint;
  22. { Include constant and type definitions }
  23. {$i errno.inc } { Error numbers }
  24. {$i sysnr.inc } { System call numbers }
  25. {$i sysconst.inc } { Miscellaneous constants }
  26. {$i systypes.inc } { Types needed for system calls }
  27. { Read actual system call definitions. }
  28. {$i signal.inc}
  29. {$i syscalls.inc }
  30. {*****************************************************************************
  31. Misc. System Dependent Functions
  32. *****************************************************************************}
  33. {$ifdef I386}
  34. { this should be defined in i386 directory !! PM }
  35. const
  36. fpucw : word = $1332;
  37. FPU_Invalid = 1;
  38. FPU_Denormal = 2;
  39. FPU_DivisionByZero = 4;
  40. FPU_Overflow = 8;
  41. FPU_Underflow = $10;
  42. FPU_StackUnderflow = $20;
  43. FPU_StackOverflow = $40;
  44. {$endif I386}
  45. Procedure ResetFPU;
  46. begin
  47. {$ifdef I386}
  48. asm
  49. fninit
  50. fldcw fpucw
  51. end;
  52. {$endif I386}
  53. end;
  54. procedure prthaltproc;external name '_haltproc';
  55. Procedure System_exit;
  56. Begin
  57. prthaltproc;
  58. End;
  59. Function ParamCount: Longint;
  60. Begin
  61. Paramcount:=argc-1;
  62. End;
  63. Function ParamStr(l: Longint): String;
  64. var
  65. link,
  66. hs : string;
  67. i : longint;
  68. begin
  69. if l=0 then
  70. begin
  71. str(sys_getpid,hs);
  72. {$ifdef FreeBSD}
  73. hs:='/proc/'+hs+'/file'#0;
  74. {$else}
  75. hs:='/proc/'+hs+'/exe'#0;
  76. {$endif}
  77. i:=Sys_readlink(@hs[1],@link[1],high(link));
  78. { it must also be an absolute filename, linux 2.0 points to a memory
  79. location so this will skip that }
  80. if (i>0) and (link[1]='/') then
  81. begin
  82. link[0]:=chr(i);
  83. paramstr:=link;
  84. end
  85. else
  86. paramstr:=strpas(argv[0]);
  87. end
  88. else
  89. if (l>0) and (l<argc) then
  90. paramstr:=strpas(argv[l])
  91. else
  92. paramstr:='';
  93. end;
  94. Procedure Randomize;
  95. Begin
  96. randseed:=sys_time;
  97. End;
  98. {*****************************************************************************
  99. Heap Management
  100. *****************************************************************************}
  101. var
  102. _HEAP : pointer;external name 'HEAP';
  103. _HEAPSIZE : longint;external name 'HEAPSIZE';
  104. function getheapstart:pointer;assembler;
  105. {$undef fpc_getheapstart_ok}
  106. {$ifdef i386}
  107. {$define fpc_getheapstart_ok}
  108. asm
  109. leal _HEAP,%eax
  110. end ['EAX'];
  111. {$endif i386}
  112. {$ifdef m68k}
  113. {$define fpc_getheapstart_ok}
  114. asm
  115. lea.l _HEAP,a0
  116. move.l a0,d0
  117. end['A0','D0'];
  118. {$endif m68k}
  119. {$ifndef fpc_getheapstart_ok}
  120. {$error Getheapstart code is not implemented }
  121. {$endif not fpc_getheapstart_ok}
  122. function getheapsize:longint;assembler;
  123. {$undef fpc_getheapsize_ok}
  124. {$ifdef i386}
  125. {$define fpc_getheapsize_ok}
  126. asm
  127. movl _HEAPSIZE,%eax
  128. end ['EAX'];
  129. {$endif i386}
  130. {$ifdef m68k}
  131. {$define fpc_getheapsize_ok}
  132. asm
  133. move.l _HEAPSIZE,d0
  134. end ['D0'];
  135. {$endif m68k}
  136. {$ifndef fpc_getheapsize_ok}
  137. {$error Getheapsize code is not implemented }
  138. {$endif not fpc_getheapsize_ok}
  139. Function sbrk(size : longint) : Longint;
  140. begin
  141. sbrk:=Sys_mmap(0,Size,3,MAP_PRIVATE+MAP_ANONYMOUS,-1,0);
  142. if sbrk<>-1 then
  143. errno:=0;
  144. {! It must be -1, not 0 as before, see heap.inc. Should be in sysmmap?}
  145. end;
  146. { include standard heap management }
  147. {$I heap.inc}
  148. {*****************************************************************************
  149. Low Level File Routines
  150. *****************************************************************************}
  151. {
  152. The lowlevel file functions should take care of setting the InOutRes to the
  153. correct value if an error has occured, else leave it untouched
  154. }
  155. Procedure Errno2Inoutres;
  156. {
  157. Convert ErrNo error to the correct Inoutres value
  158. }
  159. begin
  160. if ErrNo=0 then { Else it will go through all the cases }
  161. exit;
  162. If errno<0 then Errno:=-errno;
  163. case ErrNo of
  164. Sys_ENFILE,
  165. Sys_EMFILE : Inoutres:=4;
  166. Sys_ENOENT : Inoutres:=2;
  167. Sys_EBADF : Inoutres:=6;
  168. Sys_ENOMEM,
  169. Sys_EFAULT : Inoutres:=217;
  170. Sys_EINVAL : Inoutres:=218;
  171. Sys_EPIPE,
  172. Sys_EINTR,
  173. Sys_EIO,
  174. Sys_EAGAIN,
  175. Sys_ENOSPC : Inoutres:=101;
  176. Sys_ENAMETOOLONG,
  177. Sys_ELOOP,
  178. Sys_ENOTDIR : Inoutres:=3;
  179. Sys_EROFS,
  180. Sys_EEXIST,
  181. Sys_EISDIR,
  182. Sys_EACCES : Inoutres:=5;
  183. Sys_ETXTBSY : Inoutres:=162;
  184. else
  185. InOutRes := Integer(Errno);
  186. end;
  187. end;
  188. Procedure Do_Close(Handle:Longint);
  189. Begin
  190. sys_close(Handle);
  191. {Errno2Inoutres;}
  192. End;
  193. Procedure Do_Erase(p:pchar);
  194. Begin
  195. sys_unlink(p);
  196. Errno2Inoutres;
  197. { tp compatible result }
  198. if (Errno=Sys_EISDIR) then
  199. InOutRes:=2;
  200. End;
  201. Procedure Do_Rename(p1,p2:pchar);
  202. Begin
  203. sys_rename(p1,p2);
  204. Errno2Inoutres;
  205. End;
  206. Function Do_Write(Handle,Addr,Len:Longint):longint;
  207. Begin
  208. repeat
  209. Do_Write:=sys_write(Handle,pchar(addr),len);
  210. until ErrNo<>Sys_EINTR;
  211. Errno2Inoutres;
  212. if Do_Write<0 then
  213. Do_Write:=0;
  214. End;
  215. Function Do_Read(Handle,Addr,Len:Longint):Longint;
  216. Begin
  217. repeat
  218. Do_Read:=sys_read(Handle,pchar(addr),len);
  219. until ErrNo<>Sys_EINTR;
  220. Errno2Inoutres;
  221. if Do_Read<0 then
  222. Do_Read:=0;
  223. End;
  224. Function Do_FilePos(Handle: Longint): Longint;
  225. Begin
  226. Do_FilePos:=sys_lseek(Handle, 0, Seek_Cur);
  227. Errno2Inoutres;
  228. End;
  229. Procedure Do_Seek(Handle,Pos:Longint);
  230. Begin
  231. sys_lseek(Handle, pos, Seek_set);
  232. errno2inoutres;
  233. End;
  234. Function Do_SeekEnd(Handle:Longint): Longint;
  235. begin
  236. Do_SeekEnd:=sys_lseek(Handle,0,Seek_End);
  237. errno2inoutres;
  238. end;
  239. Function Do_FileSize(Handle:Longint): Longint;
  240. var
  241. Info : Stat;
  242. Begin
  243. if sys_fstat(handle,info)=0 then
  244. Do_FileSize:=Info.Size
  245. else
  246. Do_FileSize:=0;
  247. Errno2Inoutres;
  248. End;
  249. Procedure Do_Truncate(Handle,fPos:longint);
  250. begin
  251. sys_ftruncate(handle,fpos);
  252. Errno2Inoutres;
  253. end;
  254. Procedure Do_Open(var f;p:pchar;flags:longint);
  255. {
  256. FileRec and textrec have both Handle and mode as the first items so
  257. they could use the same routine for opening/creating.
  258. when (flags and $100) the file will be append
  259. when (flags and $1000) the file will be truncate/rewritten
  260. when (flags and $10000) there is no check for close (needed for textfiles)
  261. }
  262. var
  263. oflags : longint;
  264. Begin
  265. { close first if opened }
  266. if ((flags and $10000)=0) then
  267. begin
  268. case FileRec(f).mode of
  269. fminput,fmoutput,fminout : Do_Close(FileRec(f).Handle);
  270. fmclosed : ;
  271. else
  272. begin
  273. inoutres:=102; {not assigned}
  274. exit;
  275. end;
  276. end;
  277. end;
  278. { reset file Handle }
  279. FileRec(f).Handle:=UnusedHandle;
  280. { We do the conversion of filemodes here, concentrated on 1 place }
  281. case (flags and 3) of
  282. 0 : begin
  283. oflags :=Open_RDONLY;
  284. FileRec(f).mode:=fminput;
  285. end;
  286. 1 : begin
  287. oflags :=Open_WRONLY;
  288. FileRec(f).mode:=fmoutput;
  289. end;
  290. 2 : begin
  291. oflags :=Open_RDWR;
  292. FileRec(f).mode:=fminout;
  293. end;
  294. end;
  295. if (flags and $1000)=$1000 then
  296. oflags:=oflags or (Open_CREAT or Open_TRUNC)
  297. else
  298. if (flags and $100)=$100 then
  299. oflags:=oflags or (Open_APPEND);
  300. { empty name is special }
  301. if p[0]=#0 then
  302. begin
  303. case FileRec(f).mode of
  304. fminput :
  305. FileRec(f).Handle:=StdInputHandle;
  306. fminout, { this is set by rewrite }
  307. fmoutput :
  308. FileRec(f).Handle:=StdOutputHandle;
  309. fmappend :
  310. begin
  311. FileRec(f).Handle:=StdOutputHandle;
  312. FileRec(f).mode:=fmoutput; {fool fmappend}
  313. end;
  314. end;
  315. exit;
  316. end;
  317. { real open call }
  318. FileRec(f).Handle:=sys_open(p,oflags,438);
  319. if (ErrNo=Sys_EROFS) and ((OFlags and Open_RDWR)<>0) then
  320. begin
  321. Oflags:=Oflags and not(Open_RDWR);
  322. FileRec(f).Handle:=sys_open(p,oflags,438);
  323. end;
  324. Errno2Inoutres;
  325. End;
  326. Function Do_IsDevice(Handle:Longint):boolean;
  327. {
  328. Interface to Unix ioctl call.
  329. Performs various operations on the filedescriptor Handle.
  330. Ndx describes the operation to perform.
  331. Data points to data needed for the Ndx function. The structure of this
  332. data is function-dependent.
  333. }
  334. var
  335. Data : array[0..255] of byte; {Large enough for termios info}
  336. begin
  337. Do_IsDevice:=(sys_ioctl(handle,IOCTL_TCGETS,@data)<>-1);
  338. end;
  339. {*****************************************************************************
  340. UnTyped File Handling
  341. *****************************************************************************}
  342. {$i file.inc}
  343. {*****************************************************************************
  344. Typed File Handling
  345. *****************************************************************************}
  346. {$i typefile.inc}
  347. {*****************************************************************************
  348. Text File Handling
  349. *****************************************************************************}
  350. {$DEFINE SHORT_LINEBREAK}
  351. {$DEFINE EXTENDED_EOF}
  352. {$i text.inc}
  353. {*****************************************************************************
  354. Directory Handling
  355. *****************************************************************************}
  356. Procedure MkDir(Const s: String);[IOCheck];
  357. Var
  358. Buffer: Array[0..255] of Char;
  359. Begin
  360. If (s='') or (InOutRes <> 0) then
  361. exit;
  362. Move(s[1], Buffer, Length(s));
  363. Buffer[Length(s)] := #0;
  364. sys_mkdir(@buffer, 511);
  365. Errno2Inoutres;
  366. End;
  367. Procedure RmDir(Const s: String);[IOCheck];
  368. Var
  369. Buffer: Array[0..255] of Char;
  370. Begin
  371. If (s='') or (InOutRes <> 0) then
  372. exit;
  373. Move(s[1], Buffer, Length(s));
  374. Buffer[Length(s)] := #0;
  375. sys_rmdir(@buffer);
  376. Errno2Inoutres;
  377. End;
  378. Procedure ChDir(Const s: String);[IOCheck];
  379. Var
  380. Buffer: Array[0..255] of Char;
  381. Begin
  382. If (s='') or (InOutRes <> 0) then
  383. exit;
  384. Move(s[1], Buffer, Length(s));
  385. Buffer[Length(s)] := #0;
  386. sys_chdir(@buffer);
  387. Errno2Inoutres;
  388. { file not exists is path not found under tp7 }
  389. if InOutRes=2 then
  390. InOutRes:=3;
  391. End;
  392. procedure GetDir (DriveNr: byte; var Dir: ShortString);
  393. var
  394. thisdir : stat;
  395. rootino,
  396. thisino,
  397. dotdotino : longint;
  398. rootdev,
  399. thisdev,
  400. dotdotdev : dev_t;
  401. thedir,dummy : string[255];
  402. dirstream : pdir;
  403. d : pdirent;
  404. mountpoint,validdir : boolean;
  405. predot : string[255];
  406. begin
  407. drivenr:=0;
  408. dir:='';
  409. thedir:='/'#0;
  410. if sys_stat(@thedir[1],thisdir)<0 then
  411. exit;
  412. rootino:=thisdir.ino;
  413. rootdev:=thisdir.dev;
  414. thedir:='.'#0;
  415. if sys_stat(@thedir[1],thisdir)<0 then
  416. exit;
  417. thisino:=thisdir.ino;
  418. thisdev:=thisdir.dev;
  419. { Now we can uniquely identify the current and root dir }
  420. thedir:='';
  421. predot:='';
  422. while not ((thisino=rootino) and (thisdev=rootdev)) do
  423. begin
  424. { Are we on a mount point ? }
  425. dummy:=predot+'..'#0;
  426. if sys_stat(@dummy[1],thisdir)<0 then
  427. exit;
  428. dotdotino:=thisdir.ino;
  429. dotdotdev:=thisdir.dev;
  430. mountpoint:=(thisdev<>dotdotdev);
  431. { Now, Try to find the name of this dir in the previous one }
  432. dirstream:=opendir (@dummy[1]);
  433. if dirstream=nil then
  434. exit;
  435. repeat
  436. d:=sys_readdir (dirstream);
  437. validdir:=false;
  438. if (d<>nil) and
  439. (not ((d^.name[0]='.') and ((d^.name[1]=#0) or ((d^.name[1]='.')
  440. and (d^.name[2]=#0))))) and
  441. (mountpoint or (d^.ino=thisino)) then
  442. begin
  443. dummy:=predot+'../'+strpas(@(d^.name[0]))+#0;
  444. validdir:=not (sys_stat (@(dummy[1]),thisdir)<0);
  445. end
  446. else
  447. validdir:=false;
  448. until (d=nil) or
  449. ((validdir) and (thisdir.dev=thisdev) and (thisdir.ino=thisino) );
  450. { At this point, d.name contains the name of the current dir}
  451. if (d<>nil) then
  452. thedir:='/'+strpas(@(d^.name[0]))+thedir;
  453. { closedir also makes d invalid }
  454. if (closedir(dirstream)<0) or (d=nil) then
  455. exit;
  456. thisdev:=dotdotdev;
  457. thisino:=dotdotino;
  458. predot:=predot+'../';
  459. end;
  460. { Now rootino=thisino and rootdev=thisdev so we've reached / }
  461. dir:=thedir
  462. end;
  463. {$ifdef linux}
  464. {*****************************************************************************
  465. Thread Handling
  466. *****************************************************************************}
  467. { include threading stuff, this is os independend part }
  468. {$I thread.inc}
  469. {$endif linux}
  470. {*****************************************************************************
  471. SystemUnit Initialization
  472. *****************************************************************************}
  473. {$ifdef BSD}
  474. procedure SignalToRunerror(Sig: longint; SigContext: SigContextRec;someptr:pointer); cdecl;
  475. {$else}
  476. {$ifdef Solaris}
  477. procedure SignalToRunerror(Sig: longint; SigContext: SigContextRec;someptr:pointer); cdecl;
  478. {$else}
  479. procedure SignalToRunerror(Sig: longint; SigContext: SigContextRec); cdecl;
  480. {$endif}
  481. {$ENDIF}
  482. var
  483. res,fpustate : word;
  484. begin
  485. res:=0;
  486. case sig of
  487. SIGFPE :
  488. begin
  489. { this is not allways necessary but I don't know yet
  490. how to tell if it is or not PM }
  491. {$ifdef I386}
  492. fpustate:=0;
  493. res:=200;
  494. {$ifndef FreeBSD}
  495. if assigned(SigContext.fpstate) then
  496. fpuState:=SigContext.fpstate^.sw;
  497. {$else}
  498. fpustate:=SigContext.en_sw;
  499. {$ifdef SYSTEM_DEBUG}
  500. writeln('xx:',sigcontext.en_tw,' ',sigcontext.en_cw);
  501. {$endif SYSTEM_DEBUG}
  502. {$endif}
  503. {$ifdef SYSTEM_DEBUG}
  504. Writeln(stderr,'FpuState = ',FpuState);
  505. {$endif SYSTEM_DEBUG}
  506. if (FpuState and $7f) <> 0 then
  507. begin
  508. { first check te more precise options }
  509. if (FpuState and FPU_DivisionByZero)<>0 then
  510. res:=200
  511. else if (FpuState and FPU_Overflow)<>0 then
  512. res:=205
  513. else if (FpuState and FPU_Underflow)<>0 then
  514. res:=206
  515. else if (FpuState and FPU_Denormal)<>0 then
  516. res:=216
  517. else if (FpuState and (FPU_StackOverflow or FPU_StackUnderflow))<>0 then
  518. res:=207
  519. else if (FpuState and FPU_Invalid)<>0 then
  520. res:=216
  521. else
  522. res:=207; {'Coprocessor Error'}
  523. end;
  524. {$endif I386}
  525. ResetFPU;
  526. end;
  527. SIGILL,
  528. SIGBUS,
  529. SIGSEGV :
  530. res:=216;
  531. end;
  532. { give runtime error at the position where the signal was raised }
  533. if res<>0 then
  534. begin
  535. {$ifdef I386}
  536. {$ifdef FreeBSD}
  537. HandleErrorAddrFrame(res,SigContext.sc_eip,SigContext.sc_ebp);
  538. {$else}
  539. HandleErrorAddrFrame(res,SigContext.eip,SigContext.ebp);
  540. {$endif}
  541. {$else}
  542. HandleError(res);
  543. {$endif}
  544. end;
  545. end;
  546. Procedure InstallSignals;
  547. const
  548. {$Ifndef BSD}
  549. {$ifdef solaris}
  550. act: SigActionRec =(sa_flags:SA_SIGINFO;Handler:(sa:@signaltorunerror;sa_mask:0);
  551. {$else}
  552. act: SigActionRec = (handler:(Sa:@SignalToRunError);sa_mask:0;sa_flags:0;
  553. Sa_restorer: NIL);
  554. {$endif}
  555. {$ELSE}
  556. act: SigActionRec = (handler:(Sa:@SignalToRunError);sa_flags:SA_SIGINFO;
  557. sa_mask:0);
  558. {$endif}
  559. oldact: PSigActionRec = Nil; {Probably not necessary anymore, now
  560. VAR is removed}
  561. begin
  562. ResetFPU;
  563. SigAction(SIGFPE,@act,oldact);
  564. {$ifndef Solaris}
  565. SigAction(SIGSEGV,@act,oldact);
  566. SigAction(SIGBUS,@act,oldact);
  567. SigAction(SIGILL,@act,oldact);
  568. {$endif}
  569. end;
  570. procedure SetupCmdLine;
  571. var
  572. bufsize,
  573. len,j,
  574. size,i : longint;
  575. found : boolean;
  576. buf : array[0..1026] of char;
  577. procedure AddBuf;
  578. begin
  579. reallocmem(cmdline,size+bufsize);
  580. move(buf,cmdline[size],bufsize);
  581. inc(size,bufsize);
  582. bufsize:=0;
  583. end;
  584. begin
  585. size:=0;
  586. bufsize:=0;
  587. i:=0;
  588. while (i<argc) do
  589. begin
  590. len:=strlen(argv[i]);
  591. if len>sizeof(buf)-2 then
  592. len:=sizeof(buf)-2;
  593. found:=false;
  594. for j:=1 to len do
  595. if argv[i][j]=' ' then
  596. begin
  597. found:=true;
  598. break;
  599. end;
  600. if bufsize+len>=sizeof(buf)-2 then
  601. AddBuf;
  602. if found then
  603. begin
  604. buf[bufsize]:='"';
  605. inc(bufsize);
  606. end;
  607. move(argv[i]^,buf[bufsize],len);
  608. inc(bufsize,len);
  609. if found then
  610. begin
  611. buf[bufsize]:='"';
  612. inc(bufsize);
  613. end;
  614. if i<argc then
  615. buf[bufsize]:=' '
  616. else
  617. buf[bufsize]:=#0;
  618. inc(bufsize);
  619. inc(i);
  620. end;
  621. AddBuf;
  622. end;
  623. Begin
  624. { Set up signals handlers }
  625. InstallSignals;
  626. { Setup heap }
  627. InitHeap;
  628. InitExceptions;
  629. { Arguments }
  630. SetupCmdLine;
  631. { Setup stdin, stdout and stderr }
  632. OpenStdIO(Input,fmInput,StdInputHandle);
  633. OpenStdIO(Output,fmOutput,StdOutputHandle);
  634. OpenStdIO(StdOut,fmOutput,StdOutputHandle);
  635. OpenStdIO(StdErr,fmOutput,StdErrorHandle);
  636. { Reset IO Error }
  637. InOutRes:=0;
  638. End.
  639. {
  640. $Log$
  641. Revision 1.18 2001-10-14 13:33:21 peter
  642. * start of thread support for linux
  643. Revision 1.17 2001/09/30 21:10:20 peter
  644. * erase(directory) returns now 2 to be tp compatible
  645. Revision 1.16 2001/08/05 12:24:20 peter
  646. * m68k merges
  647. Revision 1.15 2001/07/16 19:51:36 marco
  648. * A small note, copied from the Solaris patch. Do_close needs errnotoiores?
  649. Revision 1.14 2001/07/15 11:57:16 peter
  650. * merged m68k updates
  651. Revision 1.13 2001/07/13 22:05:09 peter
  652. * cygwin updates
  653. Revision 1.12 2001/06/02 19:24:49 peter
  654. * chdir rte 2 mapped to 3
  655. Revision 1.11 2001/06/02 00:31:31 peter
  656. * merge unix updates from the 1.0 branch, mostly related to the
  657. solaris target
  658. Revision 1.10 2001/04/23 20:33:31 peter
  659. * also install sig handlers for sigill,sigbus
  660. Revision 1.9 2001/04/13 22:39:05 peter
  661. * removed warning
  662. Revision 1.8 2001/04/12 17:53:43 peter
  663. * fixed usage of already release memory in getdir
  664. Revision 1.7 2001/03/21 21:08:20 hajny
  665. * GetDir fixed
  666. Revision 1.6 2001/03/16 20:09:58 hajny
  667. * universal FExpand
  668. Revision 1.5 2001/02/20 21:31:12 peter
  669. * chdir,mkdir,rmdir with empty string fixed
  670. Revision 1.4 2000/12/17 14:00:57 peter
  671. * removed debug writelns
  672. Revision 1.3 2000/10/09 16:35:51 marco
  673. * Fixed the first (of many) ioctls that make building the IDE hard.
  674. Revision 1.2 2000/09/18 13:14:51 marco
  675. * Global Linux +bsd to (rtl/freebsd rtl/unix rtl/linux structure)
  676. Revision 1.6 2000/09/11 13:48:08 marco
  677. * FreeBSD support and removal of old sighandler
  678. Revision 1.5 2000/08/13 08:43:45 peter
  679. * don't check for directory in do_open (merged)
  680. Revision 1.4 2000/08/05 18:33:51 peter
  681. * paramstr(0) fix for linux 2.0 kernels (merged)
  682. Revision 1.3 2000/07/14 10:33:10 michael
  683. + Conditionals fixed
  684. Revision 1.2 2000/07/13 11:33:49 michael
  685. + removed logs
  686. }