123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- {
- $Id$
- This file is part of the Free Pascal run time library.
- Copyright (c) 2003 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;
- *)
- Function fsync (fd : cint) : cint;
- begin
- fsync:=do_syscall(syscall_nr_fsync,fd);
- end;
- Function fpFlock (fd,mode : longint) : cint;
- begin
- fpFlock:=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
- 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;
- end;
- function MUnMap (P : Pointer; Size : size_t) : cint;
- begin
- MUnMap:=do_syscall(syscall_nr_munmap,longint(P),Size);
- end;
- {
- $Log$
- Revision 1.1 2005-02-13 20:01:37 peter
- * include file cleanup
- Revision 1.8 2004/11/14 12:21:08 marco
- * moved some calls from unix to baseunix. Darwin untested.
- Revision 1.7 2004/11/03 15:00:43 marco
- * Pathstr eliminated
- Revision 1.6 2004/07/03 22:48:49 marco
- * small fix for 1.0.x cycling
- Revision 1.5 2004/04/22 16:22:10 marco
- * fpnice fixes
- Revision 1.4 2004/01/01 17:07:21 marco
- * few small freebsd fixes backported from debugging linux
- }
|