return negative number for unsigned long function in kernel

From: Chen, Dongliang
Date: Tue Mar 06 2007 - 11:35:56 EST


There are lots of functions in the Linux kernel that are declared as
unsigned long, but the return value is negative integer while error
occurred. An example of these functions is do_mmap_pgoff in mm/mmap.c,
which is defined as:

unsigned long do_mmap_pgoff(....)

In this function, it returns -ENODEV, -EPERM, -ENOMEM, -EINVAL, -EAGAIN,
-EACCESS depends on the error type. My question is how should the caller
perform error check based on the return value?


Please CC reply to me at chen.d@xxxxxxxxx


Thanks,

Dongliang Chen

Staff Engineer
EMS Technologies, Inc - Defense and Space Systems
660 Engineering Dr
Norcross, GA 30092
Tel: 770-263-9200 x 4379



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/