mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
jobctl: jobctl_getsession
This commit is contained in:
@@ -13,6 +13,7 @@ pid_t jobctl_getpgid(proc_t *proc);
|
|||||||
pid_t jobctl_getsid(proc_t *proc);
|
pid_t jobctl_getsid(proc_t *proc);
|
||||||
int jobctl_setctty(proc_t *proc, void *ctty, bool steal);
|
int jobctl_setctty(proc_t *proc, void *ctty, bool steal);
|
||||||
void *jobctl_getctty(proc_t *proc);
|
void *jobctl_getctty(proc_t *proc);
|
||||||
|
proc_t *jobctl_getsession(proc_t *proc);
|
||||||
int jobctl_signal(proc_t *proc, int signal, proc_t *sender);
|
int jobctl_signal(proc_t *proc, int signal, proc_t *sender);
|
||||||
proc_t *jobctl_getforeground(proc_t *proc);
|
proc_t *jobctl_getforeground(proc_t *proc);
|
||||||
int jobctl_setforeground(proc_t *session, proc_t *pgrp);
|
int jobctl_setforeground(proc_t *session, proc_t *pgrp);
|
||||||
|
|||||||
@@ -115,6 +115,19 @@ void *jobctl_getctty(proc_t *proc) {
|
|||||||
return tty;
|
return tty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proc_t *jobctl_getsession(proc_t *proc) {
|
||||||
|
bool intstatus = interrupt_set(false);
|
||||||
|
spinlock_acquire(&proc->jobctllock);
|
||||||
|
|
||||||
|
proc_t *session = proc->session.leader ? proc->session.leader : proc;
|
||||||
|
PROC_HOLD(session);
|
||||||
|
|
||||||
|
spinlock_release(&proc->jobctllock);
|
||||||
|
interrupt_set(intstatus);
|
||||||
|
|
||||||
|
return session;
|
||||||
|
}
|
||||||
|
|
||||||
pid_t jobctl_getpgid(proc_t *proc) {
|
pid_t jobctl_getpgid(proc_t *proc) {
|
||||||
bool intstatus = interrupt_set(false);
|
bool intstatus = interrupt_set(false);
|
||||||
spinlock_acquire(&proc->jobctllock);
|
spinlock_acquire(&proc->jobctllock);
|
||||||
|
|||||||
Reference in New Issue
Block a user