MCPcopy Create free account
hub / github.com/F-Stack/f-stack / kern_sigqueue

Function kern_sigqueue

freebsd/kern/kern_sig.c:1906–1938  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1904}
1905
1906int
1907kern_sigqueue(struct thread *td, pid_t pid, int signum, union sigval *value)
1908{
1909 ksiginfo_t ksi;
1910 struct proc *p;
1911 int error;
1912
1913 if ((u_int)signum > _SIG_MAXSIG)
1914 return (EINVAL);
1915
1916 /*
1917 * Specification says sigqueue can only send signal to
1918 * single process.
1919 */
1920 if (pid <= 0)
1921 return (EINVAL);
1922
1923 if ((p = pfind_any(pid)) == NULL)
1924 return (ESRCH);
1925 error = p_cansignal(td, p, signum);
1926 if (error == 0 && signum != 0) {
1927 ksiginfo_init(&ksi);
1928 ksi.ksi_flags = KSI_SIGQ;
1929 ksi.ksi_signo = signum;
1930 ksi.ksi_code = SI_QUEUE;
1931 ksi.ksi_pid = td->td_proc->p_pid;
1932 ksi.ksi_uid = td->td_ucred->cr_ruid;
1933 ksi.ksi_value = *value;
1934 error = pksignal(p, ksi.ksi_signo, &ksi);
1935 }
1936 PROC_UNLOCK(p);
1937 return (error);
1938}
1939
1940/*
1941 * Send a signal to a process group.

Callers 1

sys_sigqueueFunction · 0.85

Calls 3

p_cansignalFunction · 0.85
pksignalFunction · 0.85
pfind_anyFunction · 0.70

Tested by

no test coverage detected