Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2009-08

fpsocket error

11 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Евгений

In application which i compiled for arm-linux platform, an error occurs when calling fpsocket.
Why fpsocket call can cause the error?

Thanks.

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4346 (20090818) __________

The message was checked by ESET NOD32 Antivirus.

http://www.esetnod32.ru

Jonas Maebe
to Евгений
Евгений wrote
In application which i compiled for arm-linux platform, an error occurs when calling fpsocket. Why fpsocket call can cause the error?

Type "man socket" on the command line and have a look at the "ERRORS" section. You can also do

   if fpsocket(..)=-1 then
     writeln(fpgeterrno);

to see what the specific error number is in your case (you can look up the meaning of those error numbers in /usr/include/asm-generic/errno- base.h and /usr/include/asm-generic/errno.h)

Jonas

Евгений
to Jonas Maebe

Jonas Maebe пишет:

Show quoted text 24 lines
On 18 Aug 2009, at 22:42, Евгений wrote: > In application which i compiled for arm-linux platform, an error > occurs when calling fpsocket. > Why fpsocket call can cause the error? Type "man socket" on the command line and have a look at the "ERRORS" section. You can also do if fpsocket(..)=-1 then writeln(fpgeterrno); to see what the specific error number is in your case (you can look up the meaning of those error numbers in /usr/include/asm-generic/errno-base.h and /usr/include/asm-generic/errno.h) Jonas_______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Socket error[38]: Function not implemented

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4346 (20090818) __________

The message was checked by ESET NOD32 Antivirus.

http://www.esetnod32.ru

Евгений
to Евгений

Евгений пишет:

Show quoted text 27 lines
Jonas Maebe пишет: > > On 18 Aug 2009, at 22:42, Евгений wrote: > >> In application which i compiled for arm-linux platform, an error >> occurs when calling fpsocket. >> Why fpsocket call can cause the error? > > Type "man socket" on the command line and have a look at the "ERRORS" > section. You can also do > > if fpsocket(..)=-1 then > writeln(fpgeterrno); > > to see what the specific error number is in your case (you can look > up the meaning of those error numbers in > /usr/include/asm-generic/errno-base.h and > /usr/include/asm-generic/errno.h) > > > Jonas_______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > > Socket error[38]: Function not implemented

Maybe problem is in the Linux kernel?

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4346 (20090818) __________

The message was checked by ESET NOD32 Antivirus.

http://www.esetnod32.ru

Евгений
to Henry Vermaak

Henry Vermaak пишет:

Show quoted text 15 lines
2009/8/18 Евгений : > Socket error[38]: Function not implemented > Try and write a short c program to test socket support in the kernel. If it fails, maybe you need to re-configure (try `make menuconfig`) and re-build your kernel to make sure that socket support is included. If the c program works, fpc might be at fault. Henry _______________________________________________

Thank you for your advice, I tried. A simple socket program written in C works. Now I don't know what to do with Pascal, i don't want to rewrite my large program in C.

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4346 (20090818) __________

The message was checked by ESET NOD32 Antivirus.

http://www.esetnod32.ru

Henry Vermaak
to Евгений

2009/8/19 Евгений :

Thank you for your advice, I tried. A simple socket program written in C works. Now I don't know what to do with Pascal, i don't want to rewrite my large program in C.

Try using strace to get more information.

Henry

Henry Vermaak
to Henry Vermaak

2009/8/19 Henry Vermaak :

Show quoted text 6 lines
2009/8/19 Евгений : > Thank you for your advice, I tried. A simple socket program written in C > works. Now I don't know what to do with Pascal, i don't want to rewrite my > large program in C. Try using strace to get more information.

If you are using an EABI kernel, it will be the socketcall syscall that's failing. This is the code in unistd.h:

/*
* The following syscalls are obsolete and no longer available for EABI. */
#if defined(__ARM_EABI__) && !defined(__KERNEL__)
#undef __NR_time
#undef __NR_umount
#undef __NR_stime
#undef __NR_alarm
#undef __NR_utime
#undef __NR_getrlimit
#undef __NR_select
#undef __NR_readdir
#undef __NR_mmap
#undef __NR_socketcall
#undef __NR_syscall
#undef __NR_ipc
#endif

The fpc socket implementation tries to use socketcall for arm eabi, so you can try the following patch and recompile fpc (not tested):

