当前位置:网站首页>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
边栏推荐
- TP5 using post to receive array data times variable type error: solution to array error
- 算法--找到和最大的长度为 K 的子序列(Kotlin)
- Grpc local test joint debugging tool bloomrpc
- 引擎国产化适配&重构笔记
- Internet of things? Come and see Arduino on the cloud
- Prct-1400: failed to execute getcrshome resolution
- GIS实战应用案例100篇(十四)-ArcGIS属性连接和使用Excel的问题
- Wechat cloud hosting launch public beta: in the appointment of the publicity meeting
- Groovy obtains Jenkins credentials through withcredentials
- LeetCode: 137. Number II that appears only once
猜你喜欢

vim的使用

impdp导schema报ORA-31625异常处理

oracle池式连接请求超时问题排查步骤

How to solve multi-channel customer communication problems in independent stations? This cross-border e-commerce plug-in must be known!

415 binary tree (144. preorder traversal of binary tree, 145. postorder traversal of binary tree, 94. inorder traversal of binary tree)

413 binary tree Foundation

413-二叉树基础

植物生长h5动画js特效

Conseils étonnants pour promouvoir les ventes d'entreprise avec le chat en direct

LeetCode: 240. Search 2D matrix II
随机推荐
Wechat applet learning to achieve list rendering and conditional rendering
Detailed explanation of PHP singleton mode
二叉樹第一部分
Oracle database expdp only exports tables
[input method] so far, there are so many Chinese character input methods!
How do novices choose the grade of investment and financial products?
411 stack and queue (20. valid parentheses, 1047. delete all adjacent duplicates in the string, 150. inverse Polish expression evaluation, 239. sliding window maximum, 347. the first k high-frequency
Symbol. Iterator iterator
416-二叉树(前中后序遍历—迭代法)
Oracle viewing data file header SCN information
[custom endpoint and implementation principle]
字节跳动-面试官: 谈下音视频同步原理,音频和视频能绝对同步吗?
Amazing tips for using live chat to drive business sales
SQL statistics of users logged in for N consecutive days
微信小程序學習之 實現列錶渲染和條件渲染.
413-二叉树基础
impdp导schema报ORA-31625异常处理
引擎国产化适配&重构笔记
5分钟,客服聊天处理技巧,炉火纯青
小程序学习之获取用户信息(getUserProfile and getUserInfo)