ossysc.inc 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. {
  2. $Id$
  3. Copyright (c) 2002 by Marco van de Voort
  4. The base *BSD syscalls required to implement the system unit. These
  5. are aliased for use in other units (to avoid poluting the system units
  6. interface)
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. ****************************************************************************
  13. }
  14. {$i ostypes.inc}
  15. {$ifdef uselibc}
  16. {$Linklib c}
  17. // Out of date atm.
  18. { var
  19. Errno : cint; external name 'errno';}
  20. function Fptime(tloc:ptime_t): time_t; cdecl; external name 'time';
  21. function Fpopen(const path: pchar; flags : cint; mode: mode_t):cint; cdecl; external name 'open';
  22. function Fpclose(fd : cint): cint; cdecl; external name 'close';
  23. function Fplseek(fd : cint; offset : off_t; whence : cint): off_t; cdecl; external name 'lseek';
  24. function Fpread(fd: cint; buf: pchar; nbytes : size_t): ssize_t; cdecl; external name 'read';
  25. function Fpwrite(fd: cint;const buf:pchar; nbytes : size_t): ssize_t; cdecl; external name 'write';
  26. function Fpunlink(const path: pchar): cint; cdecl; external name 'unlink';
  27. function Fprename(const old : pchar; const newpath: pchar): cint; cdecl;external name 'rename';
  28. function Fpstat(const path: pchar; var buf : stat): cint; cdecl; external name 'stat';
  29. function Fpchdir(const path : pchar): cint; cdecl; external name 'chdir';
  30. function Fpmkdir(const path : pchar; mode: mode_t):cint; cdecl; external name 'mkdir';
  31. function Fprmdir(const path : pchar): cint; cdecl; external name 'rmdir';
  32. function Fpopendir(const dirname : pchar): pdir; cdecl; external name 'opendir';
  33. function Fpreaddir(var dirp : dir) : pdirent;cdecl; external name 'readdir';
  34. function Fpclosedir(var dirp : dir): cint; cdecl; external name 'closedir';
  35. procedure Fpexit(status : cint); cdecl; external name '_exit';
  36. function Fpsigaction(sig: cint; var act : sigactionrec; var oact : sigactionrec): cint; cdecl; external name 'sigaction';
  37. function Fpftruncate(fd : cint; flength : off_t): cint; cdecl; external name 'ftruncate';
  38. function Fprename(const old : pchar; const newpath: pchar): cint; cdecl;external name 'rename';
  39. function Fpfstat(fd : cint; var sb : stat): cint; cdecl; external name 'fstat';
  40. function Fpfork : pid_t; cdecl; external name 'fork';
  41. function Fpexecve(const path : pchar; const argv : ppchar; const envp: ppchar): cint; cdecl; external name 'execve';
  42. function Fpwaitpid(pid : pid_t; tat_loc : pcint; options: cint): pid_t; cdecl; external name 'waitpid';
  43. function Fpaccess(const pathname : pchar; amode : cint): cint; cdecl; external name 'access';
  44. function Fpuname(var name: utsname): cint; cdecl; external name 'uname';
  45. function FpDup(oldd:cint):cint; cdecl; external name 'dup';
  46. function FpDup2(oldd:cint;newd:cint):cint; cdecl; external name 'dup2';
  47. {$else}
  48. {*****************************************************************************
  49. --- Main:The System Call Self ---
  50. *****************************************************************************}
  51. { The system designed for Linux can't be used for *BSD so easily, since
  52. *BSD pushes arguments, instead of loading them to registers.}
  53. // Var ErrNo : Longint;
  54. {$I syscallh.inc}
  55. {$I syscall.inc}
  56. {$I sysnr.inc}
  57. {$I bunxmacr.inc}
  58. // Should be moved to a FreeBSD specific unit in the future.
  59. function Fptime( tloc:ptime): time_t; [public, alias : 'FPC_SYSC_TIME'];
  60. VAR tv : timeval;
  61. tz : timezone;
  62. retval : longint;
  63. begin
  64. Retval:=do_syscall(syscall_nr_gettimeofday,TSysParam(@tv),TSysParam(@tz));
  65. If retval=-1 then
  66. Fptime:=-1
  67. else
  68. Begin
  69. If Assigned(tloc) Then
  70. TLoc^:=tv.tv_sec;
  71. Fptime:=tv.tv_sec;
  72. End;
  73. End;
  74. {*****************************************************************************
  75. --- File:File handling related calls ---
  76. *****************************************************************************}
  77. function Fpopen(path: pchar; flags : cint; mode: mode_t):cint; [public, alias : 'FPC_SYSC_OPEN'];
  78. Begin
  79. Fpopen:=do_syscall(syscall_nr_open,TSysParam(path),TSysParam(flags),TSysParam(mode));
  80. End;
  81. function Fpclose(fd : cint): cint; [public, alias : 'FPC_SYSC_CLOSE'];
  82. begin
  83. Fpclose:=do_syscall(syscall_nr_close,fd);
  84. end;
  85. {$ifdef netbsd}
  86. {$ifdef cpupowerpc}
  87. {$define netbsdmacppc}
  88. {$endif}
  89. {$endif}
  90. {$ifdef netbsdmacppc}
  91. {$i sysofft.inc} // odd ball calling convention.
  92. {$else}
  93. // generic versions.
  94. function Fplseek(fd : cint; offset : off_t; whence : cint): off_t; [public, alias : 'FPC_SYSC_LSEEK'];
  95. {
  96. this one is special for the return value being 64-bit..
  97. hi/lo offset not yet tested.
  98. NetBSD: ok, but implicit return value in edx:eax
  99. FreeBSD: same implementation as NetBSD.
  100. }
  101. begin
  102. Fplseek:=do_syscall(syscall_nr___syscall,syscall_nr_lseek,0,TSysParam(fd),0,lo(Offset),{0} hi(offset),Whence);
  103. end;
  104. function Fpftruncate(fd : cint; flength : off_t): cint; [public, alias : 'FPC_SYSC_FTRUNCATE'];
  105. begin
  106. Fpftruncate:=Do_syscall(syscall_nr___syscall,syscall_nr_ftruncate,0,fd,0,lo(flength),hi(flength));
  107. end;
  108. Function Fpmmap(start:pointer;len:size_t;prot:cint;flags:cint;fd:cint;offst:off_t):pointer; [public, alias: 'FPC_SYSC_MMAP'];
  109. begin
  110. Fpmmap:=pointer(longint(do_syscall(syscall_nr_mmap,TSysParam(Start),Len,Prot,Flags,fd,{$ifdef cpupowerpc}0,{$endif}offst{$ifdef i386},0{$endif})));
  111. end;
  112. {$endif}
  113. function Fpread(fd: cint; buf: pchar; nbytes : size_t): ssize_t; [public, alias : 'FPC_SYSC_READ'];
  114. begin
  115. Fpread:=do_syscall(syscall_nr_read,Fd,TSysParam(buf),nbytes);
  116. end;
  117. function Fpwrite(fd: cint;buf:pchar; nbytes : size_t): ssize_t; [public, alias : 'FPC_SYSC_WRITE'];
  118. begin
  119. Fpwrite:=do_syscall(syscall_nr_write,Fd,TSysParam(buf),nbytes);
  120. end;
  121. function Fpunlink(const path: pchar): cint; [public, alias : 'FPC_SYSC_UNLINK'];
  122. begin
  123. Fpunlink:=do_syscall(syscall_nr_unlink,TSysParam(path));
  124. end;
  125. function Fprename(old : pchar; newpath: pchar): cint; [public, alias : 'FPC_SYSC_RENAME'];
  126. begin
  127. Fprename:=do_syscall(syscall_nr_rename,TSysParam(old),TSysParam(newpath));
  128. end;
  129. function Fpstat(const path: pchar; var buf : stat):cint; [public, alias : 'FPC_SYSC_STAT'];
  130. begin
  131. Fpstat:=do_syscall(syscall_nr_stat,TSysParam(path),TSysParam(@buf));
  132. end;
  133. {*****************************************************************************
  134. --- Directory:Directory related calls ---
  135. *****************************************************************************}
  136. function Fpchdir(path : pchar): cint; [public, alias : 'FPC_SYSC_CHDIR'];
  137. begin
  138. Fpchdir:=do_syscall(syscall_nr_chdir,TSysParam(path));
  139. end;
  140. function Fpmkdir(path : pchar; mode: mode_t):cint; [public, alias : 'FPC_SYSC_MKDIR'];
  141. begin {Mode is 16-bit on F-BSD 4!}
  142. Fpmkdir:=do_syscall(syscall_nr_mkdir,TSysParam(path),mode);
  143. end;
  144. function Fprmdir(path : pchar): cint; [public, alias : 'FPC_SYSC_RMDIR'];
  145. begin
  146. Fprmdir:=do_syscall(syscall_nr_rmdir,TSysParam(path));
  147. end;
  148. {$ifndef NewReaddir}
  149. const DIRBLKSIZ=1024;
  150. function Fpopendir(dirname : pchar): pdir; [public, alias : 'FPC_SYSC_OPENDIR'];
  151. var
  152. fd:longint;
  153. st:stat;
  154. ptr:pdir;
  155. begin
  156. Fpopendir:=nil;
  157. if Fpstat(dirname,st)<0 then
  158. exit;
  159. { Is it a dir ? }
  160. if not((st.st_mode and $f000)=$4000)then
  161. begin
  162. errno:=ESysENOTDIR;
  163. exit
  164. end;
  165. { Open it}
  166. fd:=Fpopen(dirname,O_RDONLY,438);
  167. if fd<0 then
  168. Begin
  169. Errno:=-1;
  170. exit;
  171. End;
  172. new(ptr);
  173. if ptr=nil then
  174. Begin
  175. Errno:=1;
  176. exit;
  177. End;
  178. Getmem(ptr^.dd_buf,2*DIRBLKSIZ);
  179. if ptr^.dd_buf=nil then
  180. exit;
  181. ptr^.dd_fd:=fd;
  182. ptr^.dd_loc:=-1;
  183. ptr^.dd_rewind:=longint(ptr^.dd_buf);
  184. ptr^.dd_size:=0;
  185. // ptr^.dd_max:=sizeof(ptr^.dd_buf^);
  186. Fpopendir:=ptr;
  187. end;
  188. function Fpclosedir(dirp : pdir): cint; [public, alias : 'FPC_SYSC_CLOSEDIR'];
  189. begin
  190. Fpclosedir:=Fpclose(dirp^.dd_fd);
  191. Freemem(dirp^.dd_buf);
  192. dispose(dirp);
  193. end;
  194. function Fpreaddir(dirp : pdir) : pdirent; [public, alias : 'FPC_SYSC_READDIR'];
  195. {Different from Linux, Readdir on BSD is based on Getdents, due to the
  196. missing of the readdir syscall.
  197. Getdents requires the buffer to be larger than the blocksize.
  198. This usually the sectorsize =512 bytes, but maybe tapedrives and harddisks
  199. with blockmode have this higher?}
  200. function readbuffer:longint;
  201. var retval :longint;
  202. begin
  203. Retval:=do_syscall(syscall_nr_getdents,TSysParam(dirp^.dd_fd),TSysParam(@dirp^.dd_buf^),DIRBLKSIZ {sizeof(getdentsbuffer)});
  204. dirp^.dd_rewind:=TSysParam(dirp^.dd_buf);
  205. if retval=0 then
  206. begin
  207. dirp^.dd_rewind:=0;
  208. dirp^.dd_loc:=0;
  209. end
  210. else
  211. dirP^.dd_loc:=retval;
  212. readbuffer:=retval;
  213. end;
  214. var
  215. FinalEntry : pdirent;
  216. novalid : boolean;
  217. Reclen : Longint;
  218. CurEntry : PDirent;
  219. begin
  220. if (dirp^.dd_buf=nil) or (dirp^.dd_loc=0) THEN
  221. exit(nil);
  222. if (dirp^.dd_loc=-1) OR {First readdir on this pdir. Initial fill of buffer}
  223. (dirp^.dd_rewind>=(longint(dirp^.dd_buf)+dirblksiz)) then {no more entries left?}
  224. Begin
  225. if readbuffer=0 then {succesful read?}
  226. Exit(NIL); {No more data}
  227. End;
  228. FinalEntry:=NIL;
  229. CurEntry:=nil;
  230. repeat
  231. novalid:=false;
  232. CurEntry:=pdirent(dirp^.dd_rewind);
  233. RecLen:=CurEntry^.d_reclen;
  234. if RecLen<>0 Then
  235. begin {valid direntry?}
  236. if CurEntry^.d_fileno<>0 then
  237. FinalEntry:=CurEntry;
  238. inc(dirp^.dd_rewind,Reclen);
  239. end
  240. else
  241. begin {block entirely searched or reclen=0}
  242. Novalid:=True;
  243. if dirp^.dd_loc<>0 THEN {blocks left?}
  244. if readbuffer()<>0 then {succesful read?}
  245. novalid:=false;
  246. end;
  247. until (FinalEntry<>nil) or novalid;
  248. If novalid then
  249. FinalEntry:=nil;
  250. FpReadDir:=FinalEntry;
  251. end;
  252. {$endif}
  253. {*****************************************************************************
  254. --- Process:Process & program handling - related calls ---
  255. *****************************************************************************}
  256. procedure Fpexit(status : cint); [public, alias : 'FPC_SYSC_EXIT'];
  257. begin
  258. do_syscall(syscall_nr_exit,status);
  259. end;
  260. {
  261. Change action of process upon receipt of a signal.
  262. Signum specifies the signal (all except SigKill and SigStop).
  263. If Act is non-nil, it is used to specify the new action.
  264. If OldAct is non-nil the previous action is saved there.
  265. }
  266. function Fpsigaction(sig: cint; var act : sigactionrec; var oact : sigactionrec): cint; [public, alias : 'FPC_SYSC_SIGACTION'];
  267. {
  268. Change action of process upon receipt of a signal.
  269. Signum specifies the signal (all except SigKill and SigStop).
  270. If Act is non-nil, it is used to specify the new action.
  271. If OldAct is non-nil the previous action is saved there.
  272. }
  273. begin
  274. do_syscall(syscall_nr_sigaction,TSysParam(sig),TSysParam(@act),TSysParam(@oact));
  275. end;
  276. (*=================== MOVED from sysunix.inc ========================*)
  277. function Fpfstat(fd : cint; var sb : stat): cint; [public, alias : 'FPC_SYSC_FSTAT'];
  278. begin
  279. fpFStat:=do_SysCall(syscall_nr_fstat,fd,TSysParam(@sb));
  280. end;
  281. {$ifdef NewReaddir}
  282. {$I readdir.inc}
  283. {$endif}
  284. function Fpfork : pid_t; [public, alias : 'FPC_SYSC_FORK'];
  285. {
  286. This function issues the 'fork' System call. the program is duplicated in memory
  287. and Execution continues in parent and child process.
  288. In the parent process, fork returns the PID of the child. In the child process,
  289. zero is returned.
  290. A negative value indicates that an error has occurred, the error is returned in
  291. LinuxError.
  292. }
  293. Begin
  294. Fpfork:=Do_syscall(SysCall_nr_fork);
  295. End;
  296. {
  297. function Fpexecve(const path : pathstr; const argv : ppchar; const envp: ppchar): cint;
  298. }
  299. {
  300. Replaces the current program by the program specified in path,
  301. arguments in args are passed to Execve.
  302. environment specified in ep is passed on.
  303. }
  304. {
  305. Begin
  306. path:=path+#0;
  307. do_syscall(syscall_nr_Execve,TSysParam(@path[1]),TSysParam(Argv),TSysParam(envp));
  308. End;
  309. }
  310. {
  311. function Fpexecve(const path : pchar; const argv : ppchar; const envp: ppchar): cint; [public, alias : 'FPC_SYSC_EXECVE'];
  312. }
  313. {
  314. Replaces the current program by the program specified in path,
  315. arguments in args are passed to Execve.
  316. environment specified in ep is passed on.
  317. }
  318. {
  319. Begin
  320. do_syscall(syscall_nr_Execve,TSysParam(path),TSysParam(Argv),TSysParam(envp));
  321. End;
  322. }
  323. function Fpwaitpid(pid : pid_t; stat_loc : pcint; options: cint): pid_t; [public, alias : 'FPC_SYSC_WAITPID'];
  324. {
  325. Waits until a child with PID Pid exits, or returns if it is exited already.
  326. Any resources used by the child are freed.
  327. The exit status is reported in the adress referred to by Status. It should
  328. be a longint.
  329. }
  330. begin // actually a wait4() call with 4th arg 0.
  331. FpWaitPID:=do_syscall(syscall_nr_WaitPID,PID,TSysParam(Stat_loc),options,0);
  332. end;
  333. function Fpaccess(const pathname : pchar; amode : cint): cint; [public, alias : 'FPC_SYSC_ACCESS'];
  334. {
  335. Test users access rights on the specified file.
  336. Mode is a mask xosisting of one or more of R_OK, W_OK, X_OK, F_OK.
  337. R,W,X stand for read,write and Execute access, simultaneously.
  338. F_OK checks whether the test would be allowed on the file.
  339. i.e. It checks the search permissions in all directory components
  340. of the path.
  341. The test is done with the real user-ID, instead of the effective.
  342. If access is denied, or an error occurred, false is returned.
  343. If access is granted, true is returned.
  344. Errors other than no access,are reported in unixerror.
  345. }
  346. begin
  347. FpAccess:=do_syscall(syscall_nr_access,TSysParam(pathname),amode);
  348. end;
  349. {
  350. function Fpaccess(const pathname : pathstr; amode : cint): cint;
  351. {
  352. Test users access rights on the specified file.
  353. Mode is a mask xosisting of one or more of R_OK, W_OK, X_OK, F_OK.
  354. R,W,X stand for read,write and Execute access, simultaneously.
  355. F_OK checks whether the test would be allowed on the file.
  356. i.e. It checks the search permissions in all directory components
  357. of the path.
  358. The test is done with the real user-ID, instead of the effective.
  359. If access is denied, or an error occurred, false is returned.
  360. If access is granted, true is returned.
  361. Errors other than no access,are reported in unixerror.
  362. }
  363. begin
  364. pathname:=pathname+#0;
  365. Access:=do_syscall(syscall_nr_access, TSysParam(@pathname[1]),mode)=0;
  366. end;
  367. }
  368. Function FpDup(fildes:cint):cint; [public, alias : 'FPC_SYSC_DUP'];
  369. begin
  370. Fpdup:=Do_syscall(syscall_nr_dup,TSysParam(fildes));
  371. end;
  372. Function FpDup2(fildes,fildes2:cint):cint; [public, alias : 'FPC_SYSC_DUP2'];
  373. begin
  374. Fpdup2:=do_syscall(syscall_nr_dup2,TSysParam(fildes),TSysParam(fildes2));
  375. end;
  376. CONST
  377. { Constansts for MMAP }
  378. MAP_PRIVATE =2;
  379. MAP_ANONYMOUS =$1000;
  380. Function Fpmunmap(start:pointer;len:size_t):cint; [public, alias :'FPC_SYSC_MUNMAP'];
  381. begin
  382. Fpmunmap:=do_syscall(syscall_nr_munmap,TSysParam(start),Len);
  383. end;
  384. Function sbrk(size : longint) : pointer;
  385. begin
  386. sbrk:=Fpmmap(0,Size,3,MAP_PRIVATE+MAP_ANONYMOUS,-1,0);
  387. if sbrk=pointer(-1) then
  388. sbrk:=nil
  389. else
  390. errno:=0;
  391. end;
  392. {
  393. Interface to Unix ioctl call.
  394. Performs various operations on the filedescriptor Handle.
  395. Ndx describes the operation to perform.
  396. Data points to data needed for the Ndx function. The structure of this
  397. data is function-dependent.
  398. }
  399. Function FpIOCtl(Handle:cint;Ndx: culong;Data: Pointer):cint; [public, alias : 'FPC_SYSC_IOCTL'];
  400. // This was missing here, instead hardcoded in Do_IsDevice
  401. begin
  402. FpIOCtl:=do_SysCall(syscall_nr_ioctl,handle,Ndx,TSysParam(data));
  403. end;
  404. CONST
  405. IOCtl_TCGETS=$5401;
  406. Function Do_IsDevice(Handle:Longint):boolean;
  407. {
  408. Interface to Unix ioctl call.
  409. Performs various operations on the filedescriptor Handle.
  410. Ndx describes the operation to perform.
  411. Data points to data needed for the Ndx function. The structure of this
  412. data is function-dependent.
  413. }
  414. var
  415. Data : array[0..255] of byte; {Large enough for termios info}
  416. begin
  417. Do_IsDevice:=(Fpioctl(handle,IOCTL_TCGETS,@data)<>-1);
  418. end;
  419. Function FpGetPid:LongInt; [public, alias : 'FPC_SYSC_GETPID'];
  420. {
  421. Get Process ID.
  422. }
  423. begin
  424. FpGetPID:=do_syscall(syscall_nr_getpid);
  425. end;
  426. function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; [public, alias: 'FPC_SYSC_GETTIMEOFDAY'];
  427. begin
  428. fpgettimeofday:=do_syscall(syscall_nr_gettimeofday,TSysParam(tp),TSysParam(tzp));
  429. end;
  430. Function FpNanoSleep(const req : timespec;var rem : timespec) : longint; [public, alias : 'FPC_SYSC_NANOSLEEP'];
  431. begin
  432. {$ifndef darwin}
  433. FpNanoSleep:=Do_SysCall(syscall_nr_nanosleep,TSysParam(@req),TSysParam(@rem));
  434. {$else not darwin}
  435. {$warning: TODO: nanosleep!!!}
  436. {$endif not darwin}
  437. end;
  438. function Fpgetcwd(pt:pchar; _size:size_t):pchar;[public, alias :'FPC_SYSC_GETCWD'];
  439. {$ifndef darwin}
  440. const intpathmax = 1024-4; // didn't use POSIX data in libc
  441. // implementation.
  442. var ept,bpt : pchar;
  443. c : char;
  444. ret : cint;
  445. begin
  446. if pt=NIL Then
  447. begin
  448. // POSIX: undefined. (exit(nil) ?)
  449. // BSD : allocate mem for path.
  450. getmem(pt,intpathmax);
  451. if pt=nil Then
  452. exit(nil);
  453. ept:=pt+intpathmax;
  454. end
  455. else
  456. Begin
  457. if (_size=0) Then
  458. Begin
  459. seterrno(ESysEINVAL);
  460. exit(nil);
  461. End;
  462. if (_size=1) Then
  463. Begin
  464. seterrno(ESysERANGE);
  465. exit(nil);
  466. End;
  467. ept:=pt+_size;
  468. end;
  469. ret := do_syscall(syscall_nr___getcwd,TSysParam(pt),TSysParam( ept - pt));
  470. If (ret = 0) Then
  471. If (pt[0] <> '/') Then
  472. Begin
  473. bpt := pt;
  474. ept := pt + strlen(pt) - 1;
  475. While (bpt < ept) Do
  476. Begin
  477. c := bpt^;
  478. bpt^:=ept^;
  479. inc(bpt);
  480. ept^:=c;
  481. dec(ept);
  482. End;
  483. End;
  484. Fpgetcwd:=pt;
  485. end;
  486. {$else not darwin}
  487. {$i getcwd.inc}
  488. {$endif darwin}
  489. {$endif}
  490. {
  491. $Log$
  492. Revision 1.11 2003-09-27 13:04:58 peter
  493. * fpISxxx renamed
  494. Revision 1.10 2003/09/20 12:38:29 marco
  495. * FCL now compiles for FreeBSD with new 1.1. Now Linux.
  496. Revision 1.9 2003/09/17 16:02:31 marco
  497. * ostype include moved to top
  498. Revision 1.8 2003/09/16 12:45:49 marco
  499. * mmap typing fixes
  500. Revision 1.7 2003/09/15 20:08:49 marco
  501. * small fixes. FreeBSD now cycles
  502. Revision 1.6 2003/09/14 20:15:01 marco
  503. * Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
  504. Revision 1.5 2003/08/21 22:23:34 olle
  505. - removed parameter from fpc_iocheck
  506. Revision 1.4 2003/05/29 21:45:23 marco
  507. * Some other workaround
  508. Revision 1.3 2003/05/29 20:52:55 marco
  509. * only moved around the off_t calls, and made an exception (includefile)
  510. for NetBSD/powerpc
  511. Revision 1.2 2003/05/26 21:29:16 jonas
  512. - disabled nanosleep for darwin for now
  513. + getcwd for darwin
  514. Revision 1.1 2003/01/05 19:01:28 marco
  515. * FreeBSD compiles now with baseunix mods.
  516. Revision 1.9 2002/11/13 18:15:08 marco
  517. * sigset functions more flexible, small changes to sys_ktime
  518. Revision 1.8 2002/10/27 17:21:29 marco
  519. * Only "difficult" functions + execvp + termios + rewinddir left to do
  520. Revision 1.7 2002/10/27 11:58:29 marco
  521. * Modifications from Saturday.
  522. Revision 1.6 2002/10/26 18:27:51 marco
  523. * First series POSIX calls commits. Including getcwd.
  524. Revision 1.5 2002/10/18 12:19:58 marco
  525. * Fixes to get the generic *BSD RTL compiling again + fixes for thread
  526. support. Still problems left in fexpand. (inoutres?) Therefore fixed
  527. sysposix not yet commited
  528. Revision 1.4 2002/10/16 18:44:18 marco
  529. * Lseek and ftruncate 64-bit fix
  530. Revision 1.3 2002/09/07 16:01:17 peter
  531. * old logs removed and tabs fixed
  532. Revision 1.2 2002/08/21 07:03:16 marco
  533. * Fixes from Tuesday.
  534. Revision 1.1 2002/08/19 12:29:11 marco
  535. * First working POSIX *BSD system unit.
  536. Revision 1.2 2002/08/04 04:29:34 marco
  537. * More POSIX updates. Small changes to lseek and ftruncate in osposix.inc
  538. Initial versions of the type includefiles
  539. Revision 1.1 2002/08/03 19:34:19 marco
  540. * Initial *BSD versions. Seems that OpenBSD doesn't need much change,
  541. NetBSD may need some fixes to stat record and ftruncate and lseek.
  542. It is all close together, and it should be doable to have just one copy
  543. of these for *BSD.
  544. }