1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" Copyright 1995 James R. Van Zandt <jrv@vanzandt.mv.com>
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" Changed Tue Sep 19 01:49:29 1995, aeb: moved from man2 to man3
26 .\" added ref to /etc/utmp, added BUGS section, etc.
27 .\" modified 2003 Walter Harms, aeb - added getlogin_r, note on stdin use
29 .\" Japanese Version Copyright (c) 1998 NAKANO Takeo all rights reserved.
30 .\" Translated 1998-03-01, NAKANO Takeo <nakano@apm.seikei.ac.jp>
31 .\" Updated & Modified 1999-08-21, NAKANO Takeo <nakano@apm.seikei.ac.jp>
32 .\" Updated & Modified 2005-03-18, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
34 .TH GETLOGIN 3 2008-06-29 "GNU" "Linux Programmer's Manual"
36 getlogin, getlogin_r, cuserid \- ¥æ¡¼¥¶¡¼Ì¾¤ò¼èÆÀ¤¹¤ë
38 .B #include <unistd.h>
40 .B "char *getlogin(void);"
42 .BI "int getlogin_r(char *" buf ", size_t " bufsize );
46 .BI "char *cuserid(char *" string );
49 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
50 .RB ( feature_test_macros (7)
55 _REENTRANT || _POSIX_C_SOURCE\ >=\ 199506L
61 ¤Ï¡¢¸½ºß¤Î¥×¥í¥»¥¹¤ÎÀ©¸æüËö¤Ë¥í¥°¥¤¥ó¤·¤Æ¤¤¤ë¥æ¡¼¥¶¡¼Ì¾¤Îʸ»úÎó¤Ø¤Î
62 ¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£¥æ¡¼¥¶¡¼Ì¾¤¬·èÄê¤Ç¤¤Ê¤¤¾ì¹ç¤Ï null ¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
63 ʸ»úÎó¤ÏÀÅŪÎΰè¤Ë³ä¤êÅö¤Æ¤é¤ì¤Æ¤ª¤ê¡¢¤³¤Î¸å¤Ç¤³¤Î´Ø¿ô¤ä
65 ¤¬¸Æ¤Ó½Ð¤µ¤ì¤¿ºÝ¤Ë¾å½ñ¤¤µ¤ì¤ë¤³¤È¤¬¤¢¤ë¡£
68 ¤Ï¡¢¾åµ¤ÎƱ¤¸¥æ¡¼¥¶Ì¾¤ò¡¢Â礤µ
75 ¤Ï¡¢¸½ºß¤Î¥×¥í¥»¥¹¤Î¼Â¸ú¥æ¡¼¥¶¡¼ID ¤ËÂбþ¤¹¤ë¥æ¡¼¥¶¡¼Ì¾¤Î
76 ʸ»úÎó¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
77 \fIstring\fP ¤¬ null ¥Ý¥¤¥ó¥¿°Ê³°¤Î¾ì¹ç¡¢\fIstring\fP ¤Ï¾¯¤Ê¤¯¤È¤â
78 \fBL_cuserid\fP ʸ»ú¤òÊÝ»ý¤Ç¤¤ëÇÛÎó¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
79 \fIstring\fP ¤¬ null ¥Ý¥¤¥ó¥¿¤Î¾ì¹ç¤Ë¤Ï¡¢ÀÅŪÎΰè¤ËÃÖ¤«¤ì¤¿Ê¸»úÎó¤Ø¤Î
80 ¥Ý¥¤¥ó¥¿¤¬ÊÖ¤µ¤ì¤ë¡£¤³¤Îʸ»úÎó¤ÏÀÅŪÎΰè¤Ë³ä¤êÅö¤Æ¤é¤ì¤Æ¤ª¤ê¡¢¸å¤Ç
83 ¤¬¸Æ¤Ó½Ð¤µ¤ì¤¿ºÝ¤Ë¾å½ñ¤¤µ¤ì¤ë¤³¤È¤¬¤¢¤ë¡£
85 ¥Þ¥¯¥í \fBL_cuserid\fP ¤Ï integer ¤ÎÄê¿ô¤Ç¡¢¥æ¡¼¥¶¡¼Ì¾¤òÊÝ»ý¤¹¤ë¤¿¤á¤Ë
86 ɬÍפÊÇÛÎó¤ÎŤµ¤ò¼¨¤¹¡£ \fBL_cuserid\fP ¤Ï \fBstdio.h\fP ¤ÇÀë¸À¤µ¤ì¤Æ
89 ¤³¤ì¤é¤Î´Ø¿ô¤ò»È¤¦¤È¡¢¥×¥í¥°¥é¥à¤ò¼Â¹Ô¤·¤Æ¤¤¤ë¥æ¡¼¥¶¡¼
92 ¤³¤Î¥»¥Ã¥·¥ç¥ó¤Ë¥í¥°¥¤¥ó¤·¤Æ¤¤¤ë¥æ¡¼¥¶¡¼
94 ¤òÌÀ³Î¤ËÆÃÄꤹ¤ë¤³¤È¤¬¤Ç¤¤ë
95 (¤¿¤À¤· set-user-ID ¥×¥í¥°¥é¥à¤Ç¤Ï¡¢¾õ¶·¤¬°ã¤¦¤³¤È¤â¤¢¤ë)¡£
97 ¤¿¤¤¤Æ¤¤¤ÎÌÜŪ¤Ç¤Ï¡¢¥æ¡¼¥¶¡¼¤ÎÆÃÄê¤Ë¤Ï´Ä¶ÊÑ¿ô \fBLOGNAME\fP ¤òÄ´¤Ù
98 ¤ë¤Û¤¦¤¬ÊØÍø¤Ç¤¢¤ë¡£LOGNAME ÊÑ¿ô¤Ï¥æ¡¼¥¶¡¼¤¬¼«Í³¤ËÀßÄê¤Ç¤¤ë¤Î¤Ç
99 ¤è¤ê½ÀÆð¤ÊÂбþ¤¬²Äǽ¤Ë¤Ê¤ë¡£
102 ¤ÏÀ®¸ù¤·¤¿¾ì¹ç¤Ï¥æ¡¼¥¶Ì¾¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤·¡¢¼ºÇÔ¤·¤¿¾ì¹ç¤Ï NULL ¤òÊÖ¤¹¡£
104 ¤ÏÀ®¸ù¤¹¤ë¤È 0 ¤òÊÖ¤·¡¢¼ºÇÔ¤¹¤ë¤È 0 °Ê³°¤òÊÖ¤¹¡£
106 POSIX ¤Ç¤Ï°Ê²¼¤Î¥¨¥é¡¼¤¬µ¬Äꤵ¤ì¤Æ¤¤¤ë:
109 ¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤¬¥ª¡¼¥×¥ó¤·¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¿ô¤¬¤¹¤Ç¤Ë¥×¥í¥»¥¹¤¢¤¿¤ê¤Î
113 ¥·¥¹¥Æ¥àÁ´ÂΤǥª¡¼¥×¥ó¤·¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¿ô¤¬¤¹¤Ç¤Ë¾å¸Â¤Ë㤷¤Æ¤¤¤ë¡£
116 ¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Ë¤ÏÀ©¸æüËö¤¬¤Ê¤¤¡£
120 (½ªÃ¼¤Î NULL ¥Ð¥¤¥È¤â´Þ¤á¤¿) ¥æ¡¼¥¶Ì¾¤ÎŤµ¤¬
124 Linux/glibc ¤Ë¤Ï°Ê²¼¤Î¥¨¥é¡¼¤â¤¢¤ë¡£
127 utmp ¥Õ¥¡¥¤¥ë¤ËÂбþ¤¹¤ë¥¨¥ó¥È¥ê¤¬¤Ê¤«¤Ã¤¿¡£
130 passwd ¹½Â¤ÂΤò³ä¤êÅö¤Æ¤ë¤Î¤Ë½½Ê¬¤Ê¥á¥â¥ê¤¬¤Ê¤¤¡£
133 ɸ½àÆþÎϤ¬Ã¼Ëö¤ò»²¾È¤·¤Æ¤¤¤Ê¤¤ (¡Ö¥Ð¥°¡×¤ÎÀá¤ò»²¾È)¡£
137 ¥Ñ¥¹¥ï¡¼¥É¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î¥Õ¥¡¥¤¥ë
140 (ÅÁÅýŪ¤Ë¤Ï \fI/etc/utmp\fP ¤¬»È¤ï¤ì¤Æ¤¤¤ë;
141 libc ¤ÎÃæ¤Ë¤Ï \fI/var/adm/utmp\fP ¤ò»È¤¦¤â¤Î¤â¤¢¤ë)
146 ¤Ï POSIX.1-2001 ¤Çµ¬Äꤵ¤ì¤Æ¤¤¤ë¡£
151 ¤³¤ì¤Ï¼Â¸ú¥æ¡¼¥¶¡¼ ID ¤Ç¤Ï¤Ê¤¯¡¢¼Â¥æ¡¼¥¶¡¼ ID ¤ò»ÈÍѤ¹¤ë¡£
153 ´Ø¿ô¤Ï 1988 ǯÈǤΠPOSIX ¤Ë¤Ï´Þ¤Þ¤ì¤Æ¤¤¤¿¤¬¡¢
154 1990 ǯÈǤǤϺï½ü¤µ¤ì¤¿¡£
155 SUSv2 ¤Ë¸ºß¤·¤¿¤¬¡¢POSIX.1-2001 ¤Çºï½ü¤µ¤ì¤¿¡£
162 ¥»¥Ã¥·¥ç¥ó¤ËÂбþ¤·¤¿¥æ¡¼¥¶Ì¾¤¬¤¢¤ë¡£À©¸æüËö¤¬¤Ê¤¤
163 ¥»¥Ã¥·¥ç¥ó¤Î¾ì¹ç¤Ç¤¢¤Ã¤Æ¤â¡¢Âбþ¤¹¤ë¥æ¡¼¥¶Ì¾¤¬¤¢¤ë¡£
167 ¤ò¤À¤Þ¤¹¤Î¤Ï¤½¤ì¤Û¤ÉÆñ¤·¤¤¤³¤È¤Ç¤Ï¤Ê¤¤¡£ÊÌ¤Î¥×¥í¥°¥é¥à¤¬ utmp ¥Õ¥¡¥¤¥ë¤ò
168 ²õ¤·¤Æ¤·¤Þ¤¦¤È¡¢Á´¤¯Æ°ºî¤·¤Ê¤¤¤³¤È¤â¤¢¤ë¡£¤Þ¤¿¥í¥°¥¤¥ó̾¤ÎºÇ½é¤Î 8 ʸ»ú
169 ¤·¤«ÊÖ¤µ¤Ê¤¤¤³¤È¤â¿¤¤¡£¤Þ¤¿¥×¥í¥°¥é¥à¤òÀ©¸æ¤·¤Æ¤¤¤ë tty ¤Ë
170 ¸½ºß¥í¥°¥¤¥ó¤·¤Æ¤¤¤ë¥æ¡¼¥¶¡¼¤Ï¡¢¥×¥í¥°¥é¥à¤ò¼Â¹Ô¤·¤¿
171 ¥æ¡¼¥¶¡¼¤Ç¤Ê¤¤¾ì¹ç¤â¤¢¤ë¡£
172 ¥»¥¥å¥ê¥Æ¥£¤ÎÍí¤àÍÑÅӤˤÏ
174 ¤òÍѤ¤¤ë¤Ù¤¤Ç¤Ï¤Ê¤¤¡£
176 glibc ¤Ï POSIX »ÅÍͤˤϽ¾¤Ã¤Æ¤ª¤é¤º¡¢
179 .I "ɸ½àÆþÎÏ (stdin)"
180 ¤ò»È¤¦¡£¤³¤ì¤Ï¥Ð¥°¤Ç¤¢¤ë¡£
181 (SunOS 5.8 ¤ä HP-UX 11.11 ¤ä FreeBSD 4.8 ¤È¤¤¤Ã¤¿Â¾¤ÎºÇ¶á¤Î¥·¥¹¥Æ¥à¤Ï¤¤¤º¤ì¤â¡¢
183 ¤¬¥ê¥À¥¤¥ì¥¯¥È¤µ¤ì¤¿¾ì¹ç¤Ç¤â¥í¥°¥¤¥ó̾¤òÊÖ¤¹¡£)
186 ¤¬²¿¤ò¹Ô¤Ã¤Æ¤¤¤ë¤Î¤«¡¢¼ÂºÝ¤Î¤È¤³¤í¤òÃΤäƤ¤¤ë¼Ô¤Ïï¤â¤¤¤Ê¤¤;
187 °Ü¿¢À¤¬µá¤á¤é¤ì¤ë¥×¥í¥°¥é¥à¤Ç¤Ï
190 ¤È¤¤¤¦¤«¤É¤ó¤Ê¥×¥í¥°¥é¥à¤Ç¤â»È¤¦¤Ù¤¤Ç¤Ï¤Ê¤¤:
192 .I getpwuid(geteuid())
194 (¤³¤ì¤¬°Õ¿Þ¤·¤Æ¤¤¤ë¤³¤È¤Ê¤é¤Ð¡¢¤À¤¬)¡£