+/* Is the utmp entry U desired by the user who asked for OPTIONS? */
+
+static bool
+desirable_utmp_entry (STRUCT_UTMP const *u, int options)
+{
+ bool user_proc = IS_USER_PROCESS (u);
+ if ((options & READ_UTMP_USER_PROCESS) && !user_proc)
+ return false;
+ if ((options & READ_UTMP_CHECK_PIDS)
+ && user_proc
+ && 0 < UT_PID (u)
+ && (kill (UT_PID (u), 0) < 0 && errno == ESRCH))
+ return false;
+ return true;
+}
+
+/* Read the utmp entries corresponding to file FILE into freshly-