summaryrefslogtreecommitdiff
path: root/drivers/unix
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/unix')
-rw-r--r--drivers/unix/SCsub10
-rw-r--r--drivers/unix/os_unix.cpp8
-rw-r--r--drivers/unix/os_unix.h3
-rw-r--r--drivers/unix/stream_peer_tcp_posix.cpp9
-rw-r--r--drivers/unix/stream_peer_tcp_posix.h2
5 files changed, 32 insertions, 0 deletions
diff --git a/drivers/unix/SCsub b/drivers/unix/SCsub
index 9fbb467baa..3d46a85cdf 100644
--- a/drivers/unix/SCsub
+++ b/drivers/unix/SCsub
@@ -1,5 +1,15 @@
Import('env')
+g_set_p='#ifdef UNIX_ENABLED\n'
+g_set_p+='#include "os_unix.h"\n'
+g_set_p+='String OS_Unix::get_global_settings_path() const {\n'
+g_set_p+='\treturn "' + env["unix_global_settings_path"]+'";\n'
+g_set_p+='}\n'
+g_set_p+='#endif'
+f = open("os_unix_global_settings_path.cpp","wb")
+f.write(g_set_p)
+f.close()
+
env.add_source_files(env.drivers_sources,"*.cpp")
Export('env')
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index fd8c26f6d9..94a7b03f45 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -477,6 +477,14 @@ String OS_Unix::get_data_dir() const {
}
+String OS_Unix::get_installed_templates_path() const {
+ String p=get_global_settings_path();
+ if (p!="")
+ return p+"/templates/";
+ else
+ return "";
+}
+
String OS_Unix::get_executable_path() const {
#ifdef __linux__
diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h
index 2ee6102164..9ac18c9055 100644
--- a/drivers/unix/os_unix.h
+++ b/drivers/unix/os_unix.h
@@ -64,6 +64,8 @@ protected:
String stdin_buf;
+ String get_global_settings_path() const;
+
public:
@@ -111,6 +113,7 @@ public:
virtual void debug_break();
+ virtual String get_installed_templates_path() const;
virtual String get_executable_path() const;
virtual String get_data_dir() const;
diff --git a/drivers/unix/stream_peer_tcp_posix.cpp b/drivers/unix/stream_peer_tcp_posix.cpp
index 5aa3915893..edf5e02971 100644
--- a/drivers/unix/stream_peer_tcp_posix.cpp
+++ b/drivers/unix/stream_peer_tcp_posix.cpp
@@ -38,6 +38,7 @@
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
+#include <sys/ioctl.h>
#ifndef NO_FCNTL
#ifdef __HAIKU__
#include <fcntl.h>
@@ -367,6 +368,14 @@ Error StreamPeerTCPPosix::get_partial_data(uint8_t* p_buffer, int p_bytes,int &r
return read(p_buffer, p_bytes, r_received, false);
};
+int StreamPeerTCPPosix::get_available_bytes() const {
+
+ unsigned long len;
+ int ret = ioctl(sockfd,FIONREAD,&len);
+ ERR_FAIL_COND_V(ret==-1,0)
+ return len;
+
+}
IP_Address StreamPeerTCPPosix::get_connected_host() const {
return peer_host;
diff --git a/drivers/unix/stream_peer_tcp_posix.h b/drivers/unix/stream_peer_tcp_posix.h
index 9b1716ac42..817f24c91c 100644
--- a/drivers/unix/stream_peer_tcp_posix.h
+++ b/drivers/unix/stream_peer_tcp_posix.h
@@ -67,6 +67,8 @@ public:
virtual Error get_data(uint8_t* p_buffer, int p_bytes);
virtual Error get_partial_data(uint8_t* p_buffer, int p_bytes,int &r_received);
+ virtual int get_available_bytes() const;
+
void set_socket(int p_sockfd, IP_Address p_host, int p_port);
virtual IP_Address get_connected_host() const;