User: Password:
|
|
Subscribe / Log in / New account

kcmp vs strcmp convention

kcmp vs strcmp convention

Posted Feb 2, 2012 15:16 UTC (Thu) by jnareb (subscriber, #46500)
Parent article: Preparing for user-space checkpoint/restore

Why not return -1 if "less" and 1 if "greater", just like strcmp (and what e.g. qsort expect from comparison function), instead of 1 and 2?


(Log in to post comments)

kcmp vs strcmp convention

Posted Feb 2, 2012 16:05 UTC (Thu) by cesarb (subscriber, #6266) [Link]

This is a system call.

In a system call, values between -1 and -4095 (inclusive) are reserved for errors, with values from errno.h. In particular, -1 means EPERM on x86.


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds