当前位置:网站首页>Engine localization adaptation & Reconstruction notes
Engine localization adaptation & Reconstruction notes
2022-06-24 10:05:00 【51CTO】
About daemons dup stderr problem ;
fd = open("/dev/null", O_RDWR);
if (dup2(fd, STDIN_FILENO) == -1)
if (dup2(fd, STDOUT_FILENO) == -1)
#if xxx
if (dup2(fd, STDERR_FILENO) == -1)
#else
fd_log = open("pathlog", O_RDWR);
if (dup2(fd_log, STDERR_FILENO) == -1)
#endif
if (fd > STDERR_FILENO) {
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
take dup2(fd_log, stderr) still dup2(fd_null, stderr);
That is, the standard error is redirected to Black hole or log In file
look down man dup Result :dup2() makes newfd be the copy of oldfd, closing newfd first if necessary,
NAME
dup, dup2, dup3 - duplicate a file descriptor
SYNOPSIS
#include <unistd.h>
int dup(int oldfd);
int dup2(int oldfd, int newfd);
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <fcntl.h> /* Obtain O_* constant definitions */
#include <unistd.h>
int dup3(int oldfd, int newfd, int flags);
DESCRIPTION
These system calls create a copy of the file descriptor oldfd.
dup() uses the lowest-numbered unused descriptor for the new descriptor.
dup2() makes newfd be the copy of oldfd, closing newfd first if necessary, but note the following:
* If oldfd is not a valid file descriptor, then the call fails, and newfd is not closed.
* If oldfd is a valid file descriptor, and newfd has the same value as oldfd, then dup2() does nothing, and returns newfd.
After a successful return from one of these system calls, the old and new file descriptors may be used interchangeably. They refer to the same open file description (see open(2)) and thus share file offset and file status flags; for
example, if the file offset is modified by using lseek(2) on one of the descriptors, the offset is also changed for the other.
The two descriptors do not share file descriptor flags (the close-on-exec flag). The close-on-exec flag (FD_CLOEXEC; see fcntl(2)) for the duplicate descriptor is off.
dup3() is the same as dup2(), except that:
* The caller can force the close-on-exec flag to be set for the new file descriptor by specifying O_CLOEXEC in flags. See the description of the same flag in open(2) for reasons why this may be useful.
* If oldfd equals newfd, then dup3() fails with the error EINVAL.
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
Engine precautions :
- Process name
- cpu binding
- Process resource settings (file_limit core_limit signal_mask)
- Time stamp setting ( Multi process / Multithreading )volatile Prevent optimization
- Daemon
- signal processing as well as coredump Handle
- log Set up
- Processing parameters
- Process unique instance
- Get rid of root Privilege
- Interprocess communication -socketpair pipe unix-socket Shared memory (mmap munmap as well as shmget shmat shmctl) Shared memory blog pipe-unix blog
Network middleware :
use libevent libuv Re encapsulation or Write again in combination with your own business ?
Protocol analysis :
Packing problem :
- fakeroot jurisdiction : Use fakeroot simulation root Authority executor , When packing , The owner of the file in the package must be root. Must be root Permission to execute packaged commands , But you should avoid using... When making packages root jurisdiction . To solve this contradiction ,fakeroot It was developed . stay fakeroot Environment , Working with files is like using root Same as the operation file , however , In fact, the file permissions in the system are the same as the original permissions .
LD_PRELOAD=//usr/userpath/x86build/lib/libfakeroot.so python build_packet.py
http proxy server (3-4-7 Layer of the agent )- Network event library common component 、 kernel kernel drive Camera drive tcpip Network protocol stack 、netfilter、bridge Seems to have seen !!!! But he that doeth good Don't ask future -- Height and weight 180 Fat man
边栏推荐
- Endgame P.O.O
- 十大证券公司哪个佣金最低,最安全可靠?有知道的吗
- Indexeddb local storage, homepage optimization
- Which of the top ten securities companies has the lowest Commission and is the safest and most reliable? Do you know anything
- 字节跳动-面试官: 谈下音视频同步原理,音频和视频能绝对同步吗?
- PostgreSQL
- 二叉树第一部分
- Record the range of data that MySQL update will lock
- Practical analysis: implementation principle of APP scanning code landing (app+ detailed logic on the web side) with source code
- 微信小程序學習之 實現列錶渲染和條件渲染.
猜你喜欢

Latex formula and table recognition

如何提高网络基础设施排障效率,告别数据断档?

Ora-28000 error after upgrading Oracle 12C to 19C

使用Live Chat促进业务销售的惊人技巧

How to make social media the driving force of cross-border e-commerce? This independent station tool cannot be missed!

英伟达这篇CVPR 2022 Oral火了!2D图像秒变逼真3D物体!虚拟爵士乐队来了!

生产者/消费者模型

canvas 绘制图片

Impdp leading schema message ora-31625 exception handling

有关二叉树 的基本操作
随机推荐
js单例模式
[custom endpoint and implementation principle]
About thinkphp5, use the model save() to update the data prompt method not exist:think\db\query- & gt; Error reporting solution
涂鸦智能携多款重磅智能照明解决方案,亮相2022美国国际照明展
Basic operations on binary tree
port 22: Connection refused
Honeypot 2 hfish, ehoney
请问有国内靠谱低手续费的期货开户渠道吗?网上开户安全吗?
Literature Research Report
LeetCode: 377. Combined sum IV
微信小程序学习之 实现列表渲染和条件渲染.
How to standardize data center infrastructure management process
Algorithm - the K row with the weakest combat power in the matrix (kotlin)
Get the QR code of wechat applet with parameters - and share the source code of modifying the QR code logo
NVIDIA's CVPR 2022 oral is on fire! 2D images become realistic 3D objects in seconds! Here comes the virtual jazz band!
Observer mode
有关二叉树 的基本操作
二叉树第一部分
Amazing tips for using live chat to drive business sales
算法---矩阵中战斗力最弱的 K 行(Kotlin)