2020-08-15 22:13:19 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-08-15 22:13:19 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/InlineLinkedList.h>
|
|
|
|
#include <AK/RefCounted.h>
|
|
|
|
#include <AK/Weakable.h>
|
|
|
|
#include <Kernel/Lock.h>
|
|
|
|
#include <Kernel/SpinLock.h>
|
|
|
|
#include <Kernel/UnixTypes.h>
|
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
|
|
|
|
class ProcessGroup
|
|
|
|
: public RefCounted<ProcessGroup>
|
|
|
|
, public Weakable<ProcessGroup>
|
|
|
|
, public InlineLinkedListNode<ProcessGroup> {
|
|
|
|
|
|
|
|
AK_MAKE_NONMOVABLE(ProcessGroup);
|
|
|
|
AK_MAKE_NONCOPYABLE(ProcessGroup);
|
|
|
|
|
|
|
|
friend InlineLinkedListNode<ProcessGroup>;
|
|
|
|
|
|
|
|
public:
|
|
|
|
~ProcessGroup();
|
|
|
|
|
|
|
|
static NonnullRefPtr<ProcessGroup> create(ProcessGroupID);
|
|
|
|
static NonnullRefPtr<ProcessGroup> find_or_create(ProcessGroupID);
|
2020-11-30 02:05:27 +03:00
|
|
|
static RefPtr<ProcessGroup> from_pgid(ProcessGroupID);
|
2020-08-15 22:13:19 +03:00
|
|
|
|
|
|
|
const ProcessGroupID& pgid() const { return m_pgid; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
ProcessGroup(ProcessGroupID pgid)
|
|
|
|
: m_pgid(pgid)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ProcessGroup* m_prev { nullptr };
|
|
|
|
ProcessGroup* m_next { nullptr };
|
|
|
|
|
|
|
|
ProcessGroupID m_pgid;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern InlineLinkedList<ProcessGroup>* g_process_groups;
|
|
|
|
extern RecursiveSpinLock g_process_groups_lock;
|
|
|
|
|
|
|
|
}
|