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系統程式設計 第二版
記憶體管理
|
347
memmem()
函式會傳回一個指標,指向「長度為
haystacklen
個位元組的」記憶體區塊
haystack
中第一次出現之「長度為
needlelen
個位元組的」子區塊
needle
。如果此函式
沒有在
haystack
中找到
needle
,則會傳回
NULL
。此函式也是
GNU
的一個擴充。
修改位元組
Linux
之
C
程式庫提供了一個介面,可用於對資料的位元組進簡單的修改:
#define _GNU_SOURCE
#include <string.h>
void * memfrob (void *s, size_t n);
memfrob()
會遮蔽從
s
開始之記憶體的頭
n
個位元組,方法是使用數值
42
對每個位元組
進行
exclusive-OR
(互斥或,常簡寫為
XOR
)邏輯運算。此呼叫會傳回
s
。
叫用
memfrob()
的結果可以被反轉回來,方法是對相同的記憶體範圍再叫用一次
memfrob()
。因此,如下的程式碼片段等於沒有對
secret
進行任何操作。
memfrob (memfrob (secret, len), len);
此函式無法正確替代加密(或者僅是一個差勁的替代品);它的用途僅限於普通的字串
遮蔽。它是
GNU
特有的函式。
鎖住記憶體
Linux
有實作
需求分頁
(
demand paging
),這意味,有需要時,頁面會從磁碟換入
(
swap in
)記憶體,而不再需要時,頁面會被換出(
swap out
)至磁碟。這讓系統上行
程的虛擬位址空間與實體記憶體的總數之間沒有直接的關係 ...
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