View | Details | Raw Unified | Return to bug 275370
Collapse All | Expand All

(-)b/cddl/lib/libzfs/Makefile (+1 lines)
Lines 99-104 CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include Link Here
99
CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
99
CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
100
CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
100
CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
101
CFLAGS+= -DHAVE_ISSETUGID
101
CFLAGS+= -DHAVE_ISSETUGID
102
CFLAGS+= -DHAVE_EXECVPE
102
CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
103
CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
103
CFLAGS+= -DSYSCONFDIR=\"/etc\"
104
CFLAGS+= -DSYSCONFDIR=\"/etc\"
104
CFLAGS+= -DPKGDATADIR=\"/usr/share/zfs\"
105
CFLAGS+= -DPKGDATADIR=\"/usr/share/zfs\"
(-)b/cddl/usr.sbin/zfsd/Makefile.common (-1 / +1 lines)
Lines 22-29 CFLAGS+= -I${SRCTOP}/sys Link Here
22
CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
22
CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
23
CFLAGS+= -I${SRCTOP}/cddl/usr.sbin
23
CFLAGS+= -I${SRCTOP}/cddl/usr.sbin
24
24
25
# use issetugid(2)
26
CFLAGS+= -DHAVE_ISSETUGID
25
CFLAGS+= -DHAVE_ISSETUGID
26
CFLAGS+= -DHAVE_EXECVPE
27
27
28
LIBADD+=	devdctl zfs util geom bsdxml sbuf nvpair avl uutil zutil
28
LIBADD+=	devdctl zfs util geom bsdxml sbuf nvpair avl uutil zutil
29
29
(-)b/include/unistd.h (+1 lines)
Lines 501-506 int eaccess(const char *, int); Link Here
501
void	 endusershell(void);
501
void	 endusershell(void);
502
int	 exect(const char *, char * const *, char * const *);
502
int	 exect(const char *, char * const *, char * const *);
503
int	 execvP(const char *, const char *, char * const *);
503
int	 execvP(const char *, const char *, char * const *);
504
int	 execvpe(const char *, char * const *, char * const *);
504
int	 feature_present(const char *);
505
int	 feature_present(const char *);
505
char	*fflagstostr(u_long);
506
char	*fflagstostr(u_long);
506
int	 getdomainname(char *, int);
507
int	 getdomainname(char *, int);
(-)b/lib/libc/gen/Symbol.map (+4 lines)
Lines 457-462 FBSD_1.7 { Link Here
457
	 __cpuset_free;
457
	 __cpuset_free;
458
};
458
};
459
459
460
FBSD_1.8 {
461
	execvpe;
462
};
463
460
FBSDprivate_1.0 {
464
FBSDprivate_1.0 {
461
	/* needed by thread libraries */
465
	/* needed by thread libraries */
462
	__thr_jtable;
466
	__thr_jtable;
(-)b/lib/libc/gen/exec.3 (-4 / +20 lines)
Lines 25-31 Link Here
25
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26
.\" SUCH DAMAGE.
26
.\" SUCH DAMAGE.
27
.\"
27
.\"
28
.Dd March 22, 2020
28
.Dd December 1, 2023
29
.Dt EXEC 3
29
.Dt EXEC 3
30
.Os
30
.Os
31
.Sh NAME
31
.Sh NAME
Lines 35-40 Link Here
35
.Nm exect ,
35
.Nm exect ,
36
.Nm execv ,
36
.Nm execv ,
37
.Nm execvp ,
37
.Nm execvp ,
38
.Nm execvpe ,
38
.Nm execvP
39
.Nm execvP
39
.Nd execute a file
40
.Nd execute a file
40
.Sh LIBRARY
41
.Sh LIBRARY
Lines 56-61 Link Here
56
.Ft int
57
.Ft int
57
.Fn execvp "const char *file" "char *const argv[]"
58
.Fn execvp "const char *file" "char *const argv[]"
58
.Ft int
59
.Ft int
60
.Fn execvpe "const char *file" "char *const argv[]" "char *const envp[]"
61
.Ft int
59
.Fn execvP "const char *file" "const char *search_path" "char *const argv[]"
62
.Fn execvP "const char *file" "const char *search_path" "char *const argv[]"
60
.Sh DESCRIPTION
63
.Sh DESCRIPTION
61
The
64
The
Lines 97-102 The Link Here
97
.Fn exect ,
100
.Fn exect ,
98
.Fn execv ,
101
.Fn execv ,
99
.Fn execvp ,
102
.Fn execvp ,
103
.Fn execvpe ,
100
and
104
and
101
.Fn execvP
105
.Fn execvP
102
functions provide an array of pointers to null-terminated strings that
106
functions provide an array of pointers to null-terminated strings that
Lines 110-118 be terminated by a Link Here
110
pointer.
114
pointer.
111
.Pp
115
.Pp
112
The
116
The
113
.Fn execle
117
.Fn execle ,
118
.Fn exect ,
114
and
119
and
115
.Fn exect
120
.Fn execvpe
116
functions also specify the environment of the executed process by following
121
functions also specify the environment of the executed process by following
117
the
122
the
118
.Dv NULL
123
.Dv NULL
Lines 134-139 Some of these functions have special semantics. Link Here
134
The functions
139
The functions
135
.Fn execlp ,
140
.Fn execlp ,
136
.Fn execvp ,
141
.Fn execvp ,
142
.Fn execvpe ,
137
and
143
and
138
.Fn execvP
144
.Fn execvP
139
will duplicate the actions of the shell in searching for an executable file
145
will duplicate the actions of the shell in searching for an executable file
Lines 144-149 For Link Here
144
.Fn execlp
150
.Fn execlp
145
and
151
and
146
.Fn execvp ,
152
.Fn execvp ,
153
.Fn execvpe ,
147
search path is the path specified in the environment by
154
search path is the path specified in the environment by
148
.Dq Ev PATH
155
.Dq Ev PATH
149
variable.
156
variable.
Lines 269-275 The Link Here
269
.Fn execl ,
276
.Fn execl ,
270
.Fn execle ,
277
.Fn execle ,
271
.Fn execlp ,
278
.Fn execlp ,
272
.Fn execvp
279
.Fn execvp ,
280
.Fn execvpe ,
273
and
281
and
274
.Fn execvP
282
.Fn execvP
275
functions
283
functions
Lines 307-312 and Link Here
307
functions
315
functions
308
conform to
316
conform to
309
.St -p1003.1-88 .
317
.St -p1003.1-88 .
318
The
319
.Fn execvpe
320
function is a GNU extension.
310
.Sh HISTORY
321
.Sh HISTORY
311
The
322
The
312
.Fn exec
323
.Fn exec
Lines 330-335 The Link Here
330
.Fn execvP
341
.Fn execvP
331
function first appeared in
342
function first appeared in
332
.Fx 5.2 .
343
.Fx 5.2 .
344
The
345
.Fn execvpe
346
function first appeared in
347
.Fx 15.0 .
333
.Sh BUGS
348
.Sh BUGS
334
The type of the
349
The type of the
335
.Fa argv
350
.Fa argv
Lines 340-345 parameters to Link Here
340
.Fn exect ,
355
.Fn exect ,
341
.Fn execv ,
356
.Fn execv ,
342
.Fn execvp ,
357
.Fn execvp ,
358
.Fn execvpe ,
343
and
359
and
344
.Fn execvP
360
.Fn execvP
345
is a historical accident and no sane implementation should modify the provided
361
is a historical accident and no sane implementation should modify the provided
(-)b/lib/libc/gen/exec.c (-2 / +2 lines)
Lines 136-142 execv(const char *name, char * const *argv) Link Here
136
int
136
int
137
execvp(const char *name, char * const *argv)
137
execvp(const char *name, char * const *argv)
138
{
138
{
139
	return (_execvpe(name, argv, environ));
139
	return (execvpe(name, argv, environ));
140
}
140
}
141
141
142
static int
142
static int
Lines 288-294 execvP(const char *name, const char *path, char * const argv[]) Link Here
288
}
288
}
289
289
290
int
290
int
291
_execvpe(const char *name, char * const argv[], char * const envp[])
291
execvpe(const char *name, char * const argv[], char * const envp[])
292
{
292
{
293
	const char *path;
293
	const char *path;
294
294
(-)b/lib/libc/gen/posix_spawn.c (-2 / +2 lines)
Lines 226-232 struct posix_spawn_args { Link Here
226
#if defined(__i386__) || defined(__amd64__)
226
#if defined(__i386__) || defined(__amd64__)
227
/*
227
/*
228
 * Below we'll assume that _RFORK_THREAD_STACK_SIZE is appropriately aligned for
228
 * Below we'll assume that _RFORK_THREAD_STACK_SIZE is appropriately aligned for
229
 * the posix_spawn() case where we do not end up calling _execvpe and won't ever
229
 * the posix_spawn() case where we do not end up calling execvpe and won't ever
230
 * try to allocate space on the stack for argv[].
230
 * try to allocate space on the stack for argv[].
231
 */
231
 */
232
#define	_RFORK_THREAD_STACK_SIZE	4096
232
#define	_RFORK_THREAD_STACK_SIZE	4096
Lines 253-259 _posix_spawn_thr(void *data) Link Here
253
	}
253
	}
254
	envp = psa->envp != NULL ? psa->envp : environ;
254
	envp = psa->envp != NULL ? psa->envp : environ;
255
	if (psa->use_env_path)
255
	if (psa->use_env_path)
256
		_execvpe(psa->path, psa->argv, envp);
256
		execvpe(psa->path, psa->argv, envp);
257
	else
257
	else
258
		_execve(psa->path, psa->argv, envp);
258
		_execve(psa->path, psa->argv, envp);
259
	psa->error = errno;
259
	psa->error = errno;
(-)b/lib/libc/include/libc_private.h (-3 lines)
Lines 422-430 int __sys_futimens(int fd, const struct timespec *times) __hidden; Link Here
422
int		__sys_utimensat(int fd, const char *path,
422
int		__sys_utimensat(int fd, const char *path,
423
		    const struct timespec *times, int flag) __hidden;
423
		    const struct timespec *times, int flag) __hidden;
424
424
425
/* execve() with PATH processing to implement posix_spawnp() */
426
int _execvpe(const char *, char * const *, char * const *);
427
428
int _elf_aux_info(int aux, void *buf, int buflen);
425
int _elf_aux_info(int aux, void *buf, int buflen);
429
struct dl_phdr_info;
426
struct dl_phdr_info;
430
int __elf_phdr_match_addr(struct dl_phdr_info *, void *);
427
int __elf_phdr_match_addr(struct dl_phdr_info *, void *);
(-)b/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/param.h (+2 lines)
Lines 57-62 Link Here
57
extern size_t spl_pagesize(void);
57
extern size_t spl_pagesize(void);
58
#define	PAGESIZE	(spl_pagesize())
58
#define	PAGESIZE	(spl_pagesize())
59
59
60
#ifndef HAVE_EXECVPE
60
extern int execvpe(const char *name, char * const argv[], char * const envp[]);
61
extern int execvpe(const char *name, char * const argv[], char * const envp[]);
62
#endif
61
63
62
#endif
64
#endif
(-)b/sys/contrib/openzfs/lib/libzfs/os/freebsd/libzfs_compat.c (+2 lines)
Lines 39-44 Link Here
39
#endif
39
#endif
40
40
41
41
42
#ifndef HAVE_EXECVPE
42
static int
43
static int
43
execvPe(const char *name, const char *path, char * const *argv,
44
execvPe(const char *name, const char *path, char * const *argv,
44
    char * const *envp)
45
    char * const *envp)
Lines 192-197 execvpe(const char *name, char * const argv[], char * const envp[]) Link Here
192
193
193
	return (execvPe(name, path, argv, envp));
194
	return (execvPe(name, path, argv, envp));
194
}
195
}
196
#endif /* !HAVE_EXECVPE */
195
197
196
static __thread char errbuf[ERRBUFLEN];
198
static __thread char errbuf[ERRBUFLEN];
197
199
(-)b/sys/sys/param.h (-1 / +1 lines)
Lines 73-79 Link Here
73
 * cannot include sys/param.h and should only be updated here.
73
 * cannot include sys/param.h and should only be updated here.
74
 */
74
 */
75
#undef __FreeBSD_version
75
#undef __FreeBSD_version
76
#define __FreeBSD_version 1500005
76
#define __FreeBSD_version 1500006
77
77
78
/*
78
/*
79
 * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
79
 * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,

Return to bug 275370