__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/capsicum.h>
+#include <sys/filedesc.h>
#include <sys/imgact.h>
#include <sys/lock.h>
#include <sys/mutex.h>
cloudabi_sys_proc_fork(struct thread *td,
struct cloudabi_sys_proc_fork_args *uap)
{
+ struct filecaps fcaps = {};
struct proc *p2;
int error, fd;
- error = fork1(td, RFFDG | RFPROC | RFPROCDESC, 0, &p2, &fd, 0);
+ cap_rights_init(&fcaps.fc_rights, CAP_FSTAT, CAP_PDWAIT);
+ error = fork1(td, RFFDG | RFPROC | RFPROCDESC, 0, &p2, &fd, 0, &fcaps);
if (error != 0)
return (error);
/* Return the file descriptor to the parent process. */
printf(ARGS(fork, ""));
#endif
- if ((error = fork1(td, RFFDG | RFPROC | RFSTOPPED, 0, &p2, NULL, 0))
- != 0)
+ if ((error = fork1(td, RFFDG | RFPROC | RFSTOPPED, 0, &p2, NULL, 0,
+ NULL)) != 0)
return (error);
td2 = FIRST_THREAD_IN_PROC(p2);
/* Exclude RFPPWAIT */
if ((error = fork1(td, RFFDG | RFPROC | RFMEM | RFSTOPPED, 0, &p2,
- NULL, 0)) != 0)
+ NULL, 0, NULL)) != 0)
return (error);
if (args->parent_tidptr == NULL)
return (EINVAL);
- error = fork1(td, ff, 0, &p2, NULL, 0);
+ error = fork1(td, ff, 0, &p2, NULL, 0, NULL);
if (error)
return (error);
int error;
error = fork1(&thread0, RFFDG | RFPROC | RFSTOPPED, 0, &initproc,
- NULL, 0);
+ NULL, 0, NULL);
if (error)
panic("cannot fork init: %d\n", error);
KASSERT(initproc->p_pid == 1, ("create_init: initproc->p_pid != 1"));
int error;
struct proc *p2;
- error = fork1(td, RFFDG | RFPROC, 0, &p2, NULL, 0);
+ error = fork1(td, RFFDG | RFPROC, 0, &p2, NULL, 0, NULL);
if (error == 0) {
td->td_retval[0] = p2->p_pid;
td->td_retval[1] = 0;
* itself from the parent using the return value.
*/
error = fork1(td, RFFDG | RFPROC | RFPROCDESC, 0, &p2,
- &fd, uap->flags);
+ &fd, uap->flags, NULL);
if (error == 0) {
td->td_retval[0] = p2->p_pid;
td->td_retval[1] = 0;
struct proc *p2;
flags = RFFDG | RFPROC | RFPPWAIT | RFMEM;
- error = fork1(td, flags, 0, &p2, NULL, 0);
+ error = fork1(td, flags, 0, &p2, NULL, 0, NULL);
if (error == 0) {
td->td_retval[0] = p2->p_pid;
td->td_retval[1] = 0;
return (EINVAL);
AUDIT_ARG_FFLAGS(uap->flags);
- error = fork1(td, uap->flags, 0, &p2, NULL, 0);
+ error = fork1(td, uap->flags, 0, &p2, NULL, 0, NULL);
if (error == 0) {
td->td_retval[0] = p2 ? p2->p_pid : 0;
td->td_retval[1] = 0;
int
fork1(struct thread *td, int flags, int pages, struct proc **procp,
- int *procdescp, int pdflags)
+ int *procdescp, int pdflags, struct filecaps *fcaps)
{
struct proc *p1;
struct proc *newproc;
* later.
*/
if (flags & RFPROCDESC) {
- error = falloc(td, &fp_procdesc, procdescp, 0);
+ error = falloc_caps(td, &fp_procdesc, procdescp, 0,
+ fcaps);
if (error != 0)
return (error);
}
panic("kproc_create called too soon");
error = fork1(&thread0, RFMEM | RFFDG | RFPROC | RFSTOPPED | flags,
- pages, &p2, NULL, 0);
+ pages, &p2, NULL, 0, NULL);
if (error)
return error;
* for write access.
*/
struct cpuset;
+struct filecaps;
struct kaioinfo;
struct kaudit_record;
struct kdtrace_proc;
int enterthispgrp(struct proc *p, struct pgrp *pgrp);
void faultin(struct proc *p);
void fixjobc(struct proc *p, struct pgrp *pgrp, int entering);
-int fork1(struct thread *, int, int, struct proc **, int *, int);
+int fork1(struct thread *, int, int, struct proc **, int *, int,
+ struct filecaps *);
void fork_exit(void (*)(void *, struct trapframe *), void *,
struct trapframe *);
void fork_return(struct thread *, struct trapframe *);