From: Rumen Bogdanovski on
Hi all,
I have a simple question:
I need to make a kernel module for a specific character device.
But I need to know which uid is reading and writing because the
data written and data read should be user specific. So will
sys_geteuid() do the job for me. Or simply how can I a
module know who is calling its read or write?

Thank you in advance.

Rumen
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Andreas Schwab on
Rumen Bogdanovski <rbogdanovski(a)gmail.com> writes:

> Or simply how can I a module know who is calling its read or write?

The current task is always (except in interrupt context) available in
current, and its euid is returned by current_euid().

Andreas.

--
Andreas Schwab, schwab(a)redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E
"And now for something completely different."
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/