Index: rtl/linux/unixsock.inc
=================================================================== --- rtl/linux/unixsock.inc (revision 13557)
+++ rtl/linux/unixsock.inc (working copy)
@@ -13,7 +13,7 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. }

-{$ifndef cpux86_64}
+{$if not defined(cpux86_64) and not defined(FPC_ABI_EABI)}
   {$define NEED_SOCKETCALL}
 {$endif}

Henry

Michael Van Canneyt
to Евгений: Henry Vermaak пишет: Thank you for your advice, I tried. A simple socket program…
Евгений wrote 19 lines
Henry Vermaak пишет: > 2009/8/18 Евгений : > >> Socket error[38]: Function not implemented >> > > Try and write a short c program to test socket support in the kernel. > If it fails, maybe you need to re-configure (try `make menuconfig`) > and re-build your kernel to make sure that socket support is included. > If the c program works, fpc might be at fault. > > Henry > _______________________________________________ > > > Thank you for your advice, I tried. A simple socket program written in C works. Now I don't know what to do with Pascal, i don't want to rewrite my large program in C.

Can you do a strace of the C and the FPC program and compare them? Maybe the C library uses some other calls than the FPC program ?

Michael.

Henry Vermaak
to Henry Vermaak: 2009/8/19 Henry Vermaak : If you are using an EABI kernel, it will be the socketcall…

2009/8/19 Henry Vermaak :

Show quoted text 38 lines
If you are using an EABI kernel, it will be the socketcall syscall that's failing.  This is the code in unistd.h: /*  * The following syscalls are obsolete and no longer available for EABI.  */ #if defined(__ARM_EABI__) && !defined(__KERNEL__) #undef __NR_time #undef __NR_umount #undef __NR_stime #undef __NR_alarm #undef __NR_utime #undef __NR_getrlimit #undef __NR_select #undef __NR_readdir #undef __NR_mmap #undef __NR_socketcall #undef __NR_syscall #undef __NR_ipc #endif The fpc socket implementation tries to use socketcall for arm eabi, so you can try the following patch and recompile fpc (not tested): Index: rtl/linux/unixsock.inc =================================================================== --- rtl/linux/unixsock.inc      (revision 13557) +++ rtl/linux/unixsock.inc      (working copy) @@ -13,7 +13,7 @@    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  } -{$ifndef cpux86_64} +{$if not defined(cpux86_64) and not defined(FPC_ABI_EABI)}   {$define NEED_SOCKETCALL}  {$endif}

I've made a bugreport for this here:
http://bugs.freepascal.org/view.php?id=14386

It contains a patch that will help to remedy the above missing syscalls.

Henry

Евгений
to Henry Vermaak

Henry Vermaak пишет:

Show quoted text 49 lines
2009/8/19 Henry Vermaak : > If you are using an EABI kernel, it will be the socketcall syscall > that's failing. This is the code in unistd.h: > > /* > * The following syscalls are obsolete and no longer available for EABI. > */ > #if defined(__ARM_EABI__) && !defined(__KERNEL__) > #undef __NR_time > #undef __NR_umount > #undef __NR_stime > #undef __NR_alarm > #undef __NR_utime > #undef __NR_getrlimit > #undef __NR_select > #undef __NR_readdir > #undef __NR_mmap > #undef __NR_socketcall > #undef __NR_syscall > #undef __NR_ipc > #endif > > The fpc socket implementation tries to use socketcall for arm eabi, so > you can try the following patch and recompile fpc (not tested): > > Index: rtl/linux/unixsock.inc > =================================================================== > --- rtl/linux/unixsock.inc (revision 13557) > +++ rtl/linux/unixsock.inc (working copy) > @@ -13,7 +13,7 @@ > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > } > > -{$ifndef cpux86_64} > +{$if not defined(cpux86_64) and not defined(FPC_ABI_EABI)} > {$define NEED_SOCKETCALL} > {$endif} > > I've made a bugreport for this here: http://bugs.freepascal.org/view.php?id=14386 It contains a patch that will help to remedy the above missing syscalls. Henry

A great, great, great ... Many thanks, Henry.
I apply your patch and now it works, socket succesfully created.

Best regards.

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4349 (20090819) __________

The message was checked by ESET NOD32 Antivirus.

http://www.esetnod32.ru