https://man7.org/linux/man-pages/man2/mlock.2.html
对于普通用户进程,mlock
的内存总量不能超过RLIMIT_MEMLOCK
。可以通过cat /proc/pid/limits
查看,。如果要超过RLIMIT_MEMLOCK
,需要有权限CAP_IPC_LOCK
。
pi@pi4b:/devspace/test-api $ cat /proc/self/limits
From 9f07d84dae8787a15fea017ccc70aadb1aa23797 Mon Sep 17 00:00:00 2001 | |
From: pkemb <pkemb@outlook.com> | |
Date: Sun, 4 Aug 2024 21:27:22 +0800 | |
Subject: [PATCH] add 'adb connect vm:<port>,<serial>' | |
Change-Id: Ie89a4dc59f0272e148eff41fdfe996dee4780afa | |
Signed-off-by: pkemb <pkemb@outlook.com> | |
--- | |
adb.h | 2 ++ | |
client/transport_local.cpp | 34 ++++++++++++++++++++++++++++ |
import re | |
import time | |
import requests | |
from concurrent.futures import ThreadPoolExecutor, as_completed | |
from functools import lru_cache | |
import json, isbnlib | |
from urllib.parse import urlparse, parse_qs, urljoin, urlunparse | |
from cps.services.Metadata import MetaRecord, MetaSourceInfo, Metadata | |
DOUBAN_SEARCH_JSON_URL = "http://doubanapi.pk.inc/" | |
DOUBAN_BOOK_CAT = "1001" |
CC=gcc | |
LD=ld | |
PROGRAM += tiny_hello | |
all: ${PROGRAM} | |
%: %.c | |
${CC} -c -g -fno-builtin $< | |
${LD} -static -e nomain $@.o -o $@ |
https://man7.org/linux/man-pages/man2/mlock.2.html
对于普通用户进程,mlock
的内存总量不能超过RLIMIT_MEMLOCK
。可以通过cat /proc/pid/limits
查看,。如果要超过RLIMIT_MEMLOCK
,需要有权限CAP_IPC_LOCK
。
pi@pi4b:/devspace/test-api $ cat /proc/self/limits
man手册包含一个示例代码。
https://www.man7.org/linux/man-pages/man3/dl_iterate_phdr.3.html
#define _GNU_SOURCE
利用flock()
实现单实例。利用了进程退出时kernel会释放进程所有资源的特点,进程无论是正常退出还是异常退出,都可以保证文件锁释放了。
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/file.h>
#include <unistd.h>
int main(int argc, char *argv[])
Git for Windows comes bundled with the "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.
The basic idea is that C:\Program Files\Git\mingw64\
is your /
directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git
, the mingw64
in this directory is your root. Find it by using pwd -W
).
If you go to that directory, you will find the typical linux root folder structure (bin
, etc
, lib
and so on).
If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corresponding directories. Sometimes the windows binary have funny prefixes, so