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
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
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 (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2012, Joyent, Inc. All rights reserved.
24 */
25
26 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
28
29 /*
30 * University Copyright- Copyright (c) 1982, 1986, 1988
31 * The Regents of the University of California
32 * All Rights Reserved
33 *
34 * University Acknowledgment- Portions of this document are derived from
35 * software developed by the University of California, Berkeley, and its
36 * contributors.
37 */
38
39 /* LINTLIBRARY */
40 /* PROTOLIB1 */
41
42 /* NFS server */
43
159 int ret, bufsz;
160
161 int pipe_fd = -1;
162
163 MyName = *av;
164
165 /*
166 * Initializations that require more privileges than we need to run.
167 */
168 (void) _create_daemon_lock(NFSD, DAEMON_UID, DAEMON_GID);
169 svcsetprio();
170
171 can_do_mlp = priv_ineffect(PRIV_NET_BINDMLP);
172 if (__init_daemon_priv(PU_RESETGROUPS|PU_CLEARLIMITSET,
173 DAEMON_UID, DAEMON_GID, PRIV_SYS_NFS,
174 can_do_mlp ? PRIV_NET_BINDMLP : NULL, NULL) == -1) {
175 (void) fprintf(stderr, "%s should be run with"
176 " sufficient privileges\n", av[0]);
177 exit(1);
178 }
179
180 /* Nfsd cannot run in a non-global zone. */
181 if (getzoneid() != GLOBAL_ZONEID) {
182 (void) fprintf(stderr, "%s: can only run in the global zone\n",
183 av[0]);
184 exit(1);
185 }
186
187 (void) enable_extended_FILE_stdio(-1, -1);
188
189 /*
190 * Read in the values from SMF first before we check
191 * command line options so the options override SMF values.
192 */
193 bufsz = PATH_MAX;
194 ret = nfs_smf_get_prop("max_connections", value, DEFAULT_INSTANCE,
195 SCF_TYPE_INTEGER, NFSD, &bufsz);
196 if (ret == SA_OK) {
197 errno = 0;
198 max_conns_allowed = strtol(value, (char **)NULL, 10);
199 if (errno != 0)
200 max_conns_allowed = -1;
201 }
202
203 bufsz = PATH_MAX;
204 ret = nfs_smf_get_prop("listen_backlog", value, DEFAULT_INSTANCE,
205 SCF_TYPE_INTEGER, NFSD, &bufsz);
|
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
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
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 (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
23 */
24
25 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
26 /* All Rights Reserved */
27
28 /*
29 * University Copyright- Copyright (c) 1982, 1986, 1988
30 * The Regents of the University of California
31 * All Rights Reserved
32 *
33 * University Acknowledgment- Portions of this document are derived from
34 * software developed by the University of California, Berkeley, and its
35 * contributors.
36 */
37
38 /* LINTLIBRARY */
39 /* PROTOLIB1 */
40
41 /* NFS server */
42
158 int ret, bufsz;
159
160 int pipe_fd = -1;
161
162 MyName = *av;
163
164 /*
165 * Initializations that require more privileges than we need to run.
166 */
167 (void) _create_daemon_lock(NFSD, DAEMON_UID, DAEMON_GID);
168 svcsetprio();
169
170 can_do_mlp = priv_ineffect(PRIV_NET_BINDMLP);
171 if (__init_daemon_priv(PU_RESETGROUPS|PU_CLEARLIMITSET,
172 DAEMON_UID, DAEMON_GID, PRIV_SYS_NFS,
173 can_do_mlp ? PRIV_NET_BINDMLP : NULL, NULL) == -1) {
174 (void) fprintf(stderr, "%s should be run with"
175 " sufficient privileges\n", av[0]);
176 exit(1);
177 }
178
179 (void) enable_extended_FILE_stdio(-1, -1);
180
181 /*
182 * Read in the values from SMF first before we check
183 * command line options so the options override SMF values.
184 */
185 bufsz = PATH_MAX;
186 ret = nfs_smf_get_prop("max_connections", value, DEFAULT_INSTANCE,
187 SCF_TYPE_INTEGER, NFSD, &bufsz);
188 if (ret == SA_OK) {
189 errno = 0;
190 max_conns_allowed = strtol(value, (char **)NULL, 10);
191 if (errno != 0)
192 max_conns_allowed = -1;
193 }
194
195 bufsz = PATH_MAX;
196 ret = nfs_smf_get_prop("listen_backlog", value, DEFAULT_INSTANCE,
197 SCF_TYPE_INTEGER, NFSD, &bufsz);
|