File: sockatmark.3

package info (click to toggle)
manpages-ja 0.5.0.0.20061115-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 19,788 kB
  • ctags: 4
  • sloc: sh: 13,215; perl: 157; makefile: 117
file content (122 lines) | stat: -rw-r--r-- 3,298 bytes parent folder | download
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
.\" Copyright (c) 2006, Michael Kerrisk (mtk-manpages@gmx.net)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date.  The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Japanese Version Copyright (c) 2006 Yuichi SATO
.\"         all rights reserved.
.\" Translated 2006-08-01 by Yuichi SATO <ysato444@yahoo.co.jp>, LDP v2.36
.\"
.TH SOCKATMARK 3 2006-04-24 "Linux" "Linux Programmer's Manual"
.SH ̾
sockatmark \- ɤΥåȤӰ賰 (out-of-band) ޡդƤ뤫Ĵ٤
.SH 
.B #include <sys/socket.h>
.sp
.BI "int sockatmark(int " fd );
.SH 
.BR sockatmark ()
ϥեǥץ
.I fd
ǻȤ륽åȤӰ賰ޡդƤ뤫ݤ֤
åȤ˥ޡդƤϡ1 ֤롣
åȤ˥ޡդƤʤϡ0 ֤롣
δؿӰ賰ޡʤ
.SH ֤
.BR sockatmark ()
θƤӽФ硢åȤӰ賰ޡ
դƤ 1 ֤դƤʤ 0 ֤
顼ξ \-1 ֤졢顼ɽ \fIerrno\fP ꤵ롣
.SH 顼
.TP
.B EBADF
.I fd
ͭʥեǥץǤʤ
.TP
.B EINVAL
.\" POSIX.1 says ENOTTY for this case
.I fd 

.BR sockatmark ()
ŬѤǤʤեǥץǤ롣
.SH 
.BR sockatmark ()
 1 ֤硢Ӱ賰ǡ
.B MSG_OOB
.BR recv (2)
ɤ߹ळȤǤ롣

Ӱ賰ǡϡĤΥȥ꡼ॽåȥץȥǤ
ݡȤƤʤ

.BR sockatmark ()
 SIGURG ʥΥϥɥ餫˸ƤӽФȤǤ롣

.BR sockatmark ()

.B SIOCATMARK 
.BR ioctl ()
ȤäƼƤ롣
.SH 
POSIX.1-2001
.SH С
.BR sockatmark () 
 glibc С 2.2.4 ɲä줿
.SH Х
glibc 2.4 ΥСǤϡ
.BR sockatmark () 
ưʤ
.SH 
ʲΥɤϡSIGURG ʥä
ޡޤǤƤΥǡɤ߹ (˴)
ޡ줿ǡΥХȤɤ߹Τ˻ѤǤ롣
.nf

    char buf[BUF_LEN];
    char oobdata;
    int atmark, s;

    for (;;) {
        atmark = sockatmark(fd);
        if (atmark == \-1) {
            perror("sockatmark");
            break;
        } 
	
        if (atmark)
            break;
        
        s = read(fd, buf, BUF_LEN) <= 0);
        if (s == -1)
            perror("read");
        if (s <= 0) 
            break;
    }
    
    if (atmark == 1) {
        if (recv(fd, &oobdata, 1, MSG_OOB) == \-1) {
            perror("recv");
            ...
        }
    }
.fi
.SH Ϣ
.BR fcntl (2),
.BR recv (2),
.BR send (2),
.BR tcp (7)