aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
7 daysman/man3/getopt_long*.3: Split getopt_long_only() from getopt_long(3)HEADmasterAlejandro Colomar2-21/+61
Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 daysman/man3/getopt_long.3: SYNOPSIS: Simplify feature test macroAlejandro Colomar1-11/+1
Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 daysman/man3/getopt*.3: Split getopt_long*() from getopt(3)Alejandro Colomar3-222/+265
Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 daysman/man3/*s*printf.3: Split [v]sprintf() from snprintf(3)Alejandro Colomar3-80/+112
Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 daysman/man3/*printf.3: Split *s*printf() from printf(3)Alejandro Colomar5-220/+327
Signed-off-by: Alejandro Colomar <alx@kernel.org>
9 daysman/man5/proc.5: Remove redundant paragraphAlejandro Colomar1-4/+0
We already reference the manual pages by name. Fixes: ba0d674b67d6 (2025-12-02; "man/man5/proc*.5: Add references to other proc*.5 pages") Signed-off-by: Alejandro Colomar <alx@kernel.org>
9 daysshare/mk/: help-list-variables: Don't list undefined variablesAlejandro Colomar1-1/+11
Signed-off-by: Alejandro Colomar <alx@kernel.org>
10 daysshare/mk/: $UNIQ: Add dependencyAlejandro Colomar1-0/+14
Signed-off-by: Alejandro Colomar <alx@kernel.org>
10 daysshare/mk/: help-list-targets: Use 'make -n'Alejandro Colomar1-1/+1
This makes the command more portable to arbitrary makefiles, as one can run any target without fear of running any commands. Signed-off-by: Alejandro Colomar <alx@kernel.org>
10 daysshare/mk/: help, help-*: Add targets to list targets, variables, and build ↵Alejandro Colomar2-20/+49
dependencies Suggested-by: Paolo Bonzini <bonzini@gnu.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
10 daysGNUmakefile: wsfixAlejandro Colomar1-13/+13
Signed-off-by: Alejandro Colomar <alx@kernel.org>
10 daysshare/mk/: $TR: Add dependencyAlejandro Colomar1-0/+14
Signed-off-by: Alejandro Colomar <alx@kernel.org>
11 daysman/man2const/PR_SET_NAME.2const: SYNOPSIS: Fix prototypeAlejandro Colomar1-1/+1
The array may be narrower than that. Signed-off-by: Alejandro Colomar <alx@kernel.org>
11 daysman/man2const/PR_SET_NAME.2const: SYNOPSIS: tfixAlejandro Colomar1-2/+2
Fixes: a4fc95108363 (2024-05-31; "prctl.2, PR_[SG]ET_NAME.2const: Split PR_[SG]ET_NAME from prctl(2)") Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man5/proc*.5: Add references to other proc*.5 pagesAlejandro Colomar4-0/+253
Fixes: 0569afbbccd6 (2023-08-17; "proc*.5: Make sashimi") Reported-by: "Michael T. Kerrisk" <mtk.manpages@gmail.com> Reported-by: Carlos O'Donell <carlos@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/: Make sashimi of ipv6(7)Alejandro Colomar21-231/+762
Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/IPV6_V6ONLY.2const: Tweak after splitAlejandro Colomar1-8/+8
Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/{IPPROTO_IPV6,IPV6_V6ONLY}.2const: Split IPV6_V6ONLY from ↵Alejandro Colomar2-18/+52
IPPROTO_IPV6(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/IPV6_UNICAST_HOPS.2const: Tweak after splitAlejandro Colomar1-5/+7
Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/{IPPROTO_IPV6,IPV6_UNICAST_HOPS}.2const: Split ↵Alejandro Colomar2-6/+40
IPV6_UNICAST_HOPS from IPPROTO_IPV6(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/IPV6_ROUTER_ALERT.2const: Tweak after splitAlejandro Colomar1-8/+10
Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/{IPPROTO_IPV6,IPV6_ROUTER_ALERT}.2const: Split ↵Alejandro Colomar2-15/+50
IPV6_ROUTER_ALERT from IPPROTO_IPV6(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/IPV6_RECVERR.2const: Tweak after splitAlejandro Colomar1-7/+3
Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/{IPPROTO_IPV6,IPV6_RECVERR}.2const: Split IPV6_RECVERR from ↵Alejandro Colomar2-9/+46
IPPROTO_IPV6(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/IPV6_RTHDR.2const: Tweak after splitAlejandro Colomar1-9/+14
Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/IPV6_{AUTHHDR,DSTOPTS,HOPOPTS,FLOWINFO,HOPLIMIT}.2const: Add ↵Alejandro Colomar5-0/+5
link pages Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/{IPPROTO_IPV6,IPV6_RTHDR}.2const: Split ↵Alejandro Colomar2-27/+88
IPV6_{RTHDR,AUTHHDR,DSTOPTS,HOPOPTS,FLOWINFO,HOPLIMIT} from IPPROTO_IPV6(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/IPV6_RECVPKTINFO.2const: Tweak after splitAlejandro Colomar1-3/+3
Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/{IPPROTO_IPV6,IPV6_RECVPKTINFO}.2const: Split IPV6_RECVPKTINFO ↵Alejandro Colomar2-14/+49
from IPPROTO_IPV6(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/IPV6_MULTICAST_LOOP.2const: Tweak after splitAlejandro Colomar1-3/+1
Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/{IPPROTO_IPV6,IPV6_MULTICAST_LOOP}.2const: Split ↵Alejandro Colomar2-4/+40
IPV6_MULTICAST_LOOP from IPPROTO_IPV6(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/IPV6_MULTICAST_IF.2const: Tweak after splitAlejandro Colomar1-2/+2
Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/{IPPROTO_IPV6,IPV6_MULTICAST_IF}.2const: Split ↵Alejandro Colomar2-12/+48
IPV6_MULTICAST_IF from IPPROTO_IPV6(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/IPV6_MULTICAST_HOPS.2const: Tweak after splitAlejandro Colomar1-5/+7
Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/{IPPROTO_IPV6,IPV6_MULTICAST_HOPS}.2const: Split ↵Alejandro Colomar2-6/+42
IPV6_MULTICAST_HOPS from IPPROTO_IPV6(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/IPV6_MTU_DISCOVER.2const: Tweak after splitAlejandro Colomar1-7/+3
Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/{IPPROTO_IPV6,IPV6_MTU_DISCOVER}.2const: Split ↵Alejandro Colomar2-8/+44
IPV6_MTU_DISCOVER from IPPROTO_IPV6(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/IPV6_MTU.2const: Tweak after splitAlejandro Colomar1-4/+1
Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/{IPPROTO_IPV6,IPV6_MTU}.2const: Split IPV6_MTU from ↵Alejandro Colomar2-12/+48
IPPROTO_IPV6(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/IPV6_ADD_MEMBERSHIP.2const: Tweak after splitAlejandro Colomar1-5/+1
Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/IPV6_DROP_MEMBERSHIP.2const: Add link pageAlejandro Colomar1-0/+1
Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/{IPPROTO_IPV6,IPV6_ADD_MEMBERSHIP}.2const: Split ↵Alejandro Colomar2-5/+49
IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP from IPPROTO_IPV6(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/IPV6_ADDRFORM.2const: Tweak after splitAlejandro Colomar1-4/+3
Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/{IPPROTO_IPV6,IPV6_ADDRFORM}.2const: Split IPV6_ADDRFORM from ↵Alejandro Colomar2-13/+45
IPPROTO_IPV6(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man7/ipv6.7, man/man2const/IPPROTO_IPV6.2const: Split IPPROTO_IPV6 from ↵Alejandro Colomar2-231/+271
ipv6(7) Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man3/strtol.3: Use _Maxof(3) and _Minof(3) instead of macros from <limits.h>Alejandro Colomar1-2/+2
Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man2const/IP_PKTINFO.2const: tfixAlejandro Colomar1-1/+1
Fixes: fea681dafb13 (2004-11-03, 2004-11-03; "Import of man-pages 1.70") Fixes: 9d1fd1157306 (1999-06-15, 2022-12-19; "man-pages 1.24") Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/: Fix and de-duplicate SO_PEERSEC(2const)Alejandro Colomar4-59/+21
- SO_PEERSEC is a SOL_SOCKET option, not an IPPROTO_IP one. - Its description was duplicated in both ip(7) --moved to SO_PEERSEC(2const)-- and unix(7). De-duplicate the texts. - It was listed in unix(7) as AF_UNIX-only, but it also works with AF_INET. Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man7/operator.7: Document _Maxof(3) and _Minof(3)Alejandro Colomar1-1/+3
Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man3/_Minof.3: Add link pageAlejandro Colomar1-0/+1
Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man3/_Maxof.3: Add pageAlejandro Colomar1-0/+51
Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man7/ip.7: Don't say that bind(INADDR_BROADCAST) is the same as ↵наб1-5/+0
bind(INADDR_ANY) Because it's patently not true: a program like #define _GNU_SOURCE #include <netinet/in.h> #include <netinet/udp.h> #include <stdbool.h> #include <stdcountof.h> #include <stdlib.h> #include <sys/socket.h> #define sizeof_a(a) \ ( \ countof(a) * sizeof((a)[0]) \ ) #define recv_a(sfd, buf, flags) \ ( \ recv(sfd, buf, sizeof_a(buf), flags) \ ) #define bind_T(sfd, addr, T) \ (( \ _Generic(addr, T *: 0, const T *: 0), \ bind(sfd, addr, sizeof(T)) \ )) #define setsockopt_T(sfd, l, opt, val, T) \ (( \ _Generic(val, T *: 0, const T *: 0), \ setsockopt(sfd, l, opt, val, sizeof(T)) \ )) static inline int setsockopt_int(int sfd, int l, int opt, int val) { return setsockopt_T(sfd, l, opt, &val, int); } int main(void) { int sock; unsigned char buf[512]; struct sockaddr_in addr; sock = socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, IPPROTO_UDP); setsockopt_int(sock, SOL_SOCKET, SO_REUSEADDR, true); setsockopt_int(sock, SOL_SOCKET, SO_REUSEPORT, true); addr = (struct sockaddr_in){ .sin_family = AF_INET, .sin_port = htons(123), .sin_addr = {INADDR_ANY} }; bind_T(sock, &addr, struct sockaddr_in); recv_a(sock, buf, 0); exit(EXIT_SUCCESS); } will receive an NTP broadcast, but if you s/INADDR_ANY/INADDR_BROADCAST/ it won't. Quoth POSIX.1-2024: 11252 The <netinet/in.h> header shall define the following symbolic constant for use as a destination 11253 address in the structures passed to connect( ), sendmsg( ), and sendto( ): 11254 INADDR_BROADCAST IPv4 broadcast address. (this is one of two mentions of the symbol, the other is a RATIONALE for why no byte ordering is specified). Linux calls it /* Address to send to all hosts. */ #define INADDR_BROADCAST ((unsigned long int) 0xffffffff) and AFAICT never uses it in the receive path (except in RDS to reject bind(2)). Fixes: fea681dafb13 (2004-11-03, 2004-11-03; "Import of man-pages 1.70") Fixes: 3c5f99be9759 (1999-11-28, 2022-12-19; "man-pages 1.28") Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Message-ID: <qzlsd5wpn42hdxj43tavdyzhrpocjaddwxgyikiuk2bdzvobya@tarta.nabijaczleweli.xyz> [alx: some safety improvements to the program in commit message] Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 daysman/man3/sscanf.3: Document exact matching for %cFlorian Weimer1-0/+7
The glibc manual has always documented this behavior, but the implementation differed, treating the field width as an upper limit. Signed-off-by: Florian Weimer <fweimer@redhat.com> Message-ID: <lhu1pli6tsj.fsf@oldenburg.str.redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-26man/man2type/in_pktinfo.2type: Tweak after splitAlejandro Colomar1-3/+8
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-26man/man2const/IP_PKTINFO.2const, man/man2type/in_pktinfo.2type: Split struct ↵Alejandro Colomar2-45/+71
in_pktinfo from IP_PKTINFO(2const) Suggested-by: Jakub Głogowski <not@dzwdz.net> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/: Make sashimi of ip(7)Alejandro Colomar43-1176/+2494
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man7/ip.7: Refer to sockaddr_in(3type)Alejandro Colomar1-22/+11
And improve formatting. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man3type/sockaddr*.3type: Make sashimi of sockaddr(3type)Alejandro Colomar4-60/+126
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man3type/sockaddr_un.3type: Tweak after splitAlejandro Colomar1-2/+2
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man3type/sockaddr{,_un}.3type: Split struct sockaddr_un from sockaddr(3type)Alejandro Colomar2-14/+33
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man3type/sockaddr{,_in,_in6}.3type: Split struct sockaddr_in6 from ↵Alejandro Colomar3-25/+52
sockaddr_in(3type) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_*,SO_*}.2const: Make sashimi of IPPROTO_IP(2const)Alejandro Colomar36-901/+2111
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man3type/sockaddr_in.3type: Tweak after splitAlejandro Colomar1-7/+7
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man3type/sockaddr{,_in,_in6}.3type: Split IP types from sockaddr(3type)Alejandro Colomar3-48/+68
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IPPROTO_IP.2const: Tweak after making sashimi of this pageAlejandro Colomar1-7/+5
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/SO_PEERSEC.2const: Tweak after splitAlejandro Colomar1-13/+20
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,SO_PEERSEC}.2const: Split SO_PEERSEC from ↵Alejandro Colomar2-57/+91
IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_UNBLOCK_SOURCE.2const: Tweak after splitAlejandro Colomar1-7/+4
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_UNBLOCK_SOURCE}.2const: Split IP_UNBLOCK_SOURCE ↵Alejandro Colomar2-10/+45
from IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_TTL.2const: Tweak after splitAlejandro Colomar1-2/+2
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_TTL}.2const: Split IP_TTL from IPPROTO_IP(2const)Alejandro Colomar2-4/+40
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_TRANSPARENT.2const: Tweak after splitAlejandro Colomar1-9/+12
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_TRANSPARENT}.2const: Split IP_TRANSPARENT from ↵Alejandro Colomar2-28/+62
IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_TOS.2const: Tweak after splitAlejandro Colomar1-3/+10
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_TOS}.2const: Split IP_TOS from IPPROTO_IP(2const)Alejandro Colomar2-29/+65
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_ROUTER_ALERT.2const: Tweak after splitAlejandro Colomar1-8/+11
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_ROUTER_ALERT}.2const: Split IP_ROUTER_ALERT ↵Alejandro Colomar2-15/+49
from IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_RETOPTS.2const: Tweak after splitAlejandro Colomar1-3/+4
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_RETOPTS}.2const: Split IP_RETOPTS from ↵Alejandro Colomar2-10/+44
IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_RECVTTL.2const: Tweak after splitAlejandro Colomar1-8/+11
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_RECVTTL}.2const: Split IP_RECVTTL from ↵Alejandro Colomar2-19/+53
IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_RECVTOS.2const: Tweak after splitAlejandro Colomar1-6/+7
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_RECVTOS}.2const: Split IP_RECVTOS from ↵Alejandro Colomar2-12/+46
IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_RECVORIGDSTADDR.2const: Tweak after splitAlejandro Colomar1-4/+7
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_RECVORIGDSTADDR}.2const: Split ↵Alejandro Colomar2-15/+50
IP_RECVORIGDSTADDR from IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_RECVOPTS.2const: Tweak after splitAlejandro Colomar1-3/+5
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_RECVOPTS}.2const: Split IP_RECVOPTS from ↵Alejandro Colomar2-12/+46
IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_RECVERR.2const: Tweak after splitAlejandro Colomar1-57/+69
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_RECVERR}.2const: Split IP_RECVERR from ↵Alejandro Colomar2-141/+178
IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_PKTINFO.2const: Tweak after splitAlejandro Colomar1-26/+25
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_PKTINFO}.2const: Split IP_PKTINFO from ↵Alejandro Colomar2-79/+114
IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_PASSSEC.2const: Tweak after splitAlejandro Colomar1-27/+20
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_PASSSEC}.2const: Split IP_PASSSEC from ↵Alejandro Colomar2-41/+78
IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_OPTIONS.2const: Tweak after splitAlejandro Colomar1-7/+15
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_OPTIONS}.2const: Split IP_OPTIONS from ↵Alejandro Colomar2-31/+68
IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_NODEFRAG.2const: Tweak after splitAlejandro Colomar1-5/+6
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_NODEFRAG}.2const: Split IP_NODEFRAG from ↵Alejandro Colomar2-9/+43
IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_MULTICAST_TTL.2const: Tweak after splitAlejandro Colomar1-4/+5
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_MULTICAST_TTL}.2const: Split IP_MULTICAST_TTL ↵Alejandro Colomar2-8/+44
from IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_MULTICAST_LOOP.2const: Tweak after splitAlejandro Colomar1-2/+2
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_MULTICAST_LOOP}.2const: Split IP_MULTICAST_LOOP ↵Alejandro Colomar2-4/+40
from IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_MULTICAST_IF.2const: Tweak after splitAlejandro Colomar1-9/+7
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_MULTICAST_IF}.2const: Split IP_MULTICAST_IF ↵Alejandro Colomar2-24/+60
from IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_MULTICAST_ALL.2const: Tweak after splitAlejandro Colomar1-8/+11
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_MULTICAST_ALL}.2const: Split IP_MULTICAST_ALL ↵Alejandro Colomar2-11/+45
from IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_MTU_DISCOVER.2const: Tweak after splitAlejandro Colomar1-13/+18
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_MTU_DISCOVER}.2const: Split IP_MTU_DISCOVER ↵Alejandro Colomar2-87/+124
from IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_MTU.2const: Tweak after splitAlejandro Colomar1-6/+5
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_MTU}.2const: Split IP_MTU from IPPROTO_IP(2const)Alejandro Colomar2-13/+48
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_MSFILTER.2const: Tweak after splitAlejandro Colomar1-22/+15
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_MSFILTER}.2const: Split IP_MSFILTER from ↵Alejandro Colomar2-40/+76
IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_LOCAL_PORT_RANGE.2const: Tweak after splitAlejandro Colomar1-6/+7
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_LOCAL_PORT_RANGE}.2const: Split ↵Alejandro Colomar2-26/+63
IP_LOCAL_PORT_RANGE from IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_HDRINCL.2const: Tweak after splitAlejandro Colomar1-6/+9
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_HDRINCL}.2const: Split IP_HDRINCL from ↵Alejandro Colomar2-17/+51
IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_FREEBIND.2const: Tweak after splitAlejandro Colomar1-7/+12
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_FREEBIND}.2const: Split IP_FREEBIND from ↵Alejandro Colomar2-13/+49
IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_DROP_SOURCE_MEMBERSHIP.2const: Tweak after splitAlejandro Colomar1-11/+13
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_DROP_SOURCE_MEMBERSHIP}.2const: Split ↵Alejandro Colomar2-12/+48
IP_DROP_SOURCE_MEMBERSHIP from IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_DROP_MEMBERSHIP.2const: Tweak after splitAlejandro Colomar1-7/+8
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_DROP_MEMBERSHIP}.2const: Split ↵Alejandro Colomar2-9/+44
IP_DROP_MEMBERSHIP from IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_BLOCK_SOURCE.2const: Tweak after splitAlejandro Colomar1-6/+3
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_BLOCK_SOURCE}.2const: Split IP_BLOCK_SOURCE ↵Alejandro Colomar2-12/+48
from IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_BIND_ADDRESS_NO_PORT.2const: Tweak after splitAlejandro Colomar1-3/+3
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_BIND_ADDRESS_NO_PORT}.2const: Split ↵Alejandro Colomar2-10/+44
IP_BIND_ADDRESS_NO_PORT from IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_ADD_SOURCE_MEMBERSHIP}.2const, ↵Alejandro Colomar3-36/+58
man/man2type/ip_mreq_source.2type: Split struct ip_mreq_source from IP_ADD_SOURCE_MEMBERSHIP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_ADD_SOURCE_MEMBERSHIP.2const: Tweak after splitAlejandro Colomar1-30/+22
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_ADD_SOURCE_MEMBERSHIP}.2const: Split ↵Alejandro Colomar2-47/+86
IP_ADD_SOURCE_MEMBERSHIP from IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2type/ip_mreq.2type: Add link pageAlejandro Colomar1-0/+1
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_ADD_MEMBERSHIP}.2const, ↵Alejandro Colomar3-50/+74
man/man2type/ip_mreqn.2type: Split struct ip_mreqn from IP_ADD_MEMBERSHIP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/IP_ADD_MEMBERSHIP.2const: Tweak after splitAlejandro Colomar1-45/+40
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man2const/{IPPROTO_IP,IP_ADD_MEMBERSHIP}.2const: Split IP_ADD_MEMBERSHIP ↵Alejandro Colomar2-63/+96
from IPPROTO_IP(2const) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man5/proc_sys_net.5: Add reference to proc_sys_net_ipv4(5)Alejandro Colomar1-0/+4
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man5/proc_sys_net_ipv4.5: Tweak after splitAlejandro Colomar1-20/+20
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-25man/man7/ip.7, man/man2const/IPPROTO_IP.2const: Split IPPROTO_IP from ip(7)Alejandro Colomar2-941/+975
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-24man/man7/ip.7, man/man5/proc_sys_net_ipv4.5: Split /proc/sys/net/ipv4/ from ↵Alejandro Colomar2-158/+173
ip(7) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-24man/man3/: {str,wcs}n{cmp,len}(3): Remove array parameter length expressionsAlejandro Colomar4-8/+4
The arguments to these APIs may be shorter than that, as long as they are null terminated strings. Reported-by: Florian Weimer <fweimer@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-24man/man2/mremap.2: Fix incorrect reference to VM_MIXEDMAPLorenzo Stoakes1-1/+1
We actually disallow VM_DONTEXPAND and VM_PFNMAP for MREMAP_DONTUNMAP, the manpage incorrectly references VM_MIXEDMAP. Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Message-ID: <20251121081609.52462-1-lorenzo.stoakes@oracle.com> Cc: <linux-mm@kvack.org> Cc: <linux-kernel@vger.kernel.org> Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Jann Horn <jannh@google.com> Cc: Pedro Falcato <pfalcato@suse.de> Cc: Rik van Riel <riel@surriel.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-18man/man7/ip.7: srcfixAlejandro Colomar1-4/+7
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-18man/man7/ip.7: Clarify IP_PKTINFO's semantics depending on packet directionJakub Głogowski1-3/+14
For recvmsg(2), ipi_spec_dst is set by ipv4_pktinfo_prepare() to the result of fib_compute_sec_dst(). The latter was introduced in linux.git 35ebf65e851c6d97 ("ipv4: Create and use fib_compute_spec_dst() helper."). Quoting its commit message: > The specific destination is the host we direct unicast replies to. > Usually this is the original packet source address, but if we are > responding to a multicast or broadcast packet we have to use something > different. > > Specifically we must use the source address we would use if we were to > send a packet to the unicast source of the original packet. Experimentation seems to confirm that behavior. As for the note about ipi_spec_dst being on a different interface: - For unicast packets (for which ipi_spec_dst is the original destination address), I believe this is trivially true because Linux uses the weak host model (unless there's some interaction with RTCF_LOCAL that I'm missing). - For multicast/broadcast packets, fib_compute_sec_dst() only passes the original interface to the lookup in the context of L3M. In particular, the original implementation (cited above) set iif and oof to 0. Also, citing linux.git e7372197e15856ec ("net/ipv4: Set oif in fib_compute_spec_dst"), > If the device is not enslaved, oif is still 0 so no affect. It doesn't seem like using an address specifically from the interface the packet was received on was ever the intention. I've also confirmed this behavior (sending a multicast packet from another machine, whose IP I've routed to a dummy interface). I'm focusing on this because that's a misconception I've had before digging into the code - the sendmsg behavior explained in the same paragraph made me think ipi_spec_dst was the (primary?) address of ipi_ifindex. I think this is worth clarifying. I've made it explicit that ipi_addr isn't used by sendmsg because that's another possible misconception. The (first) extra comma in sendmsg's ipi_spec_dst's description is meant to emphasize that it's used as the local source address _and_ for the routing table lookup, as opposed to just affecting the routing table lookup. Stylistically it might be a bit weird but idk how to convey this better. Apart from the cited commits I was referencing the linux-6.17.7 tarball. __fib_validate_source (and the comment near it) might also be of interest to people trying to figure out what "specific destinations" are, exactly. Signed-off-by: Jakub Głogowski <not@dzwdz.net> Message-ID: <fb3980b64d1c827ad59726bb30761d735396e109.1763130571.git.not@dzwdz.net> Cc: <linux-kernel@vger.kernel.org> Cc: <linux-api@vger.kernel.org> Cc: Jan Engelhardt <ej@inai.de> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-11man/man3attr/gnu::warning.3attr: Add pageAlejandro Colomar1-0/+57
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-10CONTRIBUTING.d/ai: Add guidelines banning AI for contributingAlejandro Colomar1-0/+63
This policy is based on the Gentoo policy (see link below). However, I've modified our text to be more restrictive. Link: <https://wiki.gentoo.org/wiki/Project:Council/AI_policy> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Cc: Collin Funk <collin.funk1@gmail.com> Cc: Sam James <sam@gentoo.org> Cc: "G. Branden Robinson" <branden@debian.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-09man/man2/flock.2: Mention non-atomicity w.r.t closeAlexander Monakov1-0/+18
Ideally one should be able to use flock to synchronize with another process (or thread) closing that file, for instance before attempting to execve it (as execve of a file open for writing fails with ETXTBSY). Unfortunately, on Linux it is not reliable, because in the process of closing a file its locks are dropped before the refcounts of the file (as well as its underlying filesystem) are decremented, creating a race window where execve of the just-unlocked file sees it as if still open. Linux developers have indicated that it is not easy to fix, and the appropriate course of action for now is to document this limitation. Link: <https://lore.kernel.org/linux-fsdevel/68c99812-e933-ce93-17c0-3fe3ab01afb8@ispras.ru/> Signed-off-by: Alexander Monakov <amonakov@ispras.ru> Message-ID: <181d561860e52955b29fe388ad089bde4f67241a.1760627023.git.amonakov@ispras.ru> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-09man/man2/copy_file_range.2: glibc no longer provides fallback after 2.30Wes Gibbs1-4/+9
Closes: <https://bugzilla.kernel.org/show_bug.cgi?id=220489> Signed-off-by: Wes Gibbs <wg21908@gmail.com> Message-ID: <20251102000330.155591-1-wg21908@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-09man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about ↵Alejandro Colomar2-2/+37
.d_ino and .st_ino Suggested-by: Pali Rohár <pali@kernel.org> Co-authored-by: Pali Rohár <pali@kernel.org> Reviewed-by: Pali Rohár <pali@kernel.org> Co-authored-by: Jan Kara <jack@suse.cz> Reviewed-by: Jan Kara <jack@suse.cz> Cc: "Darrick J. Wong" <djwong@kernel.org> Cc: "G. Branden Robinson" <branden@debian.org> Cc: <linux-fsdevel@vger.kernel.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-09man/: Use '.member' notation for referring to struct/union membersAlejandro Colomar2-45/+46
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-09man/man2/madvise.2, man/man2const/PR_[GS]ET_THP_DISABLE.2const: document ↵Usama Arif3-14/+64
addition of PR_THP_DISABLE_EXCEPT_ADVISED PR_THP_DISABLE_EXCEPT_ADVISED extended PR_SET_THP_DISABLE to only provide THPs when advised. IOW, it allows individual processes to opt-out of THP = "always" into THP = "madvise", without affecting other workloads on the system. The series has been merged in [1]. Before [1], the following 2 calls were allowed with PR_SET_THP_DISABLE: prctl(PR_SET_THP_DISABLE, 0, 0, 0, 0); // reset THP setting. prctl(PR_SET_THP_DISABLE, 1, 0, 0, 0); // disable THPs completely. Now in addition to the 2 calls above, you can do: // disable THPs except madvise. prctl(PR_SET_THP_DISABLE, 1, PR_THP_DISABLE_EXCEPT_ADVISED, 0, 0); This patch documents the changes introduced due to the addition of PR_THP_DISABLE_EXCEPT_ADVISED flag: - PR_GET_THP_DISABLE returns a value whose bits indicate how THP-disable is configured for the calling thread (with or without PR_THP_DISABLE_EXCEPT_ADVISED). - PR_SET_THP_DISABLE now uses arg3 to specify whether to disable THP completely for the process, or disable except madvise (PR_THP_DISABLE_EXCEPT_ADVISED). Link: [1] <https://github.com/torvalds/linux/commit/9dc21bbd62edeae6f63e6f25e1edb7167452457b> Signed-off-by: Usama Arif <usamaarif642@gmail.com> Message-ID: <20251105134811.3170745-1-usamaarif642@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-09src/bin/grepc: Remove unnecessary 'sort|uniq' callAlejandro Colomar1-6/+0
This was necessary when we used one pcre2grep(1) call per regex. but long ago we switched to a single pcre2grep(1) call for all regexes, which only prints each file once, and thus we don't need uniq(1). Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-09src/bin/grepc, man/man1/grepc.1: -r: Remove flagAlejandro Colomar2-9/+2
Colorizing is imperfect, so don't do it. Let the user colorize it by piping to grep(1), if needed. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06etc/cpplint/cpplint.cfg: Ignore build/include_what_you_useAlejandro Colomar1-2/+1
We already run iwyu(1) on a separate target (lint-c-iwyu). Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/, man/man1/grepc{,_c}.1: Various improvements to the scripts; mainly ↵Alejandro Colomar10-321/+461
grepc(1) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: Use non-capturing groups where possibleAlejandro Colomar1-4/+4
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -te, -tue: Reuse grepc_c_t_sue_decl_()Alejandro Colomar1-4/+3
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -tt: Add support for enums with underlying typeAlejandro Colomar1-2/+2
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -tt, -tut: Reuse codeAlejandro Colomar1-2/+3
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -tt: Remove negative lookaheadAlejandro Colomar1-1/+1
It was useful when we had separate calls to pcre2grep(1) for each pattern, but now that we call it once, it's fine to have overlapping regexes. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -tut: Merge grepc_c_ut_su() and grepc_c_ut_td_su()Alejandro Colomar1-8/+2
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: Split grepc_c_body_() and grepc_c_u_body_()Alejandro Colomar1-11/+12
grepc_c_u_body_() consumes a lot of resources unnecessarily. This is especially true within grepc_c_t_td_braced(), which was crashing with relatively small code. The reason is that grepc_c_t_td_braced() searches for code where the identifier is last, so it needs to store a lot of code just in case. For that, an optimized grepc_c_body_() is more appropriate. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -tt, -tut: Reuse grepc_c_body_()Alejandro Colomar1-7/+7
In the last case, it removes part of the regex, but I believe that wasn't necessary. Also, while at this, make the trailing of the regexes to be consistently '[^;];', which is simpler, and seems to work just fine. If we ever see some false positives or negatives with this regex, we should fix them all at once, and maybe put them in a helper function. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -tt, -tut: Split regexesAlejandro Colomar1-4/+12
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -te, -tue: Add support for enums with underlying typeAlejandro Colomar1-1/+1
This adds support for: enum : int { X }; Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -te, -tue: Reuse code from function bodyAlejandro Colomar1-7/+9
A function body and an enum body are quite similar. The same regex works for both. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -te, -tue: Reuse codeAlejandro Colomar1-2/+5
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -tum: Split regexes for uses within function-like macros ↵Alejandro Colomar1-5/+10
and other macros Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -tum: Merge grepc_c_m_repl_() and grepc_c_um_repl_()Alejandro Colomar1-5/+4
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -tum: Split regex part for the replacement listAlejandro Colomar1-1/+4
While splitting, improve the regex part in two ways: - Use a non-capturing group. This improves performance. - Use negative lookahead instead of '[^\\]$'. This allows matching a macro where the searched identifier is the last thing in the replacement list. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -tum: Reuse grepc_c_m_decl_()Alejandro Colomar1-1/+2
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -tm: Split regexes, and reuse codeAlejandro Colomar1-2/+12
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: Organize regex parts togetherAlejandro Colomar1-2/+4
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: Rename grepc_c_uf_body_() => grepc_c_f_body_()Alejandro Colomar1-5/+5
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: Use grepc_c_uf_body_() to replace grepc_c_f_body_()Alejandro Colomar1-4/+3
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -tuf: Reuse grepc_c_uf_body_()Alejandro Colomar1-1/+2
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -tuf: Split regex for the function bodyAlejandro Colomar1-1/+3
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -tuf: Fix regexAlejandro Colomar1-1/+1
Fixes: 91c6563acf5e (2025-10-29; "grepc, grepc.1: Add -tu to search for uses") Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -tuf: Reuse grepc_c_fld_decl_()Alejandro Colomar1-1/+2
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -tfld: Split regexAlejandro Colomar1-1/+4
This will be reused for -tuf. I copied '[\w\s,;[\]*\?:+-]*\)' from grepc_c_f_params_(). Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -tfd: Split regex for the function bodyAlejandro Colomar1-1/+3
This regex part will be reused by other regexes. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -tflp: Simplify implementationAlejandro Colomar1-1/+1
This reuses the regex used by -tfp. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -tf: These can appear in a parameter list: '+', '-', '?', ':'Alejandro Colomar1-1/+1
This adds support for function declarators such as: int main(int argc, char *argv[argc + 1]); char * seprintf(char dst[], const char end[]; char dst[dst ? end - dst : 0], const char end[0], const char *restrict fmt, ...); Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: -tf: Use a named capturing groupAlejandro Colomar1-1/+1
This allows $identifier to contain capturing groups. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06src/bin/grepc_c: Split regexAlejandro Colomar1-1/+5
The regex for a function declarator is too complex. Split it into helper functions that prints the parts of the regex, so that each one is easier to understand. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-06share/mk/: $SHELLCHECKFLAGS: Disable SC2028Alejandro Colomar1-1/+3
It's known that echo(1) doesn't expand anything. No need to warn. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-05src/bin/grepc_*: Use echo(1) instead of printf(1) where possibleAlejandro Colomar2-20/+20
echo(1) is fine as long as the first argument doesn't start with a dash. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-05src/bin/grepc_c: srcfix (align code)Alejandro Colomar1-3/+6
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-04src/bin/grepc: -r, -l: Don't color the output of -lAlejandro Colomar1-2/+1
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-04src/bin/grepc: -r: Simplify implementation, removing a conditionalAlejandro Colomar1-7/+3
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-04src/bin/grepc: -r: Reimplement with grep(1)Alejandro Colomar1-1/+1
With grep(1), we don't need to hard-code escape sequences. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-03src/bin/sortman: Fix portability issueAlejandro Colomar1-2/+2
POSIX allows blank characters before '!', but not after. Reported-by: <onf@disroot.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-03src/bin/grepc: -x: Simplify implementationAlejandro Colomar1-21/+3
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-03man/man1/grepc{,_c}.1: Split documentation into a manual page for the driverAlejandro Colomar2-102/+157
I've left grepc_mk undocumented for the moment, as it's still not as stable as the C driver. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-03src/bin/grepc{,_c,_mk}: Align code after splitAlejandro Colomar3-113/+113
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-03src/bin/grepc{,_c,_mk}: Split grepc(1) into helper programsAlejandro Colomar3-158/+221
These programs print the PCRE2 patterns used by grepc(1). This allows easily implementing different drivers for parsing different languages. It also allows easily using pcre2grep(1) in cases where grepc(1) might be limited; for example, searching in non-regular files, or passing other flags that grepc(1) doesn't pass to pcre2grep(1). Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-02src/bin/: Disable pathname expansionAlejandro Colomar4-4/+4
We don't use globs within these scripts, so disable them, for safety reasons. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-02src/bin/grepc: Add missing quotesAlejandro Colomar1-1/+1
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-02man/man1/grepc.1: SEE ALSO: Fix referencesAlejandro Colomar1-2/+2
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-02man/man1/grepc.1: ffixAlejandro Colomar1-2/+2
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-02src/bin/grepc: Handle xargs(1) errors properlyAlejandro Colomar1-8/+5
'xargs grep' is hard, because grep(1) exits with a status of 1 for no match, which is not an error, but xargs(1) takes that as an error, which is confused with other errors. This trick with sh(1) was suggested by Paul, and nicely solves this problem. We also need to change $opts to be a normal variable. We can't export bash array variables, and passing them to sh(1) -c is not great; escapes could be messed. It's more robust to use a normal variable. Link: <https://lists.gnu.org/archive/html/bug-grep/2025-10/msg00029.html> Suggested-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-02src/bin/grepc: Use the same error code as grep(1)Alejandro Colomar1-6/+9
Exit with 2 on error. If nothing matches, it's a success, and it exits with 0 normally. This is different from grep(1), but I don't know how to write the script to exit with 1 if nothing matches. This implementation may also ignore some xargs(1) errors. A future commit --with code suggested by Paul Eggert-- will fix this. Link: <https://software.codidact.com/posts/294883> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-11-02src/bin/grepc: Use if/then/fi instead of &&Alejandro Colomar1-24/+26
It will allow using 'set -Eeuo pipefail' and trap(1) ERR. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2025-10-31man/man1/grepc.1: EXAMPLES: Fix commandAlejandro Colomar1-1/+1
The output shows the line number, so it must have been called with -n. Signed-off-by: Alejandro Colomar <alx@kernel.org>