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系統程式設計 第二版
52
|
第二章
錯誤值
發生錯誤時,
lseek()
會傳回
-1
並把
errno
設定為下面四個值其中一個:
EBADF
所指定的「檔案描述器」並未參照到一個已開啟的「檔案描述器」。
EINVAL
為
origin
所指定的值並非
SEEK_SET
、
SEEK_CUR
、
SEEK_END
其中之一,或者由此找到的
檔案位置為負數。事實上,使用
EINVAL
來代表這兩種錯誤並不合宜。前者幾乎就是
一個編譯時期的程式設計錯誤,而後者則代表比較詭異的執行時期的邏輯錯誤。
EOVERFLOW
所產生的檔案偏移值無法使用
off_t
來表示。這只會發生在
32
位元架構上。然而,
檔案位置仍會被更新;此錯誤只是表示檔案位置無法被傳回。
ESPIPE
所指定的「檔案描述器」被關聯到一個無法找尋位置的物件,例如導管(
pipe
)、
FIFO
或
socket
。
限制
檔案位置的最大值受限於
off_t
資料型別本身的大小。多數機器架構會將此定義為
C
語
言的
long
資料型別,在
Linux
上這總是字組的大小(通常就是機器之一般用途暫存器的
大小)。然而,核心在內部會使用
C
語言的
long long
資料型別來儲存偏移值。這並不會
對
64
位元機器構成問題,但是,這意味著,
32
位元機器在找尋檔案位置時,可能會產
生
EOVERFLOW
錯誤。
針對特定位置的讀取與寫入操作
關於
lseek()
的使用,
Linux
提供了
read()
和
write()
系統呼叫的兩種變體,它們分別
會以檔案位置為參數來進行讀取與寫入操作。操作完成之後,它們並
不會
更動檔案的
位置。 ...
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