8

Out of: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html

It's always pretty clear why an errno code is named a particular way except for this one. How does SRCH relate to No such process?

  • Probably grep or pgrep returns it because of failure to search the process list. – cat Jan 31 '16 at 23:11
  • My IDE, Atom, returns ESRCH when searching the package list if there is no internet connection. Purely anecdotal, and probably on purpose rather than perchance. – cat Jan 31 '16 at 23:12
8

POSIX kill documents the "search" connotation:

[ESRCH]
No process or process group can be found corresponding to that specified by pid.

The previous issue (2004) gave in the rationale more information:

Some implementations provide semantic extensions to the kill() function when the absolute value of pid is greater than some maximum, or otherwise special, value. Negative values are a flag to kill(). Since most implementations return [ESRCH] in this case, this behavior is not included in this volume of IEEE Std 1003.1-2001, although a conforming implementation could provide such an extension.

2

The string ESRCH looks cryptic, but after looking at the other errors and their strings: (taken from http://pubs.opengroup.org/onlinepubs/9699919799/functions/kill.html)

  • [EINVAL] The value of the sig argument is an invalid or unsupported signal number.
  • [EPERM] The process does not have permission to send the signal to any receiving process.

Seems logical that E stands for error, INVAL for invalid and PERM for permission. In the same logical line, SRCH stands for search.

Error searching pid/pid group.

  • Welcome to U&L! I see that you've referenced the kill function and two other errors, but I don't yet see any supporting evidence for the Question: How does "SRCH" relate to "No such process"? – Jeff Schaller Aug 29 '18 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.