diff options
Diffstat (limited to 'usr/src/cmd')
49 files changed, 247 insertions, 169 deletions
diff --git a/usr/src/cmd/cmd-inet/sbin/dhcpagent/agent.c b/usr/src/cmd/cmd-inet/sbin/dhcpagent/agent.c index ee7a987003..d692509d09 100644 --- a/usr/src/cmd/cmd-inet/sbin/dhcpagent/agent.c +++ b/usr/src/cmd/cmd-inet/sbin/dhcpagent/agent.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -35,6 +34,7 @@ #include <unistd.h> #include <signal.h> #include <stdio.h> +#include <stdio_ext.h> #include <dhcp_hostconf.h> #include <dhcp_symbol.h> #include <dhcpagent_ipc.h> @@ -216,6 +216,8 @@ main(int argc, char **argv) if (setrlimit(RLIMIT_NOFILE, &rl) == -1) dhcpmsg(MSG_ERR, "setrlimit failed"); + (void) enable_extended_FILE_stdio(-1, -1); + /* * create the ipc channel that the agent will listen for * requests on, and register it with the event handler so that diff --git a/usr/src/cmd/cmd-inet/usr.lib/dsvclockd/dsvclockd.c b/usr/src/cmd/cmd-inet/usr.lib/dsvclockd/dsvclockd.c index 38f51b92a2..b0684c958b 100644 --- a/usr/src/cmd/cmd-inet/usr.lib/dsvclockd/dsvclockd.c +++ b/usr/src/cmd/cmd-inet/usr.lib/dsvclockd/dsvclockd.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -43,6 +42,7 @@ #include <assert.h> #include <stddef.h> #include <stdio.h> +#include <stdio_ext.h> #include <string.h> #include <unistd.h> #include <signal.h> @@ -192,6 +192,8 @@ main(int argc, char **argv) if (setrlimit(RLIMIT_NOFILE, &rl) == -1) dhcpmsg(MSG_ERR, "setrlimit failed"); + (void) enable_extended_FILE_stdio(-1, -1); + if (enumerate_dd(&modules, &nmodules) != DSVC_SUCCESS) { dhcpmsg(MSG_ERROR, "cannot enumerate public modules, exiting"); return (EXIT_FAILURE); diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/main.c b/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/main.c index 6661e294a0..7555def813 100644 --- a/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/main.c +++ b/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/main.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -104,6 +103,7 @@ */ #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <ctype.h> @@ -437,6 +437,7 @@ duplicate IP address detection!\n\n")); strerror(errno)); return (err); } + (void) enable_extended_FILE_stdio(-1, -1); /* Detach console */ (void) setsid(); diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/tests/test_client.c b/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/tests/test_client.c index 0f84bc8f66..9aae3f7e95 100644 --- a/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/tests/test_client.c +++ b/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/tests/test_client.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,13 +19,14 @@ * CDDL HEADER END */ /* - * Copyright 1993-2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <ctype.h> @@ -1147,6 +1147,8 @@ main(int argc, char *argv[]) (void) fprintf(stderr, "Cannot set open file limit: %s\n", strerror(errno)); } + (void) enable_extended_FILE_stdio(-1, -1); + if (argc < 5) { (void) fprintf(stderr, "%s <interface> <ether_addr> <protocol> " "<clients> [time] [desynch] [avg] [relayaddr]\n", argv[0]); diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/tests/test_dstore.c b/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/tests/test_dstore.c index ea68bc135b..d96dec51e9 100644 --- a/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/tests/test_dstore.c +++ b/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/tests/test_dstore.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,13 +19,14 @@ * CDDL HEADER END */ /* - * Copyright (c) 2001-2002 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> @@ -784,6 +784,8 @@ main(int c, char **v) (void) fprintf(stderr, "Cannot set open file limit: %s\n", strerror(errno)); } + (void) enable_extended_FILE_stdio(-1, -1); + if (c == 1) { (void) fprintf(stderr, "/*\n"\ diff --git a/usr/src/cmd/cmd-inet/usr.lib/inetd/inetd.c b/usr/src/cmd/cmd-inet/usr.lib/inetd/inetd.c index c0a1051f73..eefcc1d6b8 100644 --- a/usr/src/cmd/cmd-inet/usr.lib/inetd/inetd.c +++ b/usr/src/cmd/cmd-inet/usr.lib/inetd/inetd.c @@ -88,6 +88,7 @@ #include <netdb.h> #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <strings.h> #include <unistd.h> @@ -3790,6 +3791,8 @@ main(int argc, char *argv[]) msg_init(); /* setup logging */ + (void) enable_extended_FILE_stdio(-1, -1); + /* inetd invocation syntax is inetd [alt_conf_file] method_name */ switch (argc) { diff --git a/usr/src/cmd/cmd-inet/usr.sbin/in.rarpd.c b/usr/src/cmd/cmd-inet/usr.sbin/in.rarpd.c index 709aa39e03..f18bb2e0cf 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/in.rarpd.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/in.rarpd.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ @@ -46,6 +45,7 @@ #include <unistd.h> #include <sys/resource.h> #include <stdio.h> +#include <stdio_ext.h> #include <stdarg.h> #include <string.h> #include <ctype.h> @@ -217,6 +217,7 @@ main(int argc, char *argv[]) rl.rlim_max = RLIM_INFINITY; if (setrlimit(RLIMIT_NOFILE, &rl) == -1) syserr("setrlimit"); + (void) enable_extended_FILE_stdio(-1, -1); (void) openlog(cmdname, LOG_PID, LOG_DAEMON); diff --git a/usr/src/cmd/fs.d/autofs/autod_main.c b/usr/src/cmd/fs.d/autofs/autod_main.c index ce57a1fc80..a796b05836 100644 --- a/usr/src/cmd/fs.d/autofs/autod_main.c +++ b/usr/src/cmd/fs.d/autofs/autod_main.c @@ -26,6 +26,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <signal.h> @@ -281,6 +282,7 @@ main(argc, argv) } closefrom(3); } + (void) enable_extended_FILE_stdio(-1, -1); } else { syslog(LOG_ERR, "unable to increase threads - continue with default"); diff --git a/usr/src/cmd/fs.d/cachefs/cfsd/cfsd_main.c b/usr/src/cmd/fs.d/cachefs/cfsd/cfsd_main.c index ee2551313c..4f1fdeb8d3 100644 --- a/usr/src/cmd/fs.d/cachefs/cfsd/cfsd_main.c +++ b/usr/src/cmd/fs.d/cachefs/cfsd/cfsd_main.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 1998-2000, 2002 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,6 +30,7 @@ */ #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <string.h> #include <errno.h> @@ -150,6 +150,7 @@ main(int argc, char **argv) dbug_leave("main"); return (1); } + (void) enable_extended_FILE_stdio(-1, -1); while ((c = getopt(argc, argv, "fmr:#:")) != EOF) { switch (c) { diff --git a/usr/src/cmd/fs.d/mount.c b/usr/src/cmd/fs.d/mount.c index f0c9e9c760..238ef3c00a 100644 --- a/usr/src/cmd/fs.d/mount.c +++ b/usr/src/cmd/fs.d/mount.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -24,13 +23,14 @@ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.82 */ #include <stdio.h> +#include <stdio_ext.h> #include <limits.h> #include <fcntl.h> #include <unistd.h> @@ -920,6 +920,7 @@ parmount(char **mntlist, int count, char *fstype) if (setrlimit(RLIMIT_NOFILE, &rl) == 0) maxfd = (int)rl.rlim_cur; } + (void) enable_extended_FILE_stdio(-1, -1); /* * The parent needs to maintain 3 of its own fd's, plus 2 for diff --git a/usr/src/cmd/fs.d/nfs/nfsd/nfsd.c b/usr/src/cmd/fs.d/nfs/nfsd/nfsd.c index 818552f821..6dbb8053c4 100644 --- a/usr/src/cmd/fs.d/nfs/nfsd/nfsd.c +++ b/usr/src/cmd/fs.d/nfs/nfsd/nfsd.c @@ -57,6 +57,7 @@ #include <nfs/nfs_acl.h> #include <nfs/nfssys.h> #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <signal.h> #include <netconfig.h> @@ -155,6 +156,8 @@ main(int ac, char *av[]) exit(1); } + (void) enable_extended_FILE_stdio(-1, -1); + /* * Read in the values from config file first before we check * commandline options so the options override the file. diff --git a/usr/src/cmd/fs.d/nfs/statd/sm_svc.c b/usr/src/cmd/fs.d/nfs/statd/sm_svc.c index a3dca0ca5f..bf0d9e2e0d 100644 --- a/usr/src/cmd/fs.d/nfs/statd/sm_svc.c +++ b/usr/src/cmd/fs.d/nfs/statd/sm_svc.c @@ -39,6 +39,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <ftw.h> #include <signal.h> @@ -536,6 +537,8 @@ main(int argc, char *argv[]) syslog(LOG_ERR, "statd: unable to set RLIMIT_NOFILE to %d\n", MAX_FDS); + (void) enable_extended_FILE_stdio(-1, -1); + if (!debug) { ppid = fork(); if (ppid == -1) { diff --git a/usr/src/cmd/fs.d/umount.c b/usr/src/cmd/fs.d/umount.c index 0139e68205..9d75f87544 100644 --- a/usr/src/cmd/fs.d/umount.c +++ b/usr/src/cmd/fs.d/umount.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,6 +30,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <limits.h> #include <unistd.h> #include <stdlib.h> @@ -594,6 +594,7 @@ parumount(char **mntlist, int count) rl.rlim_cur = rl.rlim_max; if (setrlimit(RLIMIT_NOFILE, &rl) == 0) maxfd = (int)rl.rlim_cur; + (void) enable_extended_FILE_stdio(-1, -1); } /* diff --git a/usr/src/cmd/gcore/gcore.c b/usr/src/cmd/gcore/gcore.c index b782d14c6b..4966fe0b8e 100644 --- a/usr/src/cmd/gcore/gcore.c +++ b/usr/src/cmd/gcore/gcore.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -28,6 +27,7 @@ #include <stdlib.h> #include <stdio.h> +#include <stdio_ext.h> #include <limits.h> #include <libproc.h> #include <sys/corectl.h> @@ -232,6 +232,7 @@ main(int argc, char **argv) if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) { rlim.rlim_cur = rlim.rlim_max; (void) setrlimit(RLIMIT_NOFILE, &rlim); + (void) enable_extended_FILE_stdio(-1, -1); } for (i = 0; i < argc; i++) { diff --git a/usr/src/cmd/gss/gssd/gssd_proc.c b/usr/src/cmd/gss/gssd/gssd_proc.c index 1cb640ca89..9e69195a41 100644 --- a/usr/src/cmd/gss/gssd/gssd_proc.c +++ b/usr/src/cmd/gss/gssd/gssd_proc.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,6 +30,7 @@ */ #include <stdio.h> +#include <stdio_ext.h> #include <unistd.h> #include <pwd.h> #include <grp.h> @@ -103,6 +103,7 @@ gssd_setup(char *arg) GSSD_FD_LIMIT : rl.rlim_max; if ((setrlimit(RLIMIT_NOFILE, &rl)) == 0) max_contexts = rl.rlim_cur * FDCACHE_PERCENTAGE; + (void) enable_extended_FILE_stdio(-1, -1); } gssd_ctx_slot_tbl = (struct gssd_ctx_slot *) diff --git a/usr/src/cmd/keyserv/keyserv.c b/usr/src/cmd/keyserv/keyserv.c index 1c5804142d..a998b605aa 100644 --- a/usr/src/cmd/keyserv/keyserv.c +++ b/usr/src/cmd/keyserv/keyserv.c @@ -47,6 +47,7 @@ */ #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> @@ -185,6 +186,7 @@ main(int argc, char *argv[]) limit = FD_SETSIZE; rl.rlim_cur = limit; (void) setrlimit(RLIMIT_NOFILE, &rl); + (void) enable_extended_FILE_stdio(-1, -1); } __key_encryptsession_pk_LOCAL = &__key_encrypt_pk_2_svc; diff --git a/usr/src/cmd/krb5/kadmin/server/ovsec_kadmd.c b/usr/src/cmd/krb5/kadmin/server/ovsec_kadmd.c index cad8745566..9f8ab69426 100644 --- a/usr/src/cmd/krb5/kadmin/server/ovsec_kadmd.c +++ b/usr/src/cmd/krb5/kadmin/server/ovsec_kadmd.c @@ -33,6 +33,7 @@ */ #include <stdio.h> +#include <stdio_ext.h> #include <signal.h> #include <syslog.h> #include <sys/types.h> @@ -465,7 +466,8 @@ main(int argc, char *argv[]) if (getrlimit(RLIMIT_NOFILE, &rl) == 0) { rl.rlim_cur = rl.rlim_max = MAX(rl.rlim_max, FD_SETSIZE); - setrlimit(RLIMIT_NOFILE, &rl); + (void) setrlimit(RLIMIT_NOFILE, &rl); + (void) enable_extended_FILE_stdio(-1, -1); } if (!nofork && (ret = daemon(0, 0))) { diff --git a/usr/src/cmd/lp/cmd/lpsched/lpsched.c b/usr/src/cmd/lp/cmd/lpsched/lpsched.c index c69e14434a..82d9a80204 100644 --- a/usr/src/cmd/lp/cmd/lpsched/lpsched.c +++ b/usr/src/cmd/lp/cmd/lpsched/lpsched.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -40,6 +39,7 @@ #include <sys/resource.h> #include <syslog.h> #include <locale.h> +#include <stdio_ext.h> int lock_fd = -1; @@ -199,6 +199,7 @@ SkipD: rlim.rlim_max = rlim.rlim_cur = fd_limit; setrlimit(RLIMIT_NOFILE, &rlim); getrlimit(RLIMIT_NOFILE, &rlim); + (void) enable_extended_FILE_stdio(-1, -1); syslog(LOG_DEBUG, "file descriptor resource limit is %d (~%d printers)", rlim.rlim_cur, (rlim.rlim_cur - 12)/ 2); diff --git a/usr/src/cmd/lvm/rpc.metamhd/mhd_init.c b/usr/src/cmd/lvm/rpc.metamhd/mhd_init.c index 97fc778ff4..7428d9213e 100644 --- a/usr/src/cmd/lvm/rpc.metamhd/mhd_init.c +++ b/usr/src/cmd/lvm/rpc.metamhd/mhd_init.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 1999-2002 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,6 +30,7 @@ #include <grp.h> #include <pwd.h> #include <signal.h> +#include <stdio_ext.h> #include <syslog.h> #include <netdir.h> #include <netdb.h> @@ -121,6 +121,7 @@ mhd_setup( rlimit.rlim_cur = rlimit.rlim_max = 1024; if (setrlimit(RLIMIT_NOFILE, &rlimit) != 0) return (mhd_error(mhep, errno, "setrlimit(RLIMIT_NOFILE)")); + (void) enable_extended_FILE_stdio(-1, -1); /* set default RT priority */ (void) memset(&pcinfo, 0, sizeof (pcinfo)); diff --git a/usr/src/cmd/mdb/common/mdb/mdb_proc.c b/usr/src/cmd/mdb/common/mdb/mdb_proc.c index 70fe311d0e..be50280b4c 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_proc.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_proc.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -98,6 +97,7 @@ #include <sys/stat.h> #include <termio.h> #include <signal.h> +#include <stdio_ext.h> #include <stdlib.h> #include <string.h> @@ -5176,6 +5176,7 @@ mdb_proc_tgt_create(mdb_tgt_t *t, int argc, const char *argv[]) if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) { rlim.rlim_cur = rlim.rlim_max; (void) setrlimit(RLIMIT_NOFILE, &rlim); + (void) enable_extended_FILE_stdio(-1, -1); } /* diff --git a/usr/src/cmd/prstat/prutil.c b/usr/src/cmd/prstat/prutil.c index 4f2019989b..8785f6a107 100644 --- a/usr/src/cmd/prstat/prutil.c +++ b/usr/src/cmd/prstat/prutil.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -42,6 +41,7 @@ #include <stdlib.h> #include <stdarg.h> #include <stdio.h> +#include <stdio_ext.h> #include <errno.h> #include <ctype.h> #include <poll.h> @@ -252,6 +252,7 @@ Setrlimit() fd_limit = rlim.rlim_cur; rlim.rlim_max = MIN(rlim.rlim_max, RLIMIT_NOFILE_MAX); rlim.rlim_cur = rlim.rlim_max; + (void) enable_extended_FILE_stdio(-1, -1); if (setrlimit(RLIMIT_NOFILE, &rlim) == -1) return (fd_limit); else diff --git a/usr/src/cmd/ptools/pcred/pcred.c b/usr/src/cmd/ptools/pcred/pcred.c index 62d4c7b94f..028666ab66 100644 --- a/usr/src/cmd/ptools/pcred/pcred.c +++ b/usr/src/cmd/ptools/pcred/pcred.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,13 +19,14 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> @@ -127,6 +127,7 @@ main(int argc, char **argv) if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) { rlim.rlim_cur = rlim.rlim_max; (void) setrlimit(RLIMIT_NOFILE, &rlim); + (void) enable_extended_FILE_stdio(-1, -1); } while (argc-- > 0) diff --git a/usr/src/cmd/ptools/pflags/pflags.c b/usr/src/cmd/ptools/pflags/pflags.c index 79a02f4bbd..cdb2feb645 100644 --- a/usr/src/cmd/ptools/pflags/pflags.c +++ b/usr/src/cmd/ptools/pflags/pflags.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,13 +19,14 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <ctype.h> @@ -113,6 +113,7 @@ main(int argc, char **argv) if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) { rlim.rlim_cur = rlim.rlim_max; (void) setrlimit(RLIMIT_NOFILE, &rlim); + (void) enable_extended_FILE_stdio(-1, -1); } while (argc-- > 0) diff --git a/usr/src/cmd/ptools/pldd/pldd.c b/usr/src/cmd/ptools/pldd/pldd.c index 75540e58c3..72f3c9bf8d 100644 --- a/usr/src/cmd/ptools/pldd/pldd.c +++ b/usr/src/cmd/ptools/pldd/pldd.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,13 +19,14 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <ctype.h> @@ -86,6 +86,7 @@ main(int argc, char **argv) if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) { rlim.rlim_cur = rlim.rlim_max; (void) setrlimit(RLIMIT_NOFILE, &rlim); + (void) enable_extended_FILE_stdio(-1, -1); } (void) proc_initstdio(); diff --git a/usr/src/cmd/ptools/pmap/pmap.c b/usr/src/cmd/ptools/pmap/pmap.c index d0d11de3c8..7d2234aced 100644 --- a/usr/src/cmd/ptools/pmap/pmap.c +++ b/usr/src/cmd/ptools/pmap/pmap.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,13 +19,14 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <ctype.h> @@ -234,6 +234,7 @@ main(int argc, char **argv) if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) { rlim.rlim_cur = rlim.rlim_max; (void) setrlimit(RLIMIT_NOFILE, &rlim); + (void) enable_extended_FILE_stdio(-1, -1); } while (argc-- > 0) { diff --git a/usr/src/cmd/ptools/ppriv/ppriv.c b/usr/src/cmd/ptools/ppriv/ppriv.c index 596ceed347..21d25b4b9f 100644 --- a/usr/src/cmd/ptools/ppriv/ppriv.c +++ b/usr/src/cmd/ptools/ppriv/ppriv.c @@ -28,6 +28,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> @@ -129,6 +130,7 @@ main(int argc, char **argv) if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) { rlim.rlim_cur = rlim.rlim_max; (void) setrlimit(RLIMIT_NOFILE, &rlim); + (void) enable_extended_FILE_stdio(-1, -1); } if (exec) { diff --git a/usr/src/cmd/ptools/psig/psig.c b/usr/src/cmd/ptools/psig/psig.c index fe62cea5e0..70af35cb5e 100644 --- a/usr/src/cmd/ptools/psig/psig.c +++ b/usr/src/cmd/ptools/psig/psig.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,13 +19,14 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <ctype.h> @@ -90,6 +90,7 @@ main(int argc, char **argv) if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) { rlim.rlim_cur = rlim.rlim_max; (void) setrlimit(RLIMIT_NOFILE, &rlim); + (void) enable_extended_FILE_stdio(-1, -1); } for (; optind != argc; optind++) { diff --git a/usr/src/cmd/ptools/pstack/pstack.c b/usr/src/cmd/ptools/pstack/pstack.c index 39c99484e4..53f07e433c 100644 --- a/usr/src/cmd/ptools/pstack/pstack.c +++ b/usr/src/cmd/ptools/pstack/pstack.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -29,6 +28,7 @@ #include <sys/isa_defs.h> #include <stdio.h> +#include <stdio_ext.h> #include <fcntl.h> #include <ctype.h> #include <string.h> @@ -181,6 +181,7 @@ main(int argc, char **argv) if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) { rlim.rlim_cur = rlim.rlim_max; (void) setrlimit(RLIMIT_NOFILE, &rlim); + (void) enable_extended_FILE_stdio(-1, -1); } (void) proc_initstdio(); diff --git a/usr/src/cmd/ptools/pwait/pwait.c b/usr/src/cmd/ptools/pwait/pwait.c index 0d85200bab..0733c355cf 100644 --- a/usr/src/cmd/ptools/pwait/pwait.c +++ b/usr/src/cmd/ptools/pwait/pwait.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,14 +19,14 @@ * CDDL HEADER END */ /* - * Copyright 1994-2000, 2002 Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <ctype.h> #include <stdlib.h> #include <unistd.h> @@ -93,6 +92,7 @@ main(int argc, char **argv) return (2); } } + (void) enable_extended_FILE_stdio(-1, -1); } pollfd = (struct pollfd *)malloc(argc*sizeof (struct pollfd)); diff --git a/usr/src/cmd/rcap/rcapd/rcapd_main.c b/usr/src/cmd/rcap/rcapd/rcapd_main.c index 98d2859e8f..ce6ac7381c 100644 --- a/usr/src/cmd/rcap/rcapd/rcapd_main.c +++ b/usr/src/cmd/rcap/rcapd/rcapd_main.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -55,6 +54,7 @@ #include <signal.h> #include <stdarg.h> #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <strings.h> #include <time.h> @@ -1137,6 +1137,8 @@ main(int argc, char *argv[]) rl.rlim_cur = rl.rlim_max; (void) setrlimit(RLIMIT_NOFILE, &rl); } + (void) enable_extended_FILE_stdio(-1, -1); + if (getrlimit(RLIMIT_NOFILE, &rl) == 0) debug("fd limit: %lu\n", rl.rlim_cur); else diff --git a/usr/src/cmd/rcm_daemon/common/rcm_impl.h b/usr/src/cmd/rcm_daemon/common/rcm_impl.h index 3b70289ca3..5c6ca23e9f 100644 --- a/usr/src/cmd/rcm_daemon/common/rcm_impl.h +++ b/usr/src/cmd/rcm_daemon/common/rcm_impl.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -18,8 +17,9 @@ * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + */ +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -35,6 +35,7 @@ extern "C" { #include <assert.h> #include <stdarg.h> #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <dirent.h> #include <dlfcn.h> diff --git a/usr/src/cmd/rcm_daemon/common/rcm_main.c b/usr/src/cmd/rcm_daemon/common/rcm_main.c index 6709f1d6a9..6d369a3615 100644 --- a/usr/src/cmd/rcm_daemon/common/rcm_main.c +++ b/usr/src/cmd/rcm_daemon/common/rcm_main.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -310,6 +309,8 @@ main(int argc, char **argv) prog++; } + (void) enable_extended_FILE_stdio(-1, -1); + /* * process arguments */ diff --git a/usr/src/cmd/rpcbind/rpcbind.c b/usr/src/cmd/rpcbind/rpcbind.c index 4a31ac0283..89d2d5714d 100644 --- a/usr/src/cmd/rpcbind/rpcbind.c +++ b/usr/src/cmd/rpcbind/rpcbind.c @@ -44,6 +44,7 @@ #include <dlfcn.h> #include <stdio.h> +#include <stdio_ext.h> #include <sys/types.h> #include <unistd.h> #include <stdlib.h> @@ -153,6 +154,8 @@ main(int argc, char *argv[]) rl.rlim_cur = MAX_FILEDESC_LIMIT; setrlimit(RLIMIT_NOFILE, &rl); } + (void) enable_extended_FILE_stdio(-1, -1); + openlog("rpcbind", LOG_CONS, LOG_DAEMON); /* diff --git a/usr/src/cmd/rpcsvc/nis/rpc.nisd/nis_main.c b/usr/src/cmd/rpcsvc/nis/rpc.nisd/nis_main.c index 4a41a1dfcc..e7c6fb35a5 100644 --- a/usr/src/cmd/rpcsvc/nis/rpc.nisd/nis_main.c +++ b/usr/src/cmd/rpcsvc/nis/rpc.nisd/nis_main.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -35,6 +34,7 @@ */ #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <rpc/rpc.h> #include <syslog.h> @@ -693,7 +693,6 @@ main(int argc, char *argv[]) int pid; int force = 0, mb; struct rlimit rl; - int minfd; int open_console = 0; struct sigaction sigactn; bool_t massage_dict; @@ -967,19 +966,15 @@ main(int argc, char *argv[]) } /* - * The data base functions use stdio. The stdio routines - * can only handle file descriptors up to 255. To make - * more of these low-numbered descriptors available, we - * bump up the file descriptor limit, and tell the RPC - * library (our other main source of file descriptors) to - * try to use descriptors numbered 256 and above. + * The database functions use stdio. Since we know + * the database routines are fileno() safe, we enable + * large file descriptors. */ - getrlimit(RLIMIT_NOFILE, &rl); + (void) enable_extended_FILE_stdio(-1, -1); + rl.rlim_cur = RLIM_INFINITY; rl.rlim_max = RLIM_INFINITY; - setrlimit(RLIMIT_NOFILE, &rl); - minfd = 256; - rpc_control(__RPC_CLNT_MINFD_SET, (char *)&minfd); + (void) setrlimit(RLIMIT_NOFILE, &rl); if (nis_local_directory() == NULL) { if (debug) diff --git a/usr/src/cmd/rpcsvc/rwall.c b/usr/src/cmd/rpcsvc/rwall.c index 2984e41bcb..9efadba216 100644 --- a/usr/src/cmd/rpcsvc/rwall.c +++ b/usr/src/cmd/rpcsvc/rwall.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -18,8 +17,9 @@ * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + */ +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ @@ -42,6 +42,7 @@ */ #include <stdio.h> +#include <stdio_ext.h> #include <sys/types.h> #include <stdlib.h> #include <unistd.h> @@ -89,6 +90,7 @@ main(int argc, char *argv[]) rl.rlim_cur = (rl.rlim_max < MAX_THREADS ? rl.rlim_max : MAX_THREADS); (void) setrlimit(RLIMIT_NOFILE, &rl); + (void) enable_extended_FILE_stdio(-1, -1); } (void) gethostname(hostname, sizeof (hostname)); diff --git a/usr/src/cmd/smserverd/smediad.c b/usr/src/cmd/smserverd/smediad.c index c37c97402d..ae862bfb9c 100644 --- a/usr/src/cmd/smserverd/smediad.c +++ b/usr/src/cmd/smserverd/smediad.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,13 +19,14 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <errno.h> #include <ctype.h> #include <syslog.h> @@ -2695,6 +2695,7 @@ init_server(void *argp) if (setrlimit(RLIMIT_NOFILE, &rlim) < 0) { warning(gettext("setrlimit for fd's failed; %m\n")); } + (void) enable_extended_FILE_stdio(-1, -1); server_door = door_create(main_servproc, (void *)&server_data, 0); if (server_door == -1) { diff --git a/usr/src/cmd/svc/configd/configd.c b/usr/src/cmd/svc/configd/configd.c index 5632735834..8aa37492f1 100644 --- a/usr/src/cmd/svc/configd/configd.c +++ b/usr/src/cmd/svc/configd/configd.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -37,6 +36,7 @@ #include <signal.h> #include <stdarg.h> #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <string.h> #include <syslog.h> @@ -664,6 +664,10 @@ main(int argc, char *argv[]) fd_new.rlim_max = fd_new.rlim_cur = CONFIGD_MAX_FDS; (void) setrlimit(RLIMIT_NOFILE, &fd_new); +#ifndef NATIVE_BUILD /* Allow building on snv_38 and earlier; remove later. */ + (void) enable_extended_FILE_stdio(-1, -1); +#endif + if ((ret = backend_init(dbpath, npdbpath, have_npdb)) != CONFIGD_EXIT_OKAY) exit(ret); diff --git a/usr/src/cmd/svc/startd/startd.c b/usr/src/cmd/svc/startd/startd.c index 97edf352ae..bb0a30f0de 100644 --- a/usr/src/cmd/svc/startd/startd.c +++ b/usr/src/cmd/svc/startd/startd.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -59,6 +58,7 @@ */ #include <stdio.h> +#include <stdio_ext.h> #include <sys/mnttab.h> /* uses FILE * without including stdio.h */ #include <alloca.h> #include <sys/mount.h> @@ -891,6 +891,8 @@ main(int argc, char *argv[]) if (optind != argc) usage(argv[0]); + (void) enable_extended_FILE_stdio(-1, -1); + if (daemonize) if (daemonize_start() < 0) uu_die("Can't daemonize\n"); diff --git a/usr/src/cmd/syslogd/syslogd.c b/usr/src/cmd/syslogd/syslogd.c index 58405d5d06..69e8f693f4 100644 --- a/usr/src/cmd/syslogd/syslogd.c +++ b/usr/src/cmd/syslogd/syslogd.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -65,6 +64,7 @@ #include <errno.h> #include <sys/types.h> #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <ctype.h> #include <signal.h> @@ -407,6 +407,7 @@ main(int argc, char **argv) rlim.rlim_cur = rlim.rlim_max; if (setrlimit(RLIMIT_NOFILE, &rlim) < 0) logerror("Unable to increase file descriptor limit."); + (void) enable_extended_FILE_stdio(-1, -1); /* block all signals from all threads initially */ (void) sigfillset(&allsigs); diff --git a/usr/src/cmd/th_tools/th_define.c b/usr/src/cmd/th_tools/th_define.c index 6f139954a8..fb85c81e9a 100644 --- a/usr/src/cmd/th_tools/th_define.c +++ b/usr/src/cmd/th_tools/th_define.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -29,6 +28,7 @@ #include <sys/time_impl.h> #include <sys/wait.h> #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <stdarg.h> #include <ctype.h> @@ -1627,6 +1627,7 @@ up_resources() if (setrlimit(RLIMIT_NOFILE, &rl) < 0) msg(0, "failed to set RLIMIT_NOFILE: %s\n", strerror(errno)); + (void) enable_extended_FILE_stdio(-1, -1); } if (getrlimit(RLIMIT_DATA, &rl) < 0) msg(0, "failed to obtain RLIMIT_DATA: %s\n", strerror(errno)); diff --git a/usr/src/cmd/truss/main.c b/usr/src/cmd/truss/main.c index 3101ea602e..9b2cf3f603 100644 --- a/usr/src/cmd/truss/main.c +++ b/usr/src/cmd/truss/main.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -30,6 +29,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> @@ -545,6 +545,7 @@ main(int argc, char *argv[]) rlim.rlim_cur = rlim.rlim_max; (void) setrlimit(RLIMIT_NOFILE, &rlim); } + (void) enable_extended_FILE_stdio(-1, -1); setoutput(ofd); /* establish truss output */ istty = isatty(1); diff --git a/usr/src/cmd/ttymon/ttymon.c b/usr/src/cmd/ttymon/ttymon.c index 309b2bec58..e7996b7fed 100644 --- a/usr/src/cmd/ttymon/ttymon.c +++ b/usr/src/cmd/ttymon/ttymon.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,6 +30,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" +#include <stdio_ext.h> #include <stdlib.h> #include <fcntl.h> #include <errno.h> @@ -197,6 +197,8 @@ initialize() if (setrlimit(RLIMIT_NOFILE, &rlimit) == -1) fatal("setrlimit failed: %s", strerror(errno)); + (void) enable_extended_FILE_stdio(-1, -1); + Maxfiles = rlimit.rlim_cur; Maxfds = Maxfiles - FILE_RESERVED; diff --git a/usr/src/cmd/utmpd/utmpd.c b/usr/src/cmd/utmpd/utmpd.c index 7756e92549..252a0eb940 100644 --- a/usr/src/cmd/utmpd/utmpd.c +++ b/usr/src/cmd/utmpd/utmpd.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -56,6 +55,7 @@ #include <sys/types.h> #include <signal.h> #include <stdio.h> +#include <stdio_ext.h> #include <unistd.h> #include <utmpx.h> #include <errno.h> @@ -277,6 +277,8 @@ main(argc, argv) } else fatal("getrlimit returned failure"); + (void) enable_extended_FILE_stdio(-1, -1); + if ((WTMPXfd = open(WTMPX_FILE, O_RDONLY)) < 0) nonfatal("WARNING: unable to open " WTMPX_FILE "for update."); diff --git a/usr/src/cmd/volmgt/vold/vold_main.c b/usr/src/cmd/volmgt/vold/vold_main.c index 86ace216a7..39bac740e0 100644 --- a/usr/src/cmd/volmgt/vold/vold_main.c +++ b/usr/src/cmd/volmgt/vold/vold_main.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -35,6 +34,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <syslog.h> @@ -244,6 +244,12 @@ main(int argc, char **argv) original_nofile = rlim.rlim_cur; rlim.rlim_cur = rlim.rlim_max; + /* + * Make sure fopen() still works if we open more than + * 255 devices or files. + */ + (void) enable_extended_FILE_stdio(-1, -1); + if (setrlimit(RLIMIT_NOFILE, &rlim) < 0) { fatal("setrlimit for fd's failed; %m\n"); } diff --git a/usr/src/cmd/wbem/provider/tools/rds/rds.c b/usr/src/cmd/wbem/provider/tools/rds/rds.c index 9879176b1a..e1a24b085f 100644 --- a/usr/src/cmd/wbem/provider/tools/rds/rds.c +++ b/usr/src/cmd/wbem/provider/tools/rds/rds.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,13 +19,14 @@ * CDDL HEADER END */ /* - * Copyright 2000-2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <sys/time.h> #include <strings.h> @@ -941,6 +941,8 @@ main(int argc, char *argv[]) (void) signal(SIGTERM, sig_rds); (void) sigignore(SIGPIPE); + (void) enable_extended_FILE_stdio(-1, -1); + /* initialize the log mutex */ rv = pthread_mutex_init(&logLock, NULL); if (rv != 0) { diff --git a/usr/src/cmd/xntpd/xntpd/ntp_io.c b/usr/src/cmd/xntpd/xntpd/ntp_io.c index db7fe56ed6..50a06e38b9 100644 --- a/usr/src/cmd/xntpd/xntpd/ntp_io.c +++ b/usr/src/cmd/xntpd/xntpd/ntp_io.c @@ -1,5 +1,5 @@ /* - * Copyright 1996, 1999-2002 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -16,6 +16,7 @@ #ifdef SYS_SOLARIS # define FD_SETSIZE 65536 +#include <stdio_ext.h> #endif #include <stdio.h> @@ -235,6 +236,9 @@ max_fdlimit() msyslog(LOG_ERR, "setrlimit(RLIMIT_NOFILE): %m"); return; } +#ifdef SYS_SOLARIS + enable_extended_FILE_stdio(-1, -1); +#endif } #endif diff --git a/usr/src/cmd/ypcmd/yp_b_svc.c b/usr/src/cmd/ypcmd/yp_b_svc.c index 4f5820f0e0..4bf45d9def 100644 --- a/usr/src/cmd/ypcmd/yp_b_svc.c +++ b/usr/src/cmd/ypcmd/yp_b_svc.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -36,6 +35,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <signal.h> #include <rpc/rpc.h> @@ -158,6 +158,8 @@ main(argc, argv) rl.rlim_cur = rl.rlim_max; setrlimit(RLIMIT_NOFILE, &rl); + (void) enable_extended_FILE_stdio(-1, -1); + openlog("ypbind", LOG_PID, LOG_DAEMON); /* diff --git a/usr/src/cmd/zdb/zdb.c b/usr/src/cmd/zdb/zdb.c index 2e8c7595aa..f283148ef8 100644 --- a/usr/src/cmd/zdb/zdb.c +++ b/usr/src/cmd/zdb/zdb.c @@ -26,6 +26,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <ctype.h> #include <sys/zfs_context.h> @@ -2051,6 +2052,7 @@ main(int argc, char **argv) vdev_knob_t *vk; (void) setrlimit(RLIMIT_NOFILE, &rl); + (void) enable_extended_FILE_stdio(-1, -1); dprintf_setup(&argc, argv); diff --git a/usr/src/cmd/ztest/ztest.c b/usr/src/cmd/ztest/ztest.c index d47601bc0c..c74f227bed 100644 --- a/usr/src/cmd/ztest/ztest.c +++ b/usr/src/cmd/ztest/ztest.c @@ -96,6 +96,7 @@ #include <sys/dsl_prop.h> #include <sys/refcount.h> #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <signal.h> @@ -3307,6 +3308,7 @@ main(int argc, char **argv) if (pid == 0) { /* child */ struct rlimit rl = { 1024, 1024 }; (void) setrlimit(RLIMIT_NOFILE, &rl); + (void) enable_extended_FILE_stdio(-1, -1); ztest_run(zopt_pool); exit(0); } |