Skip to Content
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
Explore Skills
Cloud Computing
Microsoft Azure
Amazon Web Services (AWS)
Google Cloud
Cloud Migration
Cloud Deployment
Cloud Platforms
Data Engineering
Data Warehouse
SQL
Apache Spark
Microsoft SQL Server
MySQL
Kafka
Data Lake
Streaming & Messaging
NoSQL Databases
Relational Databases
Data Science
Pandas
R
MATLAB
SAS
D3
Power BI
Tableau
Statistics
Exploratory Data Analysis
Data Visualization
AI & ML
Generative AI
Machine Learning
Artificial Intelligence (AI)
Deep Learning
Reinforcement Learning
Natural Language Processing
TensorFlow
Scikit-Learn
Hyperparameter Tuning
MLOps
Programming Languages
Java
JavaScript
Spring
Python
Go
C#
C++
C
Swift
Rust
Functional Programming
Software Architecture
Object-Oriented
Distributed Systems
Domain-Driven Design
Architectural Patterns
IT/Ops
Kubernetes
Docker
GitHub
Terraform
Continuous Delivery
Continuous Integration
Database Administration
Computer Networking
Operating Systems
IT Certifications
Security
Network Security
Application Security
Incident Response
Zero Trust Model
Disaster Recovery
Penetration Testing / Ethical Hacking
Governance
Malware
Security Architecture
Security Engineering
Security Certifications
Design
Web Design
Graphic Design
Interaction Design
Film & Video
User Experience (UX)
Design Process
Design Tools
Business
Agile
Project Management
Product Management
Marketing
Human Resources
Finance
Team Management
Business Strategy
Digital Transformation
Organizational Leadership
Soft Skills
Professional Communication
Emotional Intelligence
Presentation Skills
Innovation
Critical Thinking
Public Speaking
Collaboration
Personal Productivity
Confidence / Motivation
Features
All features
Verifiable skills
AI Academy
Courses
Certifications
Interactive learning
Live events
Superstreams
Answers
Insights reporting
Radar Blog
Buy Courses
Plans
Sign In
Try Now
O'Reilly Platform
book
LINUX系統程式設計 第二版
by
Robert Love
December 2013
Intermediate to advanced
496 pages
8h 57m
Chinese
GoTop Information, Inc.
Content preview from
LINUX系統程式設計 第二版
行程管理
|
183
行程群組系統呼叫
setpgid()
會把
pid
所指定之行程的行程群組識別碼設定成
pgid
:
#define _XOPEN_SOURCE 500
#include <unistd.h>
int setpgid (pid_t pid, pid_t pgid);
如果
pid
引數的值為
0
,則會使用當前的行程。如果
pgid
的值為
0
,則
pid
所指定之行
程的行程識別碼,會被當成行程群組識別碼。
執行成功時,
setpgid()
會傳回
0
。執行成功代表符合以下幾個條件:
•
pid
所指定之行程必須是進行叫用之行程,或者是進行叫用之行程的一個未調用
exec
的子行程,而且與進行叫用之行程皆隸屬同一個期程。
•
pid
所指定之行程不可以是一個期程的帶頭行程。
•
如果
pgid
已經存在,它必須與進行叫用之行程隸屬同一個期程。
•
pgid
不可以是負值。
發生錯誤時,此呼叫會傳回
-1
,而且會把
errno
設定成下面其中一個錯誤碼:
EACCESS
pid
所指定的行程是進行叫用之行程的一個已經調用
exec
的子行程。
EINVAL
pgid
的值小於
0
。
EPERM
pid
所指定之行程是一個期程的帶頭行程,或者與進行叫用之行程分屬不同的期程。
亦或者是,企圖把一個行程移往位於不同期程的行程群組。
ESRCH
pid
不是當前行程,
0
,或者不是當前行程的一個子行程。
如同期程,儘管可以取得一個行程的行程群組識別碼,但是用處不大:
#define _XOPEN_SOURCE 500
#include <unistd.h>
pid_t getpgid ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial
You might also like
優雅的SciPy|Python科學研究的美學
Juan Nunez-Iglesias, Stéfan van der Walt, Harriet Dashnow
成為卓越程式設計師的38項必修法則
Pete Goodliffe
深入理解運算原理|從簡單的機器到無所不能的程式
Tom Stuart
C++语言导学(原书第2版)
本贾尼 斯特劳斯特鲁普
Publisher Resources
ISBN: 9789862769812