mailing list of musl libc
 help / color / mirror / code / Atom feed
6da2d4f430ba73cc0e275fa6c3ca3c0fe4b76a9c blob 2234 bytes (raw)

 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
 
#include <signal.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>

int str2sig(const char *restrict str, int *restrict pnum)
{
	errno = 0;
	long signum = strtol(str, NULL, 10);
	if(errno == 0 && signum < _NSIG)
	{
		*pnum = signum;
		return 0;
	}

	if (
		strncmp(str, "RTMIN+", 6) == 0
		|| strncmp(str, "RTMAX-", 6) == 0
	)
	{
		errno = 0;
		long sigrt = strtol(str+6, NULL, 10);
		if(errno != 0 || sigrt < 1 || sigrt > SIGRTMAX - SIGRTMIN) return -1;

		*pnum = str[5] == '+' ? SIGRTMIN + sigrt : SIGRTMAX - sigrt;
		return 0;
	}

	int ret = -1;
	if(strcmp(str, "HUP") == 0) ret = SIGHUP;
	if(strcmp(str, "INT") == 0) ret = SIGINT;
	if(strcmp(str, "QUIT") == 0) ret = SIGQUIT;
	if(strcmp(str, "ILL") == 0) ret = SIGILL;
	if(strcmp(str, "TRAP") == 0) ret = SIGTRAP;
	if(strcmp(str, "ABRT") == 0) ret = SIGABRT;
	if(strcmp(str, "IOT") == 0) ret = SIGIOT;
	if(strcmp(str, "BUS") == 0) ret = SIGBUS;
	if(strcmp(str, "FPE") == 0) ret = SIGFPE;
	if(strcmp(str, "KILL") == 0) ret = SIGKILL;
	if(strcmp(str, "USR1") == 0) ret = SIGUSR1;
	if(strcmp(str, "SEGV") == 0) ret = SIGSEGV;
	if(strcmp(str, "USR2") == 0) ret = SIGUSR2;
	if(strcmp(str, "PIPE") == 0) ret = SIGPIPE;
	if(strcmp(str, "ALRM") == 0) ret = SIGALRM;
	if(strcmp(str, "TERM") == 0) ret = SIGTERM;
	if(strcmp(str, "STKFLT") == 0) ret = SIGSTKFLT;
	if(strcmp(str, "CHLD") == 0) ret = SIGCHLD;
	if(strcmp(str, "CONT") == 0) ret = SIGCONT;
	if(strcmp(str, "STOP") == 0) ret = SIGSTOP;
	if(strcmp(str, "TSTP") == 0) ret = SIGTSTP;
	if(strcmp(str, "TTIN") == 0) ret = SIGTTIN;
	if(strcmp(str, "TTOU") == 0) ret = SIGTTOU;
	if(strcmp(str, "URG") == 0) ret = SIGURG;
	if(strcmp(str, "XCPU") == 0) ret = SIGXCPU;
	if(strcmp(str, "XFSZ") == 0) ret = SIGXFSZ;
	if(strcmp(str, "VTALRM") == 0) ret = SIGVTALRM;
	if(strcmp(str, "PROF") == 0) ret = SIGPROF;
	if(strcmp(str, "WINCH") == 0) ret = SIGWINCH;
	if(strcmp(str, "IO") == 0) ret = SIGIO;
	if(strcmp(str, "POLL") == 0) ret = SIGPOLL;
	if(strcmp(str, "PWR") == 0) ret = SIGPWR;
	if(strcmp(str, "SYS") == 0) ret = SIGSYS;
	if(strcmp(str, "UNUSED") == 0) ret = SIGUNUSED;

	if(strcmp(str, "RTMIN") == 0) ret = SIGRTMIN;
	if(strcmp(str, "RTMAX") == 0) ret = SIGRTMAX;

	if(ret == -1) return -1;

	*pnum = ret;
	return 0;
}
debug log:

solving 6da2d4f4 ...
found 6da2d4f4 in https://inbox.vuxu.org/musl/20240804124145.30659-2-contact@hacktivis.me/

applying [1/1] https://inbox.vuxu.org/musl/20240804124145.30659-2-contact@hacktivis.me/
diff --git a/src/signal/str2sig.c b/src/signal/str2sig.c
new file mode 100644
index 00000000..6da2d4f4

Checking patch src/signal/str2sig.c...
Applied patch src/signal/str2sig.c cleanly.

index at:
100644 6da2d4f430ba73cc0e275fa6c3ca3c0fe4b76a9c	src/signal/str2sig.c

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).