summaryrefslogtreecommitdiff
path: root/plan9/plan9.c
diff options
context:
space:
mode:
authorRomano <unobe@cpan.org>2020-06-25 15:08:04 -0700
committerNicolas R <nicolas@atoomic.org>2020-08-03 16:33:11 -0600
commita123eb892ee6a30b5910abc29fbccf2386306e08 (patch)
tree8bf7db7128ed831c0452e5151b38820e6c7a440c /plan9/plan9.c
parentbe2a5c504c374b2061df9780050f2d8223cf27ff (diff)
downloadperl-a123eb892ee6a30b5910abc29fbccf2386306e08.tar.gz
Plan9/9front i386 fixes
Diffstat (limited to 'plan9/plan9.c')
-rw-r--r--plan9/plan9.c53
1 files changed, 22 insertions, 31 deletions
diff --git a/plan9/plan9.c b/plan9/plan9.c
index ebdac27dcb..02ef76c97b 100644
--- a/plan9/plan9.c
+++ b/plan9/plan9.c
@@ -1,20 +1,31 @@
#include "EXTERN.h"
#include "perl.h"
+#include "./plan9/math.h"
-/* Functions mentioned in <sys/socket.h> but not implemented */
+#define _PLAN9_SOURCE
+#include <u.h>
-int getsockopt(int a, int b, int c, void *d, int *e)
-{
- croak("Function \"getsockopt\" not implemented in this version of perl.");
- return (int)NULL;
-}
+/** Function fpclassify(double) is required by sv.c, which was refactored in perl-5.24 era and uses other libraries to classify floating points. **/
-int setsockopt(int a, int b, int c, void *d, int *e)
-{
- croak("Function \"setsockopt\" not implemented in this version of perl.");
- return (int)NULL;
+/* See /sys/src/lib/port/frexp.c */
+#define SHIFT 20
+
+int fpclassify(double d) {
+ FPdbleword x;
+
+ /* order matters: only isNaN can operate on NaN */
+ if ( isNaN(d) )
+ return FP_NAN;
+ else if ( isInf(d, 0) )
+ return FP_INFINITE;
+ else if ( d == 0 )
+ return FP_ZERO;
+
+ x.x = fabs(d);
+ return (x.hi >> SHIFT) ? FP_NORMAL : FP_SUBNORMAL;
}
+/* Functions mentioned in /sys/include/ape/sys/socket.h but not implemented */
int recvmsg(int a, struct msghdr *b, int c)
{
@@ -29,7 +40,7 @@ int sendmsg(int a, struct msghdr *b, int c)
}
-/* Functions mentioned in <netdb.h> but not implemented */
+/* Functions mentioned in /sys/include/ape/sys/netdb.h but not implemented */
struct netent *getnetbyname(const char *a)
{
croak("Function \"getnetbyname\" not implemented in this version of perl.");
@@ -112,23 +123,3 @@ void endservent()
{
croak("Function \"endservent\" not implemented in this version of perl.");
}
-
-int tcdrain(int)
-{
-croak("Function \"tcdrain\" not implemented in this version of perl.");
-}
-
-int tcflow(int, int)
-{
-croak("Function \"tcflow\" not implemented in this version of perl.");
-}
-
-int tcflush(int, int)
-{
-croak("Function \"tcflush\" not implemented in this version of perl.");
-}
-
-int tcsendbreak(int, int)
-{
-croak("Function \"tcsendbreak\" not implemented in this version of perl.");
-}