mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:58:11 +00:00
Kernel: Customize absolute_path() for more file types
This commit is contained in:
parent
1d03391488
commit
dadf6337ef
7 changed files with 91 additions and 15 deletions
|
@ -254,3 +254,29 @@ StringView LocalSocket::socket_path() const
|
|||
int len = strnlen(m_address.sun_path, sizeof(m_address.sun_path));
|
||||
return { m_address.sun_path, len };
|
||||
}
|
||||
|
||||
String LocalSocket::absolute_path(const FileDescription& description) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append("socket:");
|
||||
builder.append(socket_path());
|
||||
|
||||
switch (role(description)) {
|
||||
case Role::Listener:
|
||||
builder.append(" (listening)");
|
||||
break;
|
||||
case Role::Accepted:
|
||||
builder.appendf(" (accepted from pid %d)", origin_pid());
|
||||
break;
|
||||
case Role::Connected:
|
||||
builder.appendf(" (connected to pid %d)", acceptor_pid());
|
||||
break;
|
||||
case Role::Connecting:
|
||||
builder.append(" (connecting)");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return builder.to_string();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue