我听说基于 FUSE 的文件系统是出了名的慢,因为它们是在用户空间程序中实现的。用户空间比内核慢是怎么回事?
我读到有两种称为“内核模式”和“用户模式”的模式来处理进程的执行。(了解 Linux 内核,第 3 版。)这是由 Linux 控制的硬件开关(内核/用户),还是由 Linux 内核提供的软件功能?
我知道什么是登录 shell 以及登录 shell 和非登录 shell 之间的区别。
但令我困惑的是它是如何被调用的。据说登录 shell 是用-参数 0调用的。
我们如何将参数传递给正在调用的 shell,然后参数 0 是 shell 本身的名称?
# -bash
-bash: -bash: command not found
Run Code Online (Sandbox Code Playgroud)
好的没关系
# bash --login
# echo $0
# bash
Run Code Online (Sandbox Code Playgroud)
我仍然没有看到-bash.
只有当我通过 SSH 连接时,我才能-bash在发出echo $0. 但回到我最初的问题,
-给 bash shell?我正在尝试使用 linux 内核 4.1.6 添加系统调用,但我能找到的所有文档都是针对旧版本的。有谁知道它在较新的内核中是如何完成的或有任何好的参考资料?
应该有3个步骤:
添加到系统调用表。我发现他们现在使用 arch/x86/syscalls/syscall_64.tbl 而不是 entry.S。所以我在里面放了一些东西。
添加到 asm/unistd.h 文件。显然 unistd.h 文件现在是自动生成的,所以我们不必手动更新它?所以我没有为这一步做任何事情,因为文件不存在。 /sf/ask/769213161/
将系统调用编译到内核中。我已经按照基于内核 2.6 的书(Robert Love 的 linux 内核开发书)中的建议将实际的系统调用代码添加到 kernel/sys.c。我再次编译内核。
然后我按照书中的建议编写了一个客户端程序,但是当我尝试编译它时,它显示未知类型名称“helloworld”。我的程序与本书不同,但结构相同。
#include <stdio.h>
#define __NR_helloworld 323
__syscall0(long, helloworld)
int main()
{
printf("I will now call helloworld syscall:\n");
helloworld();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
互联网(和可用的书籍)似乎严重缺乏这些信息——或者谷歌并不像它想象的那么聪明。无论如何,任何帮助表示赞赏。
谢谢。〜
〜
〜
我最近在一台新计算机上安装了我的硬盘,经过一番摆弄之后,我注意到我的 iptables 规则出于某种原因丢弃了 DNS 响应,结果它们被配置为允许 eth0 上的东西,但是这台计算机中使用了 eth8,一切都在丢弃(不仅仅是 DNS 查询)。无论如何,我同时使用 Wireshark 来查看 DNS 服务器是否响应查询并发现它们响应了。但我刚刚注意到 iptables 正在丢弃上述数据包。如果数据包被丢弃,Wireshark 怎么能看到这些数据包?
用于生成规则集的脚本:
# Flush all rules
iptables -F
iptables -X
# Allow unlimited traffic on loopback
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
# Allow incomming traffic from estabilished and related connections
iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
# Policy: Allow outgoing, deny incoming and forwarding
iptables -P OUTPUT ACCEPT
iptables -P …Run Code Online (Sandbox Code Playgroud) 我有 OSX 10.9.5 。我想在我的 OSX 机器上构建 NetBSD(或者至少是它的内核)。我试过构建“config”程序,但找不到“build.sh”。这是可能的,这样做的步骤是什么?谢谢。
lspci在我的 RHEL 7.2 机器上运行时,我注意到我的以太网适配器更改了 PCI 总线 ID。在下面的示例中,它从“02:00.x”更改为“03:00.x”。
前:
[root@rhel:~]# lspci | grep Ethernet
02:00.0 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
02:00.1 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
Run Code Online (Sandbox Code Playgroud)
当前的:
[root@rhel:~]# lspci | grep Ethernet
03:00.0 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
03:00.1 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
Run Code Online (Sandbox Code Playgroud) 我每秒有大约 200000 个页面错误,我认为这是一个巨大的数字,它会影响整体系统性能。我正在使用带有 16G RAM 的 MBP。
如何处理这样数量的页面错误(不断)?我的意思是,有可能找到它背后的原因(比如哪个过程导致了这个以及为什么)?
例如:
$ sudo vm_stat 1
Mach Virtual Memory Statistics: (page size of 4096 bytes)
free active specul inactive throttle wired prgable faults copy 0fill reactive purged file-backed anonymous cmprssed cmprssor dcomprs comprs pageins pageout swapins swapouts
4917 96838 529 97567 0 3289215 2 11428M 127346K 5267290K 2537359K 215040K 47481 147453 11108999 703646 3631740K 3986806K 125027K 3038713 4551661K 4575495K
4728 119600 514 119225 0 3290072 0 197571 160 2067 28142 2 47479 191860 …Run Code Online (Sandbox Code Playgroud) 我在 /boot 中的空间非常小,想知道如果有一些事情我可以摆脱。这是输出sudo ls -al /boot:
total 216002
drwxr-xr-x 4 root root 3072 Feb 20 12:33 .
drwxr-xr-x 23 root root 4096 Feb 20 12:30 ..
-rw-r--r-- 1 root root 1271689 Oct 22 2015 abi-3.19.0-32-generic
-rw-r--r-- 1 root root 1239577 Apr 18 2016 abi-4.4.0-21-generic
-rw-r--r-- 1 root root 1244118 Jan 6 17:44 abi-4.4.0-59-generic
-rw-r--r-- 1 root root 1244118 Jan 18 08:59 abi-4.4.0-62-generic
-rw-r--r-- 1 root root 1245512 Feb 1 12:39 abi-4.4.0-63-generic
-rw-r--r-- 1 root root 177790 Oct 22 …Run Code Online (Sandbox Code Playgroud) kernel ×10
linux ×5
osx ×2
performance ×2
api ×1
architecture ×1
bash ×1
centos ×1
conventions ×1
cpu ×1
disk-usage ×1
filesystems ×1
fuse ×1
iptables ×1
linux-kernel ×1
make ×1
netbsd ×1
networking ×1
pci ×1
shell ×1
swap ×1
system-calls ×1
udev ×1
wireshark ×1