add more comments for sockets

This commit is contained in:
pikastech 2022-08-28 15:13:24 +08:00
parent 78aba92e01
commit 004c0b45fc
2 changed files with 20 additions and 2 deletions

View File

@ -4,7 +4,11 @@
#include <arpa/inet.h>
#include <unistd.h>
#else
/* you need to implement this for your platform */
/*
You need to create the __platform_socket.h for your platform.
For example:
You can #include "lwip/socket.h" in the __platform_socket.h
*/
#include "__platform_socket.h"
#endif
@ -12,6 +16,11 @@
#error "This library requires PikaScript version 1.10.4 or higher"
#endif
/*
The functinos start with PIKA_WEAK are weak functions,
you need to override them in your platform.
*/
PIKA_WEAK int __platform_socket(int __domain, int __type, int __protocol) {
#ifdef __linux__
return socket(__domain, __type, __protocol);

View File

@ -4,7 +4,11 @@
#include <arpa/inet.h>
#include <unistd.h>
#else
/* you need to implement this for your platform */
/*
You need to create the __platform_socket.h for your platform.
For example:
You can #include "lwip/socket.h" in the __platform_socket.h
*/
#include "__platform_socket.h"
#endif
@ -12,6 +16,11 @@
#error "This library requires PikaScript version 1.10.4 or higher"
#endif
/*
The functinos start with PIKA_WEAK are weak functions,
you need to override them in your platform.
*/
PIKA_WEAK int __platform_socket(int __domain, int __type, int __protocol) {
#ifdef __linux__
return socket(__domain, __type, __protocol);