/** * Retrieves the peer's numeric effective group ID. * @return The EGID. */ public int getGid() { return ucred.getGidField().intValue(); }
/** * Retrieves the peer's process ID. * @return The PID. */ public int getPid() { return ucred.getPidField().intValue(); }
/** * Retrieves the peer's numeric effective user ID. * @return The EUID. */ public int getUid() { return ucred.getUidField().intValue(); }
static Credentials getCredentials(int fd) { Ucred c = new Ucred(); int error = Native.getsockopt(fd, SocketLevel.SOL_SOCKET, SocketOption.SO_PEERCRED, c); if (error != 0) { throw new UnsupportedOperationException(Native.getLastErrorString()); } return new Credentials(c); } }