.\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
.\" Added notes on capability requirements
.\"
-.TH SETFSGID 2 2013-08-08 "Linux" "Linux Programmer's Manual"
+.TH SETFSGID 2 2010-11-22 "Linux" "Linux Programmer's Manual"
.SH NAME
-setfsgid \- set group identity used for filesystem checks
+setfsgid \- set group identity used for file system checks
.SH SYNOPSIS
-.B #include <sys/fsuid.h>
+.B #include <unistd.h>
+/* glibc uses <sys/fsuid.h> */
.sp
.BI "int setfsgid(uid_t " fsgid );
.SH DESCRIPTION
The system call
.BR setfsgid ()
-changes the value of the caller's filesystem group ID\(emthe
-group ID that the Linux kernel uses to check for all accesses
-to the filesystem.
+sets the group ID that the Linux kernel uses to check for all accesses
+to the file system.
Normally, the value of
-the filesystem group ID
+.I fsgid
will shadow the value of the effective group ID.
In fact, whenever the
effective group ID is changed,
-the filesystem group ID
+.I fsgid
will also be changed to the new value of the effective group ID.
Explicit calls to
.BR setfsgid ()
will succeed only if the caller is the superuser or if
.I fsgid
-matches either the caller's real group ID, effective group ID,
-saved set-group-ID, or current the filesystem user ID.
+matches either the real group ID, effective group ID,
+saved set-group-ID, or the current value of
+.IR fsgid .
.SH RETURN VALUE
-On both success and failure,
-this call returns the previous filesystem group ID of the caller.
+On success, the previous value of
+.I fsgid
+is returned.
+On error, the current value of
+.I fsgid
+is returned.
.SH VERSIONS
This system call is present in Linux since version 1.2.
.\" This system call is present since Linux 1.1.44
Note that at the time this system call was introduced, a process
could send a signal to a process with the same effective user ID.
Today signal permission handling is slightly different.
-See
-.BR setfsuid (2)
-for a discussion of why the use of both
-.BR setfsuid (2)
-and
-.BR setfsgid ()
-is nowadays unneeded.
The original Linux
.BR setfsgid ()
.BR setfsgid ()
wrapper function transparently deals with the variation across kernel versions.
.SH BUGS
-No error indications of any kind are returned to the caller,
-and the fact that both successful and unsuccessful calls return
-the same value makes it impossible to directly determine
-whether the call succeeded or failed.
-Instead, the caller must resort to looking at the return value
-from a further call such as
-.IR setfsgid(\-1)
-(which will always fail), in order to determine if a preceding call to
-.BR setfsgid ()
-changed the filesystem group ID.
+No error messages of any kind are returned to the caller.
At the very
least,
.B EPERM