logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

setgid.3p (2942B)


  1. '\" et
  2. .TH SETGID "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. setgid
  12. \(em set-group-ID
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <unistd.h>
  17. .P
  18. int setgid(gid_t \fIgid\fP);
  19. .fi
  20. .SH DESCRIPTION
  21. If the process has appropriate privileges,
  22. \fIsetgid\fR()
  23. shall set the real group ID, effective group ID, and the saved
  24. set-group-ID of the calling process to
  25. .IR gid .
  26. .P
  27. If the process does not have appropriate privileges, but
  28. .IR gid
  29. is equal to the real group ID or the saved set-group-ID,
  30. \fIsetgid\fR()
  31. shall set the effective group ID to
  32. .IR gid ;
  33. the real group ID and saved set-group-ID shall remain unchanged.
  34. .P
  35. The
  36. \fIsetgid\fR()
  37. function shall not affect the supplementary group list in any way.
  38. .P
  39. Any supplementary group IDs of the calling process shall remain
  40. unchanged.
  41. .SH "RETURN VALUE"
  42. Upon successful completion, 0 is returned. Otherwise, \-1 shall be
  43. returned and
  44. .IR errno
  45. set to indicate the error.
  46. .SH ERRORS
  47. The
  48. \fIsetgid\fR()
  49. function shall fail if:
  50. .TP
  51. .BR EINVAL
  52. The value of the
  53. .IR gid
  54. argument is invalid and is not supported by the implementation.
  55. .TP
  56. .BR EPERM
  57. The process does not have appropriate privileges and
  58. .IR gid
  59. does not match the real group ID or the saved set-group-ID.
  60. .LP
  61. .IR "The following sections are informative."
  62. .SH EXAMPLES
  63. None.
  64. .SH "APPLICATION USAGE"
  65. None.
  66. .SH RATIONALE
  67. Refer to the RATIONALE section in
  68. .IR "\fIsetuid\fR\^(\|)".
  69. .SH "FUTURE DIRECTIONS"
  70. None.
  71. .SH "SEE ALSO"
  72. .IR "\fIexec\fR\^",
  73. .IR "\fIgetegid\fR\^(\|)",
  74. .IR "\fIgeteuid\fR\^(\|)",
  75. .IR "\fIgetgid\fR\^(\|)",
  76. .IR "\fIgetuid\fR\^(\|)",
  77. .IR "\fIsetegid\fR\^(\|)",
  78. .IR "\fIseteuid\fR\^(\|)",
  79. .IR "\fIsetregid\fR\^(\|)",
  80. .IR "\fIsetreuid\fR\^(\|)",
  81. .IR "\fIsetuid\fR\^(\|)"
  82. .P
  83. The Base Definitions volume of POSIX.1\(hy2017,
  84. .IR "\fB<sys_types.h>\fP",
  85. .IR "\fB<unistd.h>\fP"
  86. .\"
  87. .SH COPYRIGHT
  88. Portions of this text are reprinted and reproduced in electronic form
  89. from IEEE Std 1003.1-2017, Standard for Information Technology
  90. -- Portable Operating System Interface (POSIX), The Open Group Base
  91. Specifications Issue 7, 2018 Edition,
  92. Copyright (C) 2018 by the Institute of
  93. Electrical and Electronics Engineers, Inc and The Open Group.
  94. In the event of any discrepancy between this version and the original IEEE and
  95. The Open Group Standard, the original IEEE and The Open Group Standard
  96. is the referee document. The original Standard can be obtained online at
  97. http://www.opengroup.org/unix/online.html .
  98. .PP
  99. Any typographical or formatting errors that appear
  100. in this page are most likely
  101. to have been introduced during the conversion of the source files to
  102. man page format. To report such errors, see
  103. https://www.kernel.org/doc/man-pages/reporting_bugs.html .