Lines Matching refs:group

163 	= MUTEX_INITIALIZER("orphaned process group check");
438 group = NULL;
689 /*! Locks the team, its parent team (if any), and the team's process group.
699 // We hold the group's and the team's lock, but not the parent team's lock.
711 /*! Unlocks the team, its parent team (if any), and the team's process group.
716 group->Unlock();
728 // The locking order is process group -> child. Since the process group can
734 // Try to lock the group. This will succeed in most cases, simplifying
736 ProcessGroup* group = this->group;
737 if (group == NULL)
740 if (group->TryLock())
743 // get a temporary reference to the group, unlock this team, lock the
744 // group, and re-lock this team
745 BReference<ProcessGroup> groupReference(group);
748 group->Lock();
751 // If the group hasn't changed in the meantime, we're done.
752 if (this->group == group)
755 // The group has changed -- unlock and retry.
756 group->Unlock();
764 group->Unlock();
1010 // If the group is in the orphaned check list, remove it.
1018 // remove group from the hash table and from the session
1035 ProcessGroup* group = sGroupHash.Lookup(id);
1036 if (group != NULL)
1037 group->AcquireReference();
1038 return group;
1042 /*! Adds the group the given session and makes it publicly accessible.
1043 The caller must not hold the process group hash lock.
1053 /*! Adds the group to the given session and makes it publicly accessible.
1054 The caller must hold the process group hash lock.
1068 /*! Checks whether the process group is orphaned.
1069 The caller must hold the group's lock.
1070 \return \c true, if the group is orphaned, \c false otherwise.
1075 // Orphaned Process Group: "A process group in which the parent of every
1076 // member is either itself a member of the group or is not a member of the
1077 // group's session." (Open Group Base Specs Issue 7)
1324 The caller must hold the team's lock or its process group's lock.
1333 /*! Returns whether the given team is a process group leader.
1334 The caller must hold the team's lock or its process group's lock.
1343 /*! Inserts the given team into the given process group.
1344 The caller must hold the process group's lock, the team's lock, and the
1348 insert_team_into_group(ProcessGroup* group, Team* team)
1350 team->group = group;
1351 team->group_id = group->id;
1352 team->session_id = group->Session()->id;
1354 team->group_next = group->teams;
1355 group->teams = team;
1356 group->AcquireReference();
1360 /*! Removes the given team from its process group.
1362 The caller must hold the process group's lock, the team's lock, and the
1365 \param team The team that'll be removed from its process group.
1370 ProcessGroup* group = team->group;
1374 // the team must be in a process group to let this function have any effect
1375 if (group == NULL)
1378 for (current = group->teams; current != NULL;
1382 group->teams = current->group_next;
1391 team->group = NULL;
1395 group->ReleaseReference();
1790 // inherit the parent's user/group
1800 // check the executable's set-user/group-id permission
1853 insert_team_into_group(parent->group, team);
1919 // Remove the team structure from the process group, the parent team, and
2066 // Update user/group according to the executable's set-user/group-id
2144 // Inherit the parent's user/group.
2253 insert_team_into_group(parentTeam->group, team);
2288 // Remove the team structure from the process group, the parent team, and
2323 process group with the specified ID \a groupID.
2344 - \code < -1 \endcode: Matching any entry with a process group ID of \c -id.
2381 - \code < -1 \endcode: Matching any entry with a process group ID of \c -id.
2426 ProcessGroup* group = sGroupHash.Lookup(group_id);
2427 if (group == NULL) {
2428 panic("job_control_entry::~job_control_entry(): unknown group "
2435 group->ReleaseReference();
2452 team->group->AcquireReference();
2521 // group of the calling team.
2528 // complying to the process group specification at all.
2531 // to the process group specification at all.
2624 // unregistered from the team or group. Fill in the returned info.
2728 /*! Returns whether the process group contains stopped processes.
2729 The caller must hold the process group's lock.
2732 process_group_has_stopped_processes(ProcessGroup* group)
2734 Team* team = group->teams;
2756 The caller must not hold any team or process group locks.
2766 ProcessGroup* group = sOrphanedCheckProcessGroups.RemoveHead();
2767 if (group == NULL)
2770 group->UnsetOrphanedCheck();
2771 BReference<ProcessGroup> groupReference(group);
2775 AutoLocker<ProcessGroup> groupLocker(group);
2777 // If the group is orphaned and contains stopped processes, we're
2779 if (group->IsOrphaned() && process_group_has_stopped_processes(group)) {
2783 send_signal_to_process_group_locked(group, signal, 0);
2786 send_signal_to_process_group_locked(group, signal, 0);
2875 panic("Failed to init process group hash table!");
2884 ProcessGroup* group = new(std::nothrow) ProcessGroup(1);
2885 if (group == NULL)
2886 panic("Could not create initial process group.\n");
2887 BReference<ProcessGroup> groupReference(group, true);
2889 group->Publish(session);
2908 insert_team_into_group(group, sKernelTeam);
3019 ProcessSession* session = team->group->Session();
3036 ProcessSession* session = team->group->Session();
3053 ProcessSession* session = team->group->Session();
3060 // check given process group -- must belong to our session
3063 ProcessGroup* group = sGroupHash.Lookup(processGroupID);
3064 if (group == NULL || group->Session() != session)
3068 // If we are a background group, we can do that unharmed only when we
3069 // ignore or block SIGTTOU. Otherwise the group gets a SIGTTOU.
3107 group, and from its parent.
3111 - \a team's process group's lock,
3134 // possible from its process group and its parent and children, but that
3145 && team->group->Session()->controlling_tty != NULL) {
3148 ProcessSession* session = team->group->Session();
3156 // remove us from our process group
3177 // child's process group not being an orphan and, if so, schedule a
3180 ProcessGroup* childGroup = child->group;
3952 // get process group of the calling process
3965 // get the team's process group ID
4098 // * Create a new process group with the target process' ID and the target
4099 // process as group leader.
4100 // * Set the target process' process group to an already existing one in the
4110 // if the group ID is not specified, use the target process' ID
4115 // process group, because there isn't one with that ID yet, but later when
4117 // a group with that ID in the meantime. In that case we just restart the
4120 // Look up the process group by ID. If it doesn't exist yet and we are
4122 ProcessGroup* group = ProcessGroup::Get(groupID);
4124 if (group == NULL) {
4128 group = new(std::nothrow) ProcessGroup(groupID);
4129 if (group == NULL)
4134 BReference<ProcessGroup> groupReference(group, true);
4142 // lock the new process group and the team's current process group
4144 // lock the team's current process group
4147 ProcessGroup* oldGroup = team->group;
4154 if (oldGroup == group) {
4155 // it's the same as the target group, so just bail out
4157 return group->id;
4162 // lock the target process group, if locking order allows it
4163 if (newGroup || group->id > oldGroup->id) {
4164 group->Lock();
4169 if (group->TryLock())
4172 // no dice -- unlock the team's current process group and relock in
4176 group->Lock();
4181 if (team->group == oldGroup)
4187 group->Unlock();
4191 // we now have references and locks of both new and old process group
4192 BReference<ProcessGroup> oldGroupReference(team->group, true);
4193 AutoLocker<ProcessGroup> oldGroupLocker(team->group, true);
4194 AutoLocker<ProcessGroup> groupLocker(group, true);
4203 // we set our own group
4205 // we must not change our process group ID if we're a session leader
4223 // If we created a new process group, publish it now.
4227 // A group with the group ID appeared since we first checked.
4232 group->PublishLocked(team->group->Session());
4233 } else if (group->Session()->id != team->session_id) {
4234 // The existing target process group belongs to a different session.
4239 // Everything is ready -- set the group.
4241 insert_team_into_group(group, team);
4243 // Changing the process group might have changed the situation for a
4247 return group->id;
4257 // create a new process group and session
4258 ProcessGroup* group = new(std::nothrow) ProcessGroup(team->id);
4259 if (group == NULL)
4261 BReference<ProcessGroup> groupReference(group, true);
4262 AutoLocker<ProcessGroup> groupLocker(group);
4264 ProcessSession* session = new(std::nothrow) ProcessSession(group->id);
4269 // lock the team's current process group, parent, and the team itself
4271 BReference<ProcessGroup> oldGroupReference(team->group);
4272 AutoLocker<ProcessGroup> oldGroupLocker(team->group, true);
4276 // the team must not already be a process group leader
4280 // remove the team from the old and add it to the new process group
4282 group->Publish(session);
4283 insert_team_into_group(group, team);
4285 // Changing the process group might have changed the situation for a
4289 return group->id;
4521 || info.AddInt32("process group", teamClone.group_id) != B_OK