Skip to content

Commit

Permalink
Pretty name only for linux?
Browse files Browse the repository at this point in the history
  • Loading branch information
trikko committed Apr 5, 2024
1 parent 63e568d commit 9a1ea5f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions source/serverino/common.d
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,13 @@ version(Posix)
}
}

version(Posix)
version(Linux)
{
import core.sys.posix.pthread : pthread_self, pthread_t;
extern(C) void pthread_setname_np(pthread_t, const(char)*);
}

version(Posix) package void setProcessName(string[] names)
version(Linux) package void setProcessName(string[] names)
{
import core.runtime : Runtime, CArgs;

Expand Down
8 changes: 4 additions & 4 deletions source/serverino/daemon.d
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ package class WorkerInfo
import std.range : repeat;
import std.array : array;

version(Posix) const pname = [exePath, cast(char[])(' '.repeat(30).array)];
version(linux) const pname = [exePath, cast(char[])(' '.repeat(30).array)];
else const pname = exePath;

auto pipes = pipeProcess(pname, Redirect.stdin, env, Config.detached);
Expand Down Expand Up @@ -232,7 +232,7 @@ package:
immutable daemonPid = thisProcessID.to!string;
immutable canaryFileName = tempDir.buildPath("serverino-" ~ daemonPid ~ "-" ~ sha256Of(daemonPid).toHexString!(LetterCase.lower) ~ ".canary");

version(Posix)
version(linux)
{
auto base = baseName(Runtime.args[0]);

Expand Down Expand Up @@ -435,7 +435,7 @@ package:

if (communicator is null)
{
debug warning("Worker #" ~ worker.pi.id.to!string ~ " terminated / crashed / killed (null communicator)");
debug warning("Worker #" ~ worker.pi.id.to!string ~ " exited / crashed / killed (null communicator)");
worker.pi.kill();
worker.setStatus(WorkerInfo.State.STOPPED);
continue;
Expand All @@ -446,7 +446,7 @@ package:

if (bytes == Socket.ERROR)
{
debug warning("Worker #" ~ worker.pi.id.to!string ~ " terminated / crashed / killed (socket error)");
debug warning("Worker #" ~ worker.pi.id.to!string ~ " exited / crashed / killed (socket error)");
worker.setStatus(WorkerInfo.State.STOPPED);
communicator.reset();
}
Expand Down
2 changes: 1 addition & 1 deletion source/serverino/websocket.d
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ struct WebSocketWorker
log("WebSocket started.");
scope(exit) log("WebSocket stopped.");

version(Posix)
version(linux)
{
auto base = baseName(Runtime.args[0]);

Expand Down
4 changes: 2 additions & 2 deletions source/serverino/worker.d
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ struct Worker
assert(ret != -1, "Too many open files. Can't redirect stdin to /dev/null.");
}

version(Posix)
version(linux)
{
auto base = baseName(Runtime.args[0]);

Expand Down Expand Up @@ -547,7 +547,7 @@ struct Worker
import std.array : array;

// Start the process
version(Posix) const pname = [exePath, cast(char[])(' '.repeat(30).array)];
version(linux) const pname = [exePath, cast(char[])(' '.repeat(30).array)];
else const pname = exePath;

auto pipes = pipeProcess(pname, Redirect.stdin, env, Config.detached);
Expand Down

0 comments on commit 9a1ea5f

Please sign in to comment.