On Thu, Aug 10, 2023 at 02:51:37PM +0800, Junxian Huang wrote: > Hi all! > > I'm wondering if there is a clear rule for the usage of positive and > negative values of error codes. > > It seems that negative values are uniformly used in kernel space, but > both positive and negative values are used in user space. When should > positive values be used and when should negative values be used? We always use negative in the kernel Userspace is supposed to set errno and often return positive err codes But we have not done a good job there Jason