ruby-1.8.7 中缺少 SO_PEERCRED 吗?
不确定如何恢复连接到 ruby 中的 UNIX 套接字的进程的对等 ID。我检查了一下,不确定 SO_PEERCRED 是在哪里定义的。我正在使用 ruby-1.8.7
<块引用>Socket.constants.sort => [“AF_APPLETALK”、“AF_CCITT”、“AF_CHAOS”、“AF_CNT”、“AF_COIP”、“AF_DATAKIT”、“AF_DLI”、“AF_E164”、“AF_ECMA”、“AF_HYLINK”、“AF_IMPLINK”、“AF_INET”、“ AF_INET6"、"AF_IPX"、"AF_ISDN"、 “AF_ISO”、“AF_LAT”、“AF_LINK”、“AF_LOCAL”、“AF_MAX”、“AF_NATM”、“AF_NDRV”、“AF_NETBIOS”、“AF_NS”、“AF_OSI”、“AF_PPP”、“AF_PUP”、“AF_ROUTE” ”、“AF_SIP”、“AF_SNA”、“AF_SYSTEM”、“AF_UNIX”、 "AF_UNSPEC"、"AI_ADDRCONFIG"、"AI_ALL"、"AI_CANONNAME"、"AI_DEFAULT"、"AI_MASK"、"AI_NUMERICHOST"、"AI_PASSIVE"、"AI_V4MAPPED"、"AI_V4MAPPED_CFG"、"APPEND"、"CREAT"、"常量", "EAI_ADDRFAMILY", “EAI_AGAIN”、“EAI_BADFLAGS”、“EAI_BADHINTS”、“EAI_FAIL”、“EAI_FAMILY”、“EAI_MAX”、“EAI_MEMORY”、“EAI_NODATA”、“EAI_NONAME”、“EAI_PROTOCOL”、“EAI_SERVICE”、“EAI_SOCKTYPE”、“EAI_SYSTEM” ", "排除", “枚举器”,“FNM_CASEFOLD”,“FNM_DOTMATCH”,“FNM_NOESCAPE”,“FNM_PATHNAME”,“FNM_SYSCASE”,“INADDR_ALLHOSTS_GROUP”,“INADDR_ANY”,“INADDR_BROADCAST”,“INADDR_LOOPBACK”,“INADDR_MAX_LOCAL_GROUP”, “INADDR_NONE”,“INADDR_UNSPEC_GROUP”,“IPPORT_RESERVED”,“IPPORT_USERRESERVED”,“IPPROTO_EGP”,“IPPROTO_EON”,“IPPROTO_GGP”,“IPPROTO_HELLO”,“IPPROTO_ICMP”,“IPPROTO_IDP”,“IPPROTO_IGMP”,“IPPROTO_IP”, “IPPROTO_MAX”,“IPPROTO_ND”,“IPPROTO_PUP”,“IPPROTO_RAW”,“IPPROTO_TCP”,“IPPROTO_TP”,“IPPROTO_UDP”,“IPPROTO_XTP”,“IP_ADD_MEMBERSHIP”,“IP_DEFAULT_MULTICAST_LOOP”,“IP_DEFAULT_MULTICAST_TTL”, “IP_DROP_MEMBERSHIP”、“IP_HDRINCL”、“IP_MAX_MEMBERSHIPS”、“IP_MULTICAST_IF”、“IP_MULTICAST_LOOP”、“IP_MULTICAST_TTL”、“IP_OPTIONS”、“IP_RECVDSTADDR”、“IP_RECVOPTS”、“IP_RECVRETOPTS”、“IP_RETOPTS”、“IP_TOS”、 “IP_TTL”、“LOCK_EX”、“LOCK_NB”、“LOCK_SH”、“LOCK_UN”、“MSG_CTRUNC”、“MSG_DONTROUTE”、“MSG_DONTWAIT”、“MSG_EOF”、“MSG_EOR”、“MSG_FLUSH”、“MSG_HAVEMORE”、“MSG_HOLD” ", "MSG_OOB", “MSG_PEEK”、“MSG_RCVMORE”、“MSG_SEND”、“MSG_TRUNC”、“MSG_WAITALL”、“NI_DGRAM”、“NI_MAXHOST”、“NI_MAXSERV”、“NI_NAMEREQD”、“NI_NOFQDN”、“NI_NUMERICHOST”、“NI_NUMERICSERV”、“NOCTTY” ", "非阻塞", “PF_APPLETALK”、“PF_CCITT”、“PF_CHAOS”、“PF_CNT”、“PF_COIP”、“PF_DATAKIT”、“PF_DLI”、“PF_ECMA”、“PF_HYLINK”、“PF_IMPLINK”、“PF_INET”、“PF_INET6”、“PF_IPX” "、"PF_ISDN"、"PF_ISO"、"PF_KEY"、 “PF_LAT”、“PF_LINK”、“PF_LOCAL”、“PF_MAX”、“PF_NATM”、“PF_NDRV”、“PF_NETBIOS”、“PF_NS”、“PF_OSI”、“PF_PIP”、“PF_PPP”、“PF_PUP”、“PF_ROUTE” ”、“PF_RTIP”、“PF_SIP”、“PF_SNA”、“PF_SYSTEM”、 “PF_UNIX”、“PF_UNSPEC”、“PF_XTP”、“RDONLY”、“RDWR”、“SEEK_CUR”、“SEEK_END”、“SEEK_SET”、“SHUT_RD”、“SHUT_RDWR”、“SHUT_WR”、“SOCK_DGRAM”、“SOCK_RAW” ”、“SOCK_RDM”、“SOCK_SEQPACKET”、 “SOCK_STREAM”,“SOL_SOCKET”,“SO_ACCEPTCONN”,“SO_BROADCAST”,“SO_DEBUG”,“SO_DONTROUTE”,“SO_DONTTRUNC”,“SO_ERROR”,“SO_KEEPALIVE”,“SO_LINGER”,“SO_NKE”,“SO_NOSIGPIPE”,“SO_NREAD” “, “SO_OOBINLINE”,“SO_RCVBUF”,“SO_RCVLOWAT”,“SO_RCVTIMEO”,“SO_REUSEADDR”,“SO_REUSEPORT”,“SO_SNDBUF”,“SO_SNDLOWAT”,“SO_SNDTIMEO”,“SO_TIMESTAMP”,“SO_TYPE”,“SO_USELOOPBACK”,“SO_WANTMORE “, “SO_WANTOOBFLAG”,“SYNC”,“TCP_MAXSEG”,“TCP_NODELAY”,“TRUNC”,“WRONLY”]
Not sure how you revive the peer id of a process connecting to a UNIX socket in ruby. I checked out and not sure where the SO_PEERCRED is defined. I am using ruby-1.8.7
Socket.constants.sort
=> ["AF_APPLETALK", "AF_CCITT", "AF_CHAOS", "AF_CNT", "AF_COIP", "AF_DATAKIT", "AF_DLI", "AF_E164", "AF_ECMA", "AF_HYLINK", "AF_IMPLINK", "AF_INET", "AF_INET6", "AF_IPX", "AF_ISDN", "AF_ISO", "AF_LAT", "AF_LINK", "AF_LOCAL", "AF_MAX", "AF_NATM", "AF_NDRV", "AF_NETBIOS", "AF_NS", "AF_OSI", "AF_PPP", "AF_PUP", "AF_ROUTE", "AF_SIP", "AF_SNA", "AF_SYSTEM", "AF_UNIX", "AF_UNSPEC", "AI_ADDRCONFIG", "AI_ALL", "AI_CANONNAME", "AI_DEFAULT", "AI_MASK", "AI_NUMERICHOST", "AI_PASSIVE", "AI_V4MAPPED", "AI_V4MAPPED_CFG", "APPEND", "CREAT", "Constants", "EAI_ADDRFAMILY", "EAI_AGAIN", "EAI_BADFLAGS", "EAI_BADHINTS", "EAI_FAIL", "EAI_FAMILY", "EAI_MAX", "EAI_MEMORY", "EAI_NODATA", "EAI_NONAME", "EAI_PROTOCOL", "EAI_SERVICE", "EAI_SOCKTYPE", "EAI_SYSTEM", "EXCL", "Enumerator", "FNM_CASEFOLD", "FNM_DOTMATCH", "FNM_NOESCAPE", "FNM_PATHNAME", "FNM_SYSCASE", "INADDR_ALLHOSTS_GROUP", "INADDR_ANY", "INADDR_BROADCAST", "INADDR_LOOPBACK", "INADDR_MAX_LOCAL_GROUP", "INADDR_NONE", "INADDR_UNSPEC_GROUP", "IPPORT_RESERVED", "IPPORT_USERRESERVED", "IPPROTO_EGP", "IPPROTO_EON", "IPPROTO_GGP", "IPPROTO_HELLO", "IPPROTO_ICMP", "IPPROTO_IDP", "IPPROTO_IGMP", "IPPROTO_IP", "IPPROTO_MAX", "IPPROTO_ND", "IPPROTO_PUP", "IPPROTO_RAW", "IPPROTO_TCP", "IPPROTO_TP", "IPPROTO_UDP", "IPPROTO_XTP", "IP_ADD_MEMBERSHIP", "IP_DEFAULT_MULTICAST_LOOP", "IP_DEFAULT_MULTICAST_TTL", "IP_DROP_MEMBERSHIP", "IP_HDRINCL", "IP_MAX_MEMBERSHIPS", "IP_MULTICAST_IF", "IP_MULTICAST_LOOP", "IP_MULTICAST_TTL", "IP_OPTIONS", "IP_RECVDSTADDR", "IP_RECVOPTS", "IP_RECVRETOPTS", "IP_RETOPTS", "IP_TOS", "IP_TTL", "LOCK_EX", "LOCK_NB", "LOCK_SH", "LOCK_UN", "MSG_CTRUNC", "MSG_DONTROUTE", "MSG_DONTWAIT", "MSG_EOF", "MSG_EOR", "MSG_FLUSH", "MSG_HAVEMORE", "MSG_HOLD", "MSG_OOB", "MSG_PEEK", "MSG_RCVMORE", "MSG_SEND", "MSG_TRUNC", "MSG_WAITALL", "NI_DGRAM", "NI_MAXHOST", "NI_MAXSERV", "NI_NAMEREQD", "NI_NOFQDN", "NI_NUMERICHOST", "NI_NUMERICSERV", "NOCTTY", "NONBLOCK", "PF_APPLETALK", "PF_CCITT", "PF_CHAOS", "PF_CNT", "PF_COIP", "PF_DATAKIT", "PF_DLI", "PF_ECMA", "PF_HYLINK", "PF_IMPLINK", "PF_INET", "PF_INET6", "PF_IPX", "PF_ISDN", "PF_ISO", "PF_KEY", "PF_LAT", "PF_LINK", "PF_LOCAL", "PF_MAX", "PF_NATM", "PF_NDRV", "PF_NETBIOS", "PF_NS", "PF_OSI", "PF_PIP", "PF_PPP", "PF_PUP", "PF_ROUTE", "PF_RTIP", "PF_SIP", "PF_SNA", "PF_SYSTEM", "PF_UNIX", "PF_UNSPEC", "PF_XTP", "RDONLY", "RDWR", "SEEK_CUR", "SEEK_END", "SEEK_SET", "SHUT_RD", "SHUT_RDWR", "SHUT_WR", "SOCK_DGRAM", "SOCK_RAW", "SOCK_RDM", "SOCK_SEQPACKET", "SOCK_STREAM", "SOL_SOCKET", "SO_ACCEPTCONN", "SO_BROADCAST", "SO_DEBUG", "SO_DONTROUTE", "SO_DONTTRUNC", "SO_ERROR", "SO_KEEPALIVE", "SO_LINGER", "SO_NKE", "SO_NOSIGPIPE", "SO_NREAD", "SO_OOBINLINE", "SO_RCVBUF", "SO_RCVLOWAT", "SO_RCVTIMEO", "SO_REUSEADDR", "SO_REUSEPORT", "SO_SNDBUF", "SO_SNDLOWAT", "SO_SNDTIMEO", "SO_TIMESTAMP", "SO_TYPE", "SO_USELOOPBACK", "SO_WANTMORE", "SO_WANTOOBFLAG", "SYNC", "TCP_MAXSEG", "TCP_NODELAY", "TRUNC", "WRONLY"]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你使用什么操作系统?
SO_PEERCRED
仅适用于 Linux,并且是 仅在平台上存在时才在 Ruby 中定义。比较:
和
What OS are you on?
SO_PEERCRED
is Linux only, and is only defined in Ruby if it exists on the platform.Compare:
and