From 88e69272feb1f2dbe933932e53c6b3273e5ebfeb Mon Sep 17 00:00:00 2001 From: Pavel <68122101+red-prig@users.noreply.github.com> Date: Sun, 6 Jul 2025 20:28:04 +0300 Subject: [PATCH] + --- fpPS4.lpi | 7 ++- sys/kern/kern_socket.pas | 117 +++++++++++++++++++++++++++++++++++++ sys/kern/uipc_syscalls.pas | 39 +------------ 3 files changed, 125 insertions(+), 38 deletions(-) create mode 100644 sys/kern/kern_socket.pas diff --git a/fpPS4.lpi b/fpPS4.lpi index 8d9605d7..20fcc103 100644 --- a/fpPS4.lpi +++ b/fpPS4.lpi @@ -1228,8 +1228,9 @@ - + + @@ -1616,6 +1617,10 @@ + + + + diff --git a/sys/kern/kern_socket.pas b/sys/kern/kern_socket.pas new file mode 100644 index 00000000..dca72604 --- /dev/null +++ b/sys/kern/kern_socket.pas @@ -0,0 +1,117 @@ +unit kern_socket; + +{$mode ObjFPC}{$H+} +{$CALLING SysV_ABI_CDecl} + +interface + +uses + sys_event, + kern_descrip, + vstat, + vuio, + vfile; + +function soo_read (fp:p_file;uio:p_uio;flags:Integer):Integer; +function soo_write (fp:p_file;uio:p_uio;flags:Integer):Integer; +function soo_truncate(fp:p_file;length:Int64):Integer; +function soo_ioctl (fp:p_file;com:QWORD;data:Pointer):Integer; +function soo_poll (fp:p_file;events:Integer):Integer; +function soo_kqfilter(fp:p_file;kn:p_knote):Integer; +function soo_stat (fp:p_file;sb:p_stat):Integer; +function soo_close (fp:p_file):Integer; + +const + socketops:fileops=( + fo_read :fo_rdwr_t (@soo_read); + fo_write :fo_rdwr_t (@soo_write); + fo_truncate:fo_truncate_t(@soo_truncate); + fo_ioctl :fo_ioctl_t (@soo_ioctl); + fo_poll :fo_poll_t (@soo_poll); + fo_kqfilter:fo_kqfilter_t(@soo_kqfilter); + fo_stat :fo_stat_t (@soo_stat); + fo_close :fo_close_t (@soo_close); + fo_chmod :fo_chmod_t (@invfo_chmod); + fo_chown :fo_chown_t (@invfo_chown); + fo_flags :DFLAG_PASSABLE; + ); + +implementation + +uses + errno, + md_sleep, + subr_backtrace; + +function soo_read(fp:p_file;uio:p_uio;flags:Integer):Integer; +begin + Writeln('TODO:soo_read'); + //msleep_td(0); + Result:=EWOULDBLOCK; +end; + +function soo_write(fp:p_file;uio:p_uio;flags:Integer):Integer; +begin + Writeln('TODO:soo_write'); + //msleep_td(0); + Result:=EWOULDBLOCK; +end; + +function soo_truncate(fp:p_file;length:Int64):Integer; +begin + Result:=EINVAL; +end; + +function soo_ioctl(fp:p_file;com:QWORD;data:Pointer):Integer; +begin + Result:=0; + + Writeln('soo_ioctl(0x',HexStr(com,8),')'); + + case com of + $802450C9: //-bnet_is_system_process() + begin + PInteger(data)^:=0; //-is_system + end; + else + begin + print_error_td('soo_ioctl(0x'+HexStr(com,8)+')'); + Assert(False); + end; + end; + +end; + +function soo_poll(fp:p_file;events:Integer):Integer; +begin + Writeln('TODO:soo_poll'); + Assert(false); + Result:=0; +end; + +function soo_kqfilter(fp:p_file;kn:p_knote):Integer; +begin + Writeln('TODO:soo_kqfilter'); + Assert(false); + Result:=0; +end; + +function soo_stat(fp:p_file;sb:p_stat):Integer; +begin + Writeln('TODO:soo_stat'); + Assert(false); + Result:=0; +end; + +function soo_close(fp:p_file):Integer; +begin + Result:=0; + //so = fp->f_data; + fp^.f_ops :=@badfileops; + fp^.f_data:=nil; + //if (so<>nil) then Result = soclose(so); +end; + + +end. + diff --git a/sys/kern/uipc_syscalls.pas b/sys/kern/uipc_syscalls.pas index a952a65b..b99eddba 100644 --- a/sys/kern/uipc_syscalls.pas +++ b/sys/kern/uipc_syscalls.pas @@ -25,14 +25,14 @@ uses kern_thr, kern_descrip, sys_conf, + kern_socket, vsocket, sockopt, vsocketvar, vuio, vfile, vfcntl, - vcapability, - subr_backtrace; + vcapability; { Convert a user file descriptor to a kernel file entry and check that, if @@ -69,41 +69,6 @@ begin Exit(0); end; -function soo_ioctl(fp:p_file;com:QWORD;data:Pointer):Integer; -begin - Result:=0; - - Writeln('soo_ioctl(0x',HexStr(com,8),')'); - - case com of - $802450C9: //-bnet_is_system_process() - begin - PInteger(data)^:=0; //-is_system - end; - else - begin - print_error_td('soo_ioctl(0x'+HexStr(com,8)+')'); - Assert(False); - end; - end; - -end; - -const - socketops:fileops=( - fo_read :fo_rdwr_t (@_nullop ); - fo_write :fo_rdwr_t (@_nullop ); - fo_truncate:fo_truncate_t(@_nullop ); - fo_ioctl :fo_ioctl_t (@soo_ioctl); - fo_poll :fo_poll_t (@_nullop ); - fo_kqfilter:fo_kqfilter_t(@_nullop ); - fo_stat :fo_stat_t (@_nullop ); - fo_close :fo_close_t (@_nullop ); - fo_chmod :fo_chmod_t (@_einval ); - fo_chown :fo_chown_t (@_einval ); - fo_flags :0; - ); - function sys_socket(domain,stype,protocol:Integer):Integer; var td:p_kthread;