Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151967340
D54862.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D54862.diff
View Options
diff --git a/include/spawn.h b/include/spawn.h
--- a/include/spawn.h
+++ b/include/spawn.h
@@ -123,6 +123,13 @@
const sigset_t * __restrict);
int posix_spawnattr_setsigmask(posix_spawnattr_t * __restrict,
const sigset_t * __restrict);
+
+#if __BSD_VISIBLE
+int posix_spawnattr_setexecfd_np(posix_spawnattr_t * __restrict, int);
+int posix_spawnattr_getexecfd_np(const posix_spawnattr_t * __restrict,
+ int * __restrict);
+#endif
+
__END_DECLS
#endif /* !_SPAWN_H_ */
diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map
--- a/lib/libc/gen/Symbol.map
+++ b/lib/libc/gen/Symbol.map
@@ -474,6 +474,11 @@
str2sig;
};
+FBSD_1.9 {
+ posix_spawnattr_getexecfd_np;
+ posix_spawnattr_setexecfd_np;
+};
+
FBSDprivate_1.0 {
/* needed by thread libraries */
__thr_jtable;
diff --git a/lib/libc/gen/posix_spawn.c b/lib/libc/gen/posix_spawn.c
--- a/lib/libc/gen/posix_spawn.c
+++ b/lib/libc/gen/posix_spawn.c
@@ -50,6 +50,7 @@
int sa_schedpolicy;
sigset_t sa_sigdefault;
sigset_t sa_sigmask;
+ int sa_execfd;
};
struct __posix_spawn_file_actions {
@@ -260,7 +261,9 @@
_exit(127);
}
envp = psa->envp != NULL ? psa->envp : environ;
- if (psa->use_env_path)
+ if (psa->sa != NULL && (*(psa->sa))->sa_execfd != -1)
+ fexecve((*(psa->sa))->sa_execfd, psa->argv, envp);
+ else if (psa->use_env_path)
__libc_execvpe(psa->path, psa->argv, envp);
else
_execve(psa->path, psa->argv, envp);
@@ -578,6 +581,7 @@
sa = calloc(1, sizeof(struct __posix_spawnattr));
if (sa == NULL)
return (errno);
+ sa->sa_execfd = -1;
/* Set defaults as specified by POSIX, cleared above */
*ret = sa;
@@ -639,6 +643,14 @@
return (0);
}
+int
+posix_spawnattr_getexecfd_np(const posix_spawnattr_t * __restrict sa,
+ int * __restrict fdp)
+{
+ *fdp = (*sa)->sa_execfd;
+ return (0);
+}
+
int
posix_spawnattr_setflags(posix_spawnattr_t *sa, short flags)
{
@@ -688,3 +700,11 @@
(*sa)->sa_sigmask = *sigmask;
return (0);
}
+
+int
+posix_spawnattr_setexecfd_np(posix_spawnattr_t * __restrict sa,
+ int execfd)
+{
+ (*sa)->sa_execfd = execfd;
+ return (0);
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 12, 8:11 PM (6 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31368535
Default Alt Text
D54862.diff (2 KB)
Attached To
Mode
D54862: Add posix_spawnattr_get/setexecfd_np(3)
Attached
Detach File
Event Timeline
Log In to Comment