Post

touch fish 33

写文件时进程宕机,数据会丢失吗?

memory profiling

另外这个老哥的blog感觉有点意思

udp send之前到底要不要bind

看下来是不推荐的,实际上sento之后就会给你绑定到本地的port了

另外linux的看下来,是有autobind的, 这个吊代码在linx-0.11就大概是这种逻辑了

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
37
38
39
40
41
42
43
44
int inet_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
{
	struct sock *sk = sock->sk;

	if (unlikely(inet_send_prepare(sk)))
		return -EAGAIN;

	return INDIRECT_CALL_2(sk->sk_prot->sendmsg, tcp_sendmsg, udp_sendmsg,
			       sk, msg, size);
}
EXPORT_SYMBOL(inet_sendmsg);

int inet_send_prepare(struct sock *sk)
{
	sock_rps_record_flow(sk);

	/* We may need to bind the socket. */
	if (data_race(!inet_sk(sk)->inet_num) && !sk->sk_prot->no_autobind &&
	    inet_autobind(sk))
		return -EAGAIN;

	return 0;
}
EXPORT_SYMBOL_GPL(inet_send_prepare);

/*
 *	Automatically bind an unbound socket.
 */
static int inet_autobind(struct sock *sk)
{
	struct inet_sock *inet;
	/* We may need to bind the socket. */
	lock_sock(sk);
	inet = inet_sk(sk);
	if (!inet->inet_num) {
		if (sk->sk_prot->get_port(sk, 0)) {
			release_sock(sk);
			return -EAGAIN;
		}
		inet->inet_sport = htons(inet->inet_num);
	}
	release_sock(sk);
	return 0;
}

android怎么看linux kernel版本

1
adb shell cat /proc/version

再探clickhouse的memcpy

之前发过的,我不记得那个lib的memcpy也换成类似这样了

shared_ptr异步析构

This post is licensed under CC BY 4.0 by the author.

Trending Tags