This commit is contained in:
root
2026-06-15 15:40:24 +00:00
parent 5f430155b7
commit 5ee257565c
4 changed files with 79 additions and 38 deletions
+11 -2
View File
@@ -36,7 +36,7 @@ size_t uce_host_memcache_command(uint64_t sockfd, const char* command, size_t co
size_t uce_host_mysql(const char* in, size_t in_len, char* out, size_t cap);
size_t uce_host_request_perf(const char* in, size_t in_len, char* out, size_t cap);
size_t uce_host_shell_exec(const char* cmd, size_t cmd_len, char* buf, size_t cap);
int uce_host_file_open_locked(const char* path, size_t path_len, int open_flags, int lock_type, int create_mode, double wait_timeout_seconds, const char* purpose, size_t purpose_len);
int uce_host_file_open_locked(const char* path, size_t path_len, int open_flags, int lock_type, int create_mode, double wait_timeout_seconds, const char* purpose, size_t purpose_len, const char* current, size_t current_len);
void uce_host_file_close_locked(int handle);
void uce_host_file_release_process_locks(const char* reason, size_t reason_len);
size_t uce_host_file_read_locked_fd(int handle, char* buf, size_t cap);
@@ -105,9 +105,10 @@ bool file_exists(String path)
}
int file_open_locked(String file_name, int open_flags, int lock_type, int create_mode, f64 wait_timeout_seconds, String purpose)
{
String current = wasm_current_unit_file();
return(uce_host_file_open_locked(
file_name.data(), file_name.size(), open_flags, lock_type, create_mode, wait_timeout_seconds,
purpose.data(), purpose.size()
purpose.data(), purpose.size(), current.data(), current.size()
));
}
void file_close_locked(int fd) { uce_host_file_close_locked(fd); }
@@ -525,6 +526,7 @@ StringMap default_config()
#include <fcntl.h>
#include <limits.h>
#include <sys/file.h>
#include <errno.h>
#include "sys.h"
#include "hash.h"
@@ -793,6 +795,12 @@ bool file_write_all(int fd, const char* data, size_t remaining)
{
auto bytes_written = write(fd, data, remaining);
if(bytes_written < 0)
{
if(errno == EINTR)
continue;
return(false);
}
if(bytes_written == 0)
return(false);
data += bytes_written;
remaining -= bytes_written;
@@ -1009,6 +1017,7 @@ u64 socket_connect(String host, short port)
{
print("SOCKET ERROR (could not connect to address " + String(host) + ":" + std::to_string(port) + ")\n");
perror("SOCKET ERROR ");
close(sockfd);
return(0);
}
context->resources.sockets.push_back(sockfd);