OSDN Git Service

2de07cf4e497d01a9e7c238f6c60214032299acf
[linuxjm/LDP_man-pages.git] / original / man3 / euidaccess.3
1 .\" Copyright (C) 2007 Michael Kerrisk <mtk.manpages@gmail.com>
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .TH EUIDACCESS 3 2013-09-25 "" "Linux Programmer's Manual"
26 .SH NAME
27 euidaccess, eaccess \- check effective user's permissions for a file
28 .SH SYNOPSIS
29 .nf
30 .BR "#define _GNU_SOURCE" "             /* See feature_test_macros(7) */"
31 .B #include <unistd.h>
32 .sp
33 .BI "int euidaccess(const char *" pathname ", int " mode );
34 .BI "int eaccess(const char *" pathname ", int " mode );
35 .fi
36 .SH DESCRIPTION
37 Like
38 .BR access (2),
39 .BR euidaccess ()
40 checks permissions and existence of the file identified by its argument
41 .IR pathname .
42 However, whereas
43 .BR access (2),
44 performs checks using the real user and group identifiers of the process,
45 .BR euidaccess ()
46 uses the effective identifiers.
47
48 .I mode
49 is a mask consisting of one or more of
50 .BR R_OK ", " W_OK ", " X_OK ", and " F_OK ,
51 with the same meanings as for
52 .BR access (2).
53
54 .BR eaccess ()
55 is a synonym for
56 .BR euidaccess (),
57 provided for compatibility with some other systems.
58 .SH RETURN VALUE
59 On success (all requested permissions granted), zero is returned.
60 On error (at least one bit in
61 .I mode
62 asked for a permission that is denied, or some other error occurred),
63 \-1 is returned, and
64 .I errno
65 is set appropriately.
66 .SH ERRORS
67 As for
68 .BR access (2).
69 .SH VERSIONS
70 The
71 .BR eaccess ()
72 function was added to glibc in version 2.4.
73 .SH ATTRIBUTES
74 .SS Multithreading (see pthreads(7))
75 The
76 .BR euidaccess ()
77 and
78 .BR eaccess ()
79 functions are thread-safe.
80 .SH CONFORMING TO
81 These functions are nonstandard.
82 Some other systems have an
83 .\" e.g., FreeBSD 6.1.
84 .BR eaccess ()
85 function.
86 .SH NOTES
87 .IR Warning :
88 Using this function to check a process's permissions on a file before
89 performing some operation based on that information leads to race conditions:
90 the file permissions may change between the two steps.
91 Generally, it is safer just to attempt the desired operation and handle
92 any permission error that occurs.
93
94 This function always dereferences symbolic links.
95 If you need to check the permissions on a symbolic link, use
96 .BR faccessat (2)
97 with the flags
98 .BR AT_EACCESS
99 and
100 .BR AT_SYMLINK_NOFOLLOW .
101 .SH SEE ALSO
102 .BR access (2),
103 .BR chmod (2),
104 .BR chown (2),
105 .BR faccessat (2),
106 .BR open (2),
107 .BR setgid (2),
108 .BR setuid (2),
109 .BR stat (2),
110 .BR credentials (7),
111 .BR path_resolution (7)
112 .SH COLOPHON
113 This page is part of release 3.64 of the Linux
114 .I man-pages
115 project.
116 A description of the project,
117 and information about reporting bugs,
118 can be found at
119 \%http://www.kernel.org/doc/man\-pages/.