Filan recognizes and prints Solaris doors and event ports

This commit is contained in:
Gerhard Rieger 2022-10-29 22:38:49 +02:00
parent c4281baabb
commit 2702fef723
2 changed files with 26 additions and 3 deletions

View file

@ -76,6 +76,8 @@ Features:
Filan prints target of symlink when appropriate Filan prints target of symlink when appropriate
Test: FILANSYMLINK Test: FILANSYMLINK
Filan now recognizes and prints Solaris doors and event ports.
Testing: Testing:
Unset SOCAT_MAIN_WAIT on informational Socat calls Unset SOCAT_MAIN_WAIT on informational Socat calls

View file

@ -162,6 +162,18 @@ int statname(const char *file, int fd, int filetype, FILE *outfile,
return -1; return -1;
#endif /* !_WITH_SOCKET */ #endif /* !_WITH_SOCKET */
break; break;
#ifdef S_IFDOOR
case (S_IFDOOR>>12): /* 13, door (Solaris) */
fputs("door", outfile);
if (file) fprintf(outfile, " %s", file);
break;
#endif /* HAVE_MACRO_S_IFDOOR */
#ifdef S_IFPORT
case (S_IFPORT>>12): /* 14, event port (Solaris) */
fputs("event_port", outfile);
if (file) fprintf(outfile, " %s", file);
break;
#endif /* HAVE_MACRO_S_IFPORT */
} }
/* ioctl() */ /* ioctl() */
fputc('\n', outfile); fputc('\n', outfile);
@ -243,12 +255,21 @@ int sockname(int fd, FILE *outfile, char style) {
#if defined(SO_PROTOCOL) || defined(SO_PROTOTYPE) #if defined(SO_PROTOCOL) || defined(SO_PROTOTYPE)
optlen = sizeof(proto); optlen = sizeof(proto);
#ifdef SO_PROTOCOL #ifdef SO_PROTOCOL
Getsockopt(fd, SOL_SOCKET, SO_PROTOCOL, &proto, &optlen); rc = Getsockopt(fd, SOL_SOCKET, SO_PROTOCOL, &proto, &optlen);
#elif defined(SO_PROTOTYPE) #elif defined(SO_PROTOTYPE)
Getsockopt(fd, SOL_SOCKET, SO_PROTOTYPE, &proto, &optlen); rc = Getsockopt(fd, SOL_SOCKET, SO_PROTOTYPE, &proto, &optlen);
#endif #endif
if (rc < 0) {
Warn5("getsocktop(%d, SOL_SOCKET, "
#ifdef SO_PROTOCOL
"SO_PROTOCOL"
#else
"SO_PROTOTYPE"
#endif
", &%p, {"F_Zu"}): errno=%d (%s)", fd, &proto, optlen, errno, strerror(errno));
}
proto = 0;
#endif /* defined(SO_PROTOCOL) || defined(SO_PROTOTYPE) */ #endif /* defined(SO_PROTOCOL) || defined(SO_PROTOTYPE) */
optlen = sizeof(opttype); optlen = sizeof(opttype);
Getsockopt(fd, SOL_SOCKET, SO_TYPE, &opttype, &optlen); Getsockopt(fd, SOL_SOCKET, SO_TYPE, &opttype, &optlen);
sockettype(opttype, typename, sizeof(typename)); sockettype(opttype, typename, sizeof(typename));