⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 syscalls_17.html

📁 Linux系统调用
💻 HTML
📖 第 1 页 / 共 2 页
字号:
</PRE>
<P>
<VAR>rt_flags</VAR> is a or'ed combinaison of one or more of the following:
<P>
<DL COMPACT>
<DT><CODE>RTF_UP</CODE>
<DD>the route is usable.
<P>
<DT><CODE>RTF_GATEWAY</CODE>
<DD>the destination is a gateway.
<P>
<DT><CODE>RTF_HOST</CODE>
<DD>the entry is a host. (If this flag is not set, the entry is a net.)
</DL>
<P>
<PRE>
struct arpreq {
  struct sockaddr       arp_pa;         /* protocol address             */
  struct sockaddr       arp_ha;         /* hardware address             */
  int                   arp_flags;      /* flags                        */
};
</PRE>
<P>
The <CODE>arp_flags</CODE> member may be one or more or'ed values of the
following:
<P>
<DL COMPACT>
<DT><CODE>ATF_INUSE</CODE>
<DD>the entry is in use.
<P>
<DT><CODE>ATF_COM</CODE>
<DD>the entry is complete (ha is valid).
<P>
<DT><CODE>ATF_PERM</CODE>
<DD>the entry is permanent.
<P>
<DT><CODE>ATF_PUBL</CODE>
<DD>publish entry.
<P>
<DT><CODE>ATF_USETRAILERS</CODE>
<DD>has requested trailers.
</DL>
<P>
Here is the layout of the <CODE>ifconf</CODE> structure used to get the
configuration list:
<P>
<PRE>
struct ifconf {
        int     ifc_len;                        /* size of buffer       */
        union {
                caddr_t ifcu_buf;
                struct  ifreq *ifcu_req;
        } ifc_ifcu;
};
</PRE>
<P>
Here is the layout of the <CODE>ifreq</CODE> structure used to send/receive
interface data:
<P>
<PRE>
struct ifreq {
#define IFHWADDRLEN     6
#define IFNAMSIZ        16
    union {
        char    ifrn_name[IFNAMSIZ];            /* if name, e.g. "en0" */
        char    ifrn_hwaddr[IFHWADDRLEN];
    } ifr_ifrn;
    union {
        struct  sockaddr ifru_addr;
        struct  sockaddr ifru_dstaddr;
        struct  sockaddr ifru_broadaddr;
        struct  sockaddr ifru_netmask;
        short   ifru_flags;
        int     ifru_metric;
        int     ifru_mtu;
        caddr_t ifru_data;
    } ifr_ifru;
};
</PRE>
<P>
For terminal I/O, the following commands may be used:
<P>
<DL COMPACT>
<DT><CODE>TCGETS</CODE>
<DD>Gets the <CODE>termios</CODE> structure associated with the terminal.
<VAR>argp</VAR> points to a <CODE>termios</CODE> structure.
<P>
<DT><CODE>TCSETS</CODE>
<DD>Sets the <CODE>termios</CODE> structure associated with the terminal. The
change is immediate. <VAR>argp</VAR> points to a <CODE>termios</CODE> structure.
<P>
<DT><CODE>TCSETSW</CODE>
<DD>Same as <CODE>TCSETS</CODE> but wait until the output buffer is empty before
performing the change.
<P>
<DT><CODE>TCSETSF</CODE>
<DD>Same as <CODE>TCSETS</CODE> but wait until the output buffer is empty and
flushes the input buffer before performing the change.
<P>
<DT><CODE>TCGETA</CODE>
<DD>Gets the <CODE>termio</CODE> structure associated with the terminal.
<VAR>argp</VAR> points to a <CODE>termio</CODE> structure.
<P>
<DT><CODE>TCSETS</CODE>
<DD>Sets the <CODE>termio</CODE> structure associated with the terminal. The
change is immediate. <VAR>argp</VAR> points to a <CODE>termio</CODE> structure.
<P>
<DT><CODE>TCSETAW</CODE>
<DD>Same as <CODE>TCSETA</CODE> but wait until the output buffer is empty before
performing the change.
<P>
<DT><CODE>TCSETAF</CODE>
<DD>Same as <CODE>TCSETA</CODE> but wait until the output buffer is empty and
flushes the input buffer before performing the change.
<P>
<DT><CODE>TCXONC</CODE>
<DD>Starts or stops the tty flow. <VAR>argp</VAR> may be one of the following:
<P>
<DT><CODE>TCOOFF</CODE>
<DD>Stops output.
<P>
<DT><CODE>TCOON</CODE>
<DD>Restart output.
<P>
<DT><CODE>TCIOFF</CODE>
<DD>Stops input.
<P>
<DT><CODE>TCION</CODE>
<DD>Restart input.
<P>
<DT><CODE>TCFLSH</CODE>
<DD>Flushes the tty. <VAR>argp</VAR> may be <CODE>TCIFLUSH</CODE> to flush the input,
<CODE>TCOFLUSH</CODE> to flush the output or <CODE>TCIOFLUSH</CODE> to flush both.
<P>
<DT><CODE>TIOCEXCL</CODE>
<DD>Sets the tty in exclusive mode. No further <CODE>open</CODE> operations on the
terminal are permited.
<P>
<DT><CODE>TIOCNXCL</CODE>
<DD>Disable exclusive mode. <CODE>open</CODE> operations are now permitted.
<P>
<DT><CODE>TIOCSCTTY</CODE>
<DD>Sets that termial as the controlling terminal of the current task.  The
calling task must be a session leader and not have a controlling tty
already.  If the task does not have superuser privileges, normal
authorisations checks are performed. If the task has superuser
privileges and <VAR>argp</VAR> is set to 1, the terminal will be set as the
controling terminal even if it was already the controling terminal of
another task.
<P>
<DT><CODE>TIOCGPGRP</CODE>
<DD>Gets the process group id associated with this terminal. <VAR>argp</VAR>
points to an integer that is set to that id.
<P>
<DT><CODE>TIOCSPGRP</CODE>
<DD>Associate the terminal to the process group which has an id equals to
<VAR>argp</VAR>. The processes of the process group must have the same real
or saved uid of as the effective or save uid of the calling task, or be
descendants of the calling process or the calling process must have
superuser privileges.
<P>
<DT><CODE>TIOCOUTQ</CODE>
<DD>Sets an integer pointed to by <VAR>argp</VAR> to the number of bytes in the
output queue that are not sent.
<P>
<DT><CODE>TIOCSTI</CODE>
<DD>Insert the value of <VAR>argp</VAR> into the input queue of the terminal.
<P>
<DT><CODE>TIOCGWINSZ</CODE>
<DD>Returns the window size into a <CODE>winsize</CODE> structure pointed to by
<VAR>argp</VAR>.
<P>
<DT><CODE>TIOCSWINSZ</CODE>
<DD>Sets the window size to the <CODE>winsize</CODE> structure pointed to by
<VAR>argp</VAR>.
<P>
<DT><CODE>TIOCCONS</CODE>
<DD>Controls the redirection of the console. If <VAR>fd</VAR> is a console, the
redirection is cancelled. If <VAR>fd</VAR> is a pseudo console slave, the
console is redirected to that slave. If <VAR>fd</VAR> is a pseudo console
master, the console is redirected to its slave. The calling taks must be
have superuser privileges.
<P>
<DT><CODE>TIOCNOTTY</CODE>
<DD>Dissociate the controling terminal from the current task. The calling
task must be process leader.
<P>
<DT><CODE>TIOCGETD</CODE>
<DD>Retreives the terminal current line discipline mode. The value is store
to the area pointed to by <VAR>argp</VAR>.
<P>
<DT><CODE>TIOCSETD</CODE>
<DD>Sets the terminal line discipline mode to the value of <VAR>argp</VAR>.
<P>
<DT><CODE>TIOCGLCKTRMIOS</CODE>
<DD>Gets the locking status of the <CODE>termios</CODE> structure of the terminal.
<VAR>argp</VAR> points to a <VAR>termios</VAR> structure.
<P>
<DT><CODE>TIOCSLCKTRMIOS</CODE>
<DD>Sets the locking status of the <CODE>termios</CODE> structure of the terminal.
<VAR>argp</VAR> points to a <VAR>termios</VAR> structure that contains the new
flags. The calling task must have superuser privileges.
<P>
<DT><CODE>TIOCPKT</CODE>
<DD>If <VAR>argp</VAR> is 1, it sets the <CODE>packet</CODE> flag in the tty structure,
otherwise it sets the flag to zero. (What purpose does that serves?)
<P>
<DT><CODE>TIOCLINUX</CODE>
<DD>Linux dependent.
<P>
<DT><CODE>TCSBRK</CODE>
<DD>Waits for the output queue to become empty, then, if <VAR>argp</VAR> is 1,
sends a break.
<P>
<DT><CODE>TCSBRKP</CODE>
<DD>Same as <CODE>TCSBRK</CODE>?
</DL>
<P>
<H3>RETURN VALUE</H3>
<P>
On success zero is returned. On error, -1 is returned and <CODE>errno</CODE> is
set to one of the following values:
<P>
<UL>
<LI><CODE>EINVAL</CODE>: <VAR>cmd</VAR> or <VAR>argp</VAR> have an invalid value.
<LI><CODE>ENOTTY</CODE>: <VAR>d</VAR> is not a character special device or the
request made on <VAR>d</VAR> is not valid for this type of device.
<LI><CODE>EBADF</CODE>.
</UL>
<P>
<P>Go to the <A HREF="syscalls_16.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_16.html">previous</A>, <A HREF="syscalls_18.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_18.html">next</A> section.<P>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -