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系統程式設計 第二版
行程管理
|
151
新的程式映像,則需要這兩個步驟:首先進行
fork
(派生)步驟,以便建立一個新行
程,然後進行
exec
(執行)步驟,以便把一個新映像載入至該行程。下面我們會先說明
exec
呼叫系列,然後說明
fork()
。
exec
呼叫系列
並不存單一的
exec
函式;事實上,那是單一系統呼叫上所建立的一系列
exec
函式。讓
我們先來看看其中最簡單的一個,
execl()
:
#include <unistd.h>
int execl (const char *path,
const char *arg,
...);
透過將
path
參數所指向的程式載入至記憶體,
execl()
可以把當前行程的映像代換成
新的映像。
arg
參數是該程式的第一個引數。而省略符號(
...
)用來表示數目不定的引
數—
execl()
是一個引數數目不定的函式,這意味著,後面有可能會跟著額外的引數,
一個接著一個。此引數串列必須以
NULL
做為結束。
例如,下面的程式碼會以
/bin/vi
取代當前所執行的程式:
int ret;
ret = execl ("/bin/vi", "vi", NULL);
if (ret ==
−
1)
perror ("execl");
注意,按照
Unix
的慣例,我們會以
vi
做為程式的第一個引數。當
shell
派生∕執行
(
fork/exec
)行程時,會以路徑的最後一個元件,
vi
,做為第一個引數,所以一個程式
可以檢視它的第一個引數,
argv[0]
,以便找出它的二元映像之名稱。許多情況下,儘管
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