utmpd.c (1eabc4bec6d2a5ad71f6a1f0c019af5438d8b1bf) utmpd.c (fd64a0d03455fdb3bbf710e77f2a2f6d08d3cf6c)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 5 unchanged lines hidden (view full) ---

14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 5 unchanged lines hidden (view full) ---

14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright 2014 Shruti V Sampat <shrutisampat@gmail.com>
23 */
24
25/*
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
27/* All Rights Reserved */
28
29/*

--- 142 unchanged lines hidden (view full) ---

172static int proc_is_alive(pid_t pid); /* Check if a process is alive */
173static void warn_utmp(void);
174
175/*
176 * main() - Main does basic setup and calls wait_for_pids() to do the work
177 */
178
179int
26 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
28 */
29
30/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
31/* All Rights Reserved */
32
33/*

--- 142 unchanged lines hidden (view full) ---

176static int proc_is_alive(pid_t pid); /* Check if a process is alive */
177static void warn_utmp(void);
178
179/*
180 * main() - Main does basic setup and calls wait_for_pids() to do the work
181 */
182
183int
180main(argc, argv)
181 char **argv;
184main(int argc, char *argv[])
182{
183 char *defp;
184 struct rlimit rlim;
185 int i;
186 time_t curtime, now;
187
188 prog_name = argv[0]; /* Save invocation name */
189
190 if (getuid() != 0) {
191 (void) fprintf(stderr,
185{
186 char *defp;
187 struct rlimit rlim;
188 int i;
189 time_t curtime, now;
190
191 prog_name = argv[0]; /* Save invocation name */
192
193 if (getuid() != 0) {
194 (void) fprintf(stderr,
192 "You must be root to run this program\n");
195 "You must be root to run this program\n");
193 fatal("You must be root to run this program");
194 }
195
196 if (argc > 1) {
197 if ((argc == 2 && (int)strlen(argv[1]) >= 2) &&
198 (argv[1][0] == '-' && argv[1][1] == 'd')) {
199 Debug = 1;
200 } else {
201 (void) fprintf(stderr,
196 fatal("You must be root to run this program");
197 }
198
199 if (argc > 1) {
200 if ((argc == 2 && (int)strlen(argv[1]) >= 2) &&
201 (argv[1][0] == '-' && argv[1][1] == 'd')) {
202 Debug = 1;
203 } else {
204 (void) fprintf(stderr,
202 "%s: Wrong number of arguments\n", prog_name);
205 "%s: Wrong number of arguments\n", prog_name);
203 (void) fprintf(stderr,
206 (void) fprintf(stderr,
204 "Usage: %s [-debug]\n", prog_name);
207 "Usage: %s [-debug]\n", prog_name);
205 exit(2);
206 }
207 }
208
209 /*
210 * Read defaults file for poll timeout
211 */
212 if (defopen(UTMP_DEFAULT) == 0) {

--- 131 unchanged lines hidden (view full) ---

344 */
345
346static int
347wait_for_pids()
348{
349 register struct pollfd *pfd;
350 register int i;
351 pid_t pid;
208 exit(2);
209 }
210 }
211
212 /*
213 * Read defaults file for poll timeout
214 */
215 if (defopen(UTMP_DEFAULT) == 0) {

--- 131 unchanged lines hidden (view full) ---

347 */
348
349static int
350wait_for_pids()
351{
352 register struct pollfd *pfd;
353 register int i;
354 pid_t pid;
352 int ret_val;
355 int ret_val = 0;
353 int timeout;
354 static time_t last_timeout = 0;
355 static int bad_error = 0; /* Count of POLL errors */
356
357 /*
358 * First time through we initialize last_timeout to now.
359 */
360 if (last_timeout == 0)

--- 722 unchanged lines hidden ---
356 int timeout;
357 static time_t last_timeout = 0;
358 static int bad_error = 0; /* Count of POLL errors */
359
360 /*
361 * First time through we initialize last_timeout to now.
362 */
363 if (last_timeout == 0)

--- 722 unchanged lines hidden ---