I can use stat() to figure out what permissions the owner, group, or others have and I can use geteuid() and getpwuid() to get the user name of the process. I'm not quite sure how to get the groups a user belongs to without a system call though.
Even knowing how to get the groups, it seems like a lot of work to integrate all of this information. Is there an easier way?