📄 getsockopt.3.man
字号:
'\" rtp.\" -*- nroff -*- vim: ft=nroff noautoindent nocindent nosmartindent.\".\" @(#) getsockopt.3.man,v 1.1.2.1 2004/05/16 02:35:34 brian Exp.\".\" =========================================================================.\".\" Copyright (C) 2001-2004 OpenSS7 Corporation <www.openss7.com>.\".\" All Rights Reserved..\".\" 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. The author(s) may not.\" have taken the same level of care in the production of this manual,.\" which is licensed free of charge, as they might when working.\" professionally..\" .\" Formatted or processed versions of this manual, if unaccompanied by.\" the source, must acknowledge the copyright and authors of this work..\".\" -------------------------------------------------------------------------.\".\" U.S. GOVERNMENT RESTRICTED RIGHTS. If you are licensing this Software.\" on behalf of the U.S. Government ("Government"), the following.\" provisions apply to you. If the Software is supplied by the Department.\" of Defense ("DoD"), it is classified as "Commercial Computer Software".\" under paragraph 252.227-7014 of the DoD Supplement to the Federal.\" Acquisition Regulations ("DFARS") (or any successor regulations) and the.\" Government is acquiring only the license rights granted herein (the.\" license rights customarily provided to non-Government users). If the.\" Software is supplied to any unit or agency of the Government other than.\" DoD, it is classified as "Restricted Computer Software" and the.\" Government's rights in the Software are defined in paragraph 52.227-19.\" of the Federal Acquisition Regulations ("FAR") (or any success.\" regulations) or, in the cases of NASA, in paragraph 18.52.227-86 of the.\" NASA Supplement to the FAR (or any successor regulations)..\".\" =========================================================================.\" .\" Commercial licensing and support of this software is available from.\" OpenSS7 Corporation at a fee. See http://www.openss7.com/.\" .\" =========================================================================.\".\" Last Modified 2004/05/16 02:35:34 by brian.\".\" =========================================================================.so strxnet.macros.R1bracket-label "\fR[\fB" "\fR]" "\fR, \fB"no-default-databasedatabase strxnet.refsaccumulatemove-punctuationabbreviate Ajoin-authors ", " ", " " and "et-al " et al" 2 3abbreviate-label-ranges ".."sort-adjacent-labels.R2.\".\".\".\".TH GETSOCKOPT 3 "2004/05/16 02:35:34" "strxnet-0_9_2-4" "Linux Fast-STREAMS Sockets Library".SH NAME.B getsockopt\- get the socket options.SH SYNOPSIS.PP.B #include <sys/socket.h>.HP.BI "int getsockopt(int " socket ", int " level ", int " option_name ", void *" option_value ", socklen_t *" option_len );.SH DESCRIPTION.PPThe.BR getsockopt ()function retrieves the value for the optionspecified by the.I option_nameargument for the socket specified bythe.I socketargument. If the size of the option value is greaterthan.IR option_len ,the value stored in the object pointed to by the.I option_valueargument will be silently truncated. Otherwise, theobject pointed to by the.I option_lenargument will be modified toindicate the actual length of the value..PPThe.I levelargument specifies the protocol level at which the optionresides. To retrieve options at the socket level, specify the.I levelargument as.BR SOL_SOCKET .To retrieve options at other levels, supplythe appropriate.I levelidentifier for the protocol controlling theoption. For example, to indicate that an option will be interpretedby the TCP (Transmission Control Protocol), set.I levelto.B IPPROTO_TCPas defined in the <netinet/in.h> header..PPThe socket in use may require the process to have appropriateprivileges to use the.BR getsockopt ()function..PPThe.I option_nameargument specifies a single option to be retrieved.It can be one of the following values defined in <sys/socket.h>:.TP.B SO_DEBUGReports whether debugging information is being recorded. Thisoption stores an.B intvalue. This is a boolean option..TP.B SO_ACCEPTCONNReports whether socket listening is enabled. This option storesan.B intvalue. This is a boolean option..TP.B SO_BROADCASTReports whether transmission of broadcast messages issupported, if this is supported by the protocol. This optionstores an.B intvalue. This is a boolean option..TP.B SO_REUSEADDRReports whether the rules used in validating addresses suppliedto.BR bind (3)should allow reuse of local addresses, if this issupported by the protocol. This option stores an.B intvalue.This is a boolean option..TP.B SO_KEEPALIVEReports whether connections are kept active with periodictransmission of messages, if this is supported by the protocol.If the connected socket fails to respond to these messages, theconnection is broken and processes writing to that socket arenotified with a.B SIGPIPEsignal. This option stores an.B intvalue.This is a boolean option..TP.B SO_LINGERReports whether the socket lingers on.BR close (2)if data ispresent. If.B SO_LINGERis set, the system blocks the processduring.BR close (2)until it can transmit the data or until theend of the interval indicated by the.I l_lingermember, whichevercomes first. If.B SO_LINGERis not specified, and.BR close (2)isissued, the system handles the call in a way that allows theprocess to continue as quickly as possible. This option storesa.B lingerstructure..TP.B SO_OOBINLINEReports whether the socket leaves received out-of-band data(data marked urgent) in line. This option stores an.B intvalue.This is a boolean option..TP.B SO_SNDBUFReports send buffer size information. This option stores an.B intvalue..TP.B SO_RCVBUFReports receive buffer size information. This option stores an.B intvalue..TP.B SO_ERRORReports information about error status and clears it. Thisoption stores an.B intvalue..TP.B SO_TYPEReports the socket type. This option stores an.B intvalue..TP.B SO_DONTROUTEReports whether outgoing messages bypass the standard routingfacilities. The destination must be on a directly-connectednetwork, and messages are directed to the appropriate networkinterface according to the destination address. The effect, ifany, of this option depends on what protocol is in use. Thisoption stores an.B intvalue. This is a boolean option..TP.B SO_RCVLOWATReports the minimum number of bytes to process for socket inputoperations. The default value for.B SO_RCVLOWATis 1. If.TP.B SO_RCVLOWAT is set to a larger value, blocking receive callsnormally wait until they have received the smaller of the lowwater mark value or the requested amount. (They may return lessthan the low water mark if an error occurs, a signal is caught,or the type of data next in the receive queue is different thanthat returned, e.g. out of band data). This option stores an.B intvalue. Note that not all implementations allow this optionto be retrieved..TP.B SO_RCVTIMEOReports the timeout value for input operations. This optionstores a.B timevalstructure with the number of seconds andmicroseconds specifying the limit on how long to wait for aninput operation to complete. If a receive operation has blockedfor this much time without receiving additional data, itreturns with a partial count or errno set to.RB [ EAGAIN ]or.RB [ EWOULDBLOCK ]if no data were received. The default for thisoption is zero, which indicates that a receive operation willnot time out. Note that not all implementations allow thisoption to be retrieved..TP.B SO_SNDLOWATReports the minimum number of bytes to process for socketoutput operations. Non-blocking output operations will processno data if flow control does not allow the smaller of the sendlow water mark value or the entire request to be processed.This option stores an.B intvalue. Note that not allimplementations allow this option to be retrieved..TP.B SO_SNDTIMEOReports the timeout value specifying the amount of time that anoutput function blocks because flow control prevents data frombeing sent. If a send operation has blocked for this time, itreturns with a partial count or with errno set to.RB [ EAGAIN ]or.RB [ EWOULDBLOCK ]if no data were sent. The default for this optionis zero, which indicates that a send operation will not timeout. The option stores a.B timevalstructure. Note that not allimplementations allow this option to be retrieved..PPFor boolean options, a zero value indicates that the option isdisabled and a non-zero value indicates that the option is enabled..PPOptions at other protocol levels vary in format and name..PPThe socket in use may require the process to have appropriateprivileges to use the.BR getsockopt ()function..SH CAVEATS.PPThis system call is implemented as a.B SIOCSOCKSYSIOCTL. See.BR socksys (4)for more information..SH "RETURN VALUE".PPUpon successful completion,.BR getsockopt ()returns 0. Otherwise, -1is returned and errno is set to indicate the error..SH ERRORS.PPThe.BR getsockopt ()function will fail if:.TP.RB [ EBADF ]The.I socketargument is not a valid file descriptor..TP.RB [ EFAULT ]The.I option_valueor.I option_lenparameter can not be accessed orwritten..TP.RB [ EINVAL ]The specified option is invalid at the specified socket.IR level ..TP.RB [ ENOPROTOOPT ]The option is not supported by the protocol..TP.RB [ ENOTSOCK ]The.I socketargument does not refer to a socket.The.BR getsockopt ()function may fail if:.TP.RB [ EACCES ]The calling process does not have the appropriate privileges..TP.RB [ EINVAL ]The socket has been shut down..TP.RB [ ENOBUFS ]Insufficient resources are available in the system to completethe call..TP.RB [ ENOSR ]There were insufficient.IR STREAMS (4)resources available for theoperation to complete..SH "SEE ALSO".PP.BR bind (3),.BR close (2),.BR endprotoent (2),.BR setsockopt (3),.BR socket (3),.BR <sys/socket.h> ..SH "CONFORMING TO".PPThe Open Group XNS Issue 5.2..[xns.].\".\".[$LIST$.].TI
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -