1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
|
.\" manҳȨ(C) 1999 Andi Kleen <ak@muc.de>.
.\" ĵĸҳ汾ҪȨ,һֲذheader,
.\" ϴĵ,ߺӵheader.
.\" $Id: unix.7,v 1.1.1.1 2000/12/27 12:25:09 BitBIRD Exp $
.TH UNIX 7 "199957" "Linux ֲҳ" "LinuxԱֲ"
.SH NAME(ƣ
unix, PF_UNIX, AF_UNIX, PF_LOCAL, AF_LOCAL \- ڱڲͨѶ֡
.SH SYNOPSIS()
.B #include <sys/socket.h>
.br
.B #include <sys/un.h>
.IB unix_socket " = socket(PF_UNIX, type, 0);"
.br
.IB error " = socketpair(PF_UNIX, type, 0, int *" sv ");"
.SH DESCRIPTION()
.B PF_UNIX
(Ҳ
.B PF_LOCAL )
ͬһϵṩЧĽ̼ͨѶ.Unix ֿ(
.BR socketpair (2)
), Ҳļ.
Linux ֧һֳֿռ, Ƕļϵͳ.
Ч:
.B SOCK_STREAM
,
.B SOCK_DGRAM
ݱ,ԱϢ.
Unix ǿɿ,Ҳݱ.
Unix ְ֧ļ̵߽֤Ϊݱĸ
ݸ̣
.SH ADDRESS FORMAT(ַʽ)
unix ַΪļϵͳеһļ
ֿ߳ռеһַ.
.BR socketpair (2)
.ڷ,Ŀַʹ
.BR connect (2)
.
صַʹ
.BR bind (2)
.
϶ûһصַʱ,
ԶڳֿռһΨһĵַ.
.RS
.nf
#define UNIX_PATH_MAX 108
.ta 4n 17n 42n
struct sockaddr_un {
sa_family_t sun_family; /* AF_UNIX */
char sun_path[UNIX_PATH_MAX]; /* · */
};
.fi
.RE
.B sun_family
ǰ
.BR AF_UNIX .
.B sun_path
βļϵͳе·.
.B sun_path
Կֽڿͷ,ָ Unix Эģάijֿռ.
ڴֿռеĵַ
.BR sun_path
еʣֽڸ.
עֿռֶǿֹ.
.SH SOCKET OPTIONS(ѡ)
ʷԭ, Щѡͨ SOL_SOCKET ȷ,
ʹ PF_UNIX ָ.
ǿ
.BR setsockopt (2)
.
ָͨ SOL_SOCKET Ϊ
.BR getsockopt (2)
ȡ.
.B SO_PASSCRED
ս̸Ϣ͵֤.
˸ѡδʱ,
ԶһֿռΨһ.
ֵΪһʶ.
.SH ANCILLARY MESSAGES(Ϣ)
ʷԭ,ЩϢͨ SOL_SOCKET ȷ,
ʹ PF_UNIX ָ.
Ҫ, ýṹ
.B cmsghdr
.B cmsg_level
ֶΪ SOL_SOCKET,
.B cmsg_type
ֶΪ. ҪøϢ, ο
.BR cmsg (3).
.TP
.B SCM_RIGHTS
Ϊ̷ͻһ״ļ.
ݲְһļ.
ѴļЧ
.BR dup (2)
һ.
.TP
.B SCM_CREDENTIALS
ͻ߽ unix ֤.
֤.֤
.B struct ucred
Ϣʽͣ
.RS
.nf
.ta 4n 11n 17n
struct ucred {
pid_t pid; /* ͽ̵Ḻ̌ʶ */
uid_t uid; /* ͽ̵ûʶ */
gid_t gid; /* ͽ̵ʶ */
};
.fi
.RE
ȷ֤ں˼.
һЧûʶ 0 Ľֵָ
ƥֵ.߱ȷḺ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ϵͳֶʱ,
ܻͨӲļϵͳ.
ҪøϢ,ɲμʵֲҳ.
.SH SEE ALSO()
.BR recvmsg (2),
.BR sendmsg (2),
.BR socket (2),
.BR socket (2),
.BR socketpair (2),
.BR cmsg (3),
.BR socket (7)
.SH CREDITS(βע)
manҳAndi Kleen.
.SH "[İά]"
riser Email: boomer@ccienet.com
.SH "[ݸ]"
2000/11/09
.SH "[йLinux̳manֲҳƻ]"
.TP
.BI www.cmpp.net/
|