系统调用是用户空间和内核空间之间的接口,是用户程序与操作系统之间的桥梁。

Linux 内核提供了一系列的系统调用,用户程序可以通过这些系统调用来请求内核执行某些操作。

比如,open 系统调用用于打开一个文件,read 系统调用用于读取文件内容,write 系统调用用于写入文件内容等。

本文将介绍如何为 Linux Kernel 添加一个新的系统调用。

System calls are the interface between user space and kernel space, serving as the bridge between user programs and the operating system.

The Linux kernel provides a series of system calls that user programs can use to request the kernel to perform certain operations.

For example, the open system call opens a file, the read system call reads file content, and the write system call writes file content.

This article explains how to add a new system call to the Linux kernel.

WikiLinux教程Kernel

本文记录如何在 Ubuntu 24.04 系统上编译和运行 Linux kernel.

主机配置如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
                         ./+o+-       wgxls@server
yyyyy- -yyyyyy+ OS: Ubuntu 24.04 noble
://+//////-yyyyyyo Kernel: x86_64 Linux 6.8.0-49-generic
.++ .:/++++++/-.+sss/` Uptime: 22h 2m
.:++o: /++++++++/:--:/- Packages: 1924
o:+o+:++.`..```.-/oo+++++/ Shell: bash
.:+o:+o/. `+sssoo+/ Resolution: 2560x1440
.++/+:+oo+o:` /sssooo. DE: GNOME 46.0.1
/+++//+:`oo+o /::--:. WM: Mutter
\+/+o+++`o++o ++////. WM Theme: Adwaita
.++.o+++oo+:` /dddhhh. GTK Theme: Yaru-purple-dark [GTK2/3]
.+.o+oo:. `oddhhhh+ Icon Theme: Yaru-purple
\+.++o+o``-````.:ohdhhhhh+ Font: Ubuntu Sans 11
`:o+++ `ohhhhhhhhyo++os: Disk: 701G / 2.3T (31%)
.o:`.syhhhhhhh/.oo++o` CPU: AMD Ryzen 7 4800U with Radeon Graphics @ 16x 1.8GHz
/osyyyyyyo++ooo+++/ GPU: AMD/ATI Renoir [Radeon RX Vega 6 (Ryzen 4000/5000 Mobile Series)]
````` +oo+++o\: RAM: 10147MiB / 15489MiB
`oo++.

This article documents how to compile and run the Linux kernel on Ubuntu 24.04.

Host configuration:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
                         ./+o+-       wgxls@server
yyyyy- -yyyyyy+ OS: Ubuntu 24.04 noble
://+//////-yyyyyyo Kernel: x86_64 Linux 6.8.0-49-generic
.++ .:/++++++/-.+sss/` Uptime: 22h 2m
.:++o: /++++++++/:--:/- Packages: 1924
o:+o+:++.`..```.-/oo+++++/ Shell: bash
.:+o:+o/. `+sssoo+/ Resolution: 2560x1440
.++/+:+oo+o:` /sssooo. DE: GNOME 46.0.1
/+++//+:`oo+o /::--:. WM: Mutter
\+/+o+++`o++o ++////. WM Theme: Adwaita
.++.o+++oo+:` /dddhhh. GTK Theme: Yaru-purple-dark [GTK2/3]
.+.o+oo:. `oddhhhh+ Icon Theme: Yaru-purple
\+.++o+o``-````.:ohdhhhhh+ Font: Ubuntu Sans 11
`:o+++ `ohhhhhhhhyo++os: Disk: 701G / 2.3T (31%)
.o:`.syhhhhhhh/.oo++o` CPU: AMD Ryzen 7 4800U with Radeon Graphics @ 16x 1.8GHz
/osyyyyyyo++ooo+++/ GPU: AMD/ATI Renoir [Radeon RX Vega 6 (Ryzen 4000/5000 Mobile Series)]
````` +oo+++o\: RAM: 10147MiB / 15489MiB
`oo++.
WikiLinux教程Kernel

hexo-img-onerror 是一个为 Hexo 网站添加备用图片源的插件。License

故名思义,它的实现原理是为每一个 img 标签添加一个 onerror 事件,当图片加载失败时,会自动替换为备用图片。

如图所示:

hexo-img-onerror is a plugin that adds a fallback image source to Hexo websites. License

As its name suggests, it works by attaching an onerror event to every img tag: when an image fails to load, it is automatically replaced with the fallback image.

As shown below:

阅读更多
WikiGitHubJS

Scheduler 翻译成中文叫做调度器

调度器这个词对于学计算机的同学来说应该并不陌生,因为在大学操作系统的课堂上我们学过很多关于进程调度的知识。

  • 先来先服务(FCFS)
  • 短作业优先(SJF)
  • 优先级调度
  • 时间片轮转
  • 多级反馈队列

等等。

在这篇文章中,我们将会讨论高通 WLAN Host Driver 中调度器的实现。

为什么先学习调度器呢?

因为调度器是 WLAN Host Driver 中相对简单的部分,仅有 4 个源代码文件,而且调度器是 WLAN Host Driver 的核心部分,是各个模块之间沟通的桥梁。

源代码我转存到了我的 GitHub 仓库中,今天要看的部分在这里:

https://github.com/WANG-Guangxin/wlan-driver/tree/5113495b16420b49004c444715d2daae2066e7dc/qca-wifi-host-cmn/scheduler

也可以使用我的 opengrok 服务器来查看源代码,如果它还在线的话。

https://opengrok.dijk.eu.org/xref/wlan-driver/qca-wifi-host-cmn/scheduler/

Scheduler translates to 调度器 (dispatcher) in Chinese.

The word scheduler should be familiar to anyone in computer science — in university OS classes we learned a lot about process scheduling.

  • First Come First Served (FCFS)
  • Shortest Job First (SJF)
  • Priority scheduling
  • Round-robin
  • Multi-level feedback queue

and so on.

In this article, we’ll discuss the scheduler implementation in Qualcomm’s WLAN Host Driver.

Why study the scheduler first?

Because the scheduler is one of the simpler parts of the WLAN Host Driver — only 4 source files — and it’s also the core of the driver, acting as the bridge between all modules.

I’ve mirrored the source code to my GitHub repo; the part we’re looking at today is here:

https://github.com/WANG-Guangxin/wlan-driver/tree/5113495b16420b49004c444715d2daae2066e7dc/qca-wifi-host-cmn/scheduler

You can also browse the source on my opengrok server, if it’s still online.

https://opengrok.dijk.eu.org/xref/wlan-driver/qca-wifi-host-cmn/scheduler/

阅读更多
C/C++WikiWLANDriver

如何使用

点击这里这个仓库提交一个 issue.

issue 的标题是你要执行的 docker pull 命令, 内容不需要写。

几分钟后,在这个 issue 下会收到一个包含下载链接的评论。

点击这个链接即可下载镜像到本地。

执行 docker load < xxx.tar.gz 即可加载镜像。

How to Use

Click here to submit an issue to this repository.

The issue title is the docker pull command you want to run; no body content is needed.

A few minutes later, a comment containing a download link will appear under this issue.

Click the link to download the image locally.

Run docker load < xxx.tar.gz to load the image.

阅读更多
Wiki教程GitHubDocker

起因

前段时间被封了一个圣何塞的甲骨文云账号,上面我开了一个 4C 24G 的 ARM 实例,跑了很多东西,几乎所有以 dijk.eu.org 结尾的域名都在上面跑着。

当然,就包括博客的图片服务器。

这下好了,博客的图片全都挂了。

然后我把博客的图片服务器指定成了家里的服务器。优点是国内访问的速度快,缺点是家里的服务器不稳定。

所以,一个自然的需求就是监控家里的服务器,看看它是否在线。

但是,如果监控服务器的服务器本身都不够稳定,那监控就失去意义了。(没错,我说的就是白嫖的服务器。)

又免费,又相对稳定的服务,我熟悉的就只有 GitHub Actions 了。

效果图效果图

https://wang-guangxin.github.io/sites

Why

A while ago, my Oracle Cloud account in San Jose was banned. I had a 4C 24G ARM instance there running all sorts of things — almost every domain ending in dijk.eu.org was running on it.

Including, of course, the blog’s image server.

So all the blog images went down.

Then I pointed the blog’s image server to my home server. The advantage is fast access from China; the disadvantage is that the home server isn’t stable.

So a natural need arose: monitor the home server to see if it’s online.

But if the monitoring server itself isn’t stable enough, the monitoring becomes meaningless. (Yes, I’m talking about free-riding servers.)

For something free and relatively stable, the only thing I know well is GitHub Actions.

EffectEffect

https://wang-guangxin.github.io/sites

阅读更多
Wiki教程PythonGitHub

前段时间写的一个基于 Cloudflare Workers 搭建 Vless 节点访问 ChatGPT 的文章部分内容失效了,节点还是可以正常翻墙,但是由于代码中的 ProxyIP 失效了,所以无法访问 ChatGPT 的网站了,其实是所有托管在 Cloudflare 的网站都访问不了了。这周末更新了一下那篇文章中的代码,算是短暂修复了。

这个问题不是本文要讨论的内容,但是它让我想到我需要对文章内容的时效性加个必要的“免责声明”。

其实文章过期提醒这个 Feature 在很多博客主题中都有,但是我使用的 hexo-theme-yun 已经进入了维护阶段。
所以我需要自己动手实现这个功能。

在这篇博客中,我将会介绍如何在 hexo-theme-yun 主题中添加文章过期提醒功能。

效果如下:

文章过期提醒

A while ago I wrote an article about building a Vless node with Cloudflare Workers to access ChatGPT, and part of its content has gone stale. The node itself can still bypass the firewall fine, but the ProxyIP in the code stopped working, so I could no longer reach ChatGPT — in fact, none of the sites hosted on Cloudflare could be reached. This weekend I updated the code in that article, which is a temporary fix.

That problem isn’t what this article is about, but it made me realize I should add a necessary “disclaimer” about the timeliness of my articles.

Actually, an article expiration notice is a feature that exists in many blog themes, but the hexo-theme-yun I use has entered maintenance mode.
So I had to implement this feature myself.

In this post, I’ll show you how to add an article expiration notice to the hexo-theme-yun theme.

Here’s what it looks like:

Article expiration notice

Wiki教程JS