fix compile error

This commit is contained in:
Xuan Son Nguyen 2025-11-19 21:33:44 +01:00
parent fc5901a449
commit 399f536dc7
3 changed files with 18 additions and 1 deletions

View File

@ -9,8 +9,13 @@
#include <thread>
#include <mutex>
#include <condition_variable>
#if !defined(_WIN32)
#include <spawn.h>
#include <signal.h> // for kill()
#include <signal.h> // kill()
#include <sys/wait.h> // waitpid()
#include <unistd.h> // readlink()
#endif
#if defined(__APPLE__) && defined(__MACH__)
// macOS: use _NSGetExecutablePath to get the executable path

View File

@ -7,6 +7,16 @@
#include <mutex>
#include <condition_variable>
// pid_t is defined in <sys/types.h> on POSIX systems. On Windows, this
// header doesn't exist and the server code is not expected to build/run,
// but provide a minimal fallback typedef to avoid include errors when this
// header is parsed in non-POSIX builds.
#if defined(_WIN32)
using pid_t = int;
#else
#include <sys/types.h>
#endif
enum server_model_status {
SERVER_MODEL_STATUS_UNLOADED,
SERVER_MODEL_STATUS_LOADING,
@ -34,6 +44,7 @@ static std::string server_model_status_to_string(server_model_status status) {
case SERVER_MODEL_STATUS_LOADING: return "loading";
case SERVER_MODEL_STATUS_LOADED: return "loaded";
case SERVER_MODEL_STATUS_FAILED: return "failed";
default: return "unknown";
}
}

View File

@ -5662,6 +5662,7 @@ int main(int argc, char ** argv, char ** envp) {
// register API routes
server_routes routes(params, ctx_server, ctx_http);
// TODO: improve this by changing arg.cpp
bool is_router_server = params.model.path == DEFAULT_MODEL_PATH;
if (is_router_server) {
// setup server instances manager