📄 0772-0775.html
字号:
<HTML>
<HEAD>
<TITLE>Linux Complete Command Reference:System Calls:EarthWeb Inc.-</TITLE>
</HEAD>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!-- ISBN=0672311046 //-->
<!-- TITLE=Linux Complete Command Reference//-->
<!-- AUTHOR=Red Hat//-->
<!-- PUBLISHER=Macmillan Computer Publishing//-->
<!-- IMPRINT=Sams//-->
<!-- CHAPTER=02 //-->
<!-- PAGES=0737-0890 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="0771-0771.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0776-0780.html">Next</A></CENTER></P>
<A NAME="PAGENUM-772"><P>Page 772</P></A>
<P><B>
HISTORY
</B></P>
<P>These system calls appeared in BSD 4.2.
</P>
<P><B>
BUGS
</B></P>
<P>Several of the socket options should be handled at lower levels of the system.
</P>
<P><B>
SEE ALSO
</B></P>
<!-- CODE SNIP //-->
<PRE>
ioctl(2), socket(2), getprotoent(3), protocols(5)
</PRE>
<!-- END CODE SNIP //-->
<P>BSD Man Page, 22 April 1996
</P>
<H3><A NAME="ch02_ 43">
gettimeofday, settimeofday
</A></H3>
<P>gettimeofday, settimeofday—Get/set time
</P>
<P><B>
SYNOPSIS
</B></P>
<!-- CODE //-->
<PRE>
#include <sys/time.h>
#include <unistd.h>
int gettimeofday(struct timeval *tv, struct timezone *tz);
int settimeofday(const struct timeval *tv , const struct timezone *tz);
</PRE>
<!-- END CODE //-->
<P><B>
DESCRIPTION
</B></P>
<P>gettimeofday and settimeofday can set the time as well as a time zone.
tv is a timeval struct, as specified in
/usr/include/sys/time.h:
</P>
<!-- CODE //-->
<PRE>
struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* microseconds */
};
and tz is a timezone:
struct timezone {
int tz_minuteswest;
/* minutes west of Greenwich */
int tz_dsttime;
/* type of dst correction */
};
</PRE>
<!-- END CODE //-->
<P>with daylight savings times defined as follows:
</P>
<!-- CODE //-->
<PRE>
DST_NONE /* not on dst */
DST_USA /* USA style dst */
DST_AUST /* Australian style dst */
DST_WET /* Western European dst */
DST_MET /* Middle European dst */
DST_EET /* Eastern European dst */
DST_CAN /* Canada */
DST_GB /* Great Britain and Eire */
DST_RUM /* Rumania */
DST_TUR /* Turkey */
DST_AUSTALT /* Australian style with shift in 1986 */
</PRE>
<!-- END CODE //-->
<A NAME="PAGENUM-773"><P>Page 773</P></A>
<P>And the following macros are defined to operate on this :
</P>
<!-- CODE //-->
<PRE>
#define timerisset(tvp)\
((tvp)->tv_sec || (tvp)->tv_usec)
#define timercmp(tvp, uvp, cmp)\
((tvp)->tv_sec cmp (uvp)->tv_sec ||\
(tvp)->tv_sec == (uvp)->tv_sec &&\
(tvp)->tv_usec cmp (uvp)->tv_usec)
#define timerclear(tvp)
((tvp)->tv_sec = (tvp)->tv_usec = 0)
</PRE>
<!-- END CODE //-->
<P>If either tv or tz is null, the corresponding structure is not set or returned.
</P>
<P>Only the superuser can use settimeofday.
</P>
<P><B>
ERRORS
</B></P>
<TABLE>
<TR><TD>
EPERM
</TD><TD>
settimeofday is called by someone other than the superuser.
</TD></TR><TR><TD>
EINVAL
</TD><TD>
Time zone (or something else) is invalid.
</TD></TR></TABLE>
<P><B>
CONFORMS TO
</B></P>
<P>BSD 4.3
</P>
<P><B>
SEE ALSO
</B></P>
<!-- CODE SNIP //-->
<PRE>
date(1), adjtimex(2), time(2), ctime(3), ftime(3)
</PRE>
<!-- END CODE SNIP //-->
<P>Linux 1.2.4, 15 April 1995
</P>
<H3><A NAME="ch02_ 44">
getuid, geteuid
</A></H3>
<P>getuid, geteuid—Get user identity
</P>
<P><B>
SYNOPSIS
</B></P>
<!-- CODE SNIP //-->
<PRE>
#include <unistd.h>
uid_t getuid(void);
uid_t geteuid(void);
</PRE>
<!-- END CODE SNIP //-->
<P><B>
DESCRIPTION
</B></P>
<P>getuid returns the real user ID of the current process.
</P>
<P>geteuid returns the effective user ID of the current process.
</P>
<P>The real ID corresponds to the ID of the calling process. The effective ID corresponds to the set ID bit on the file
being executed.
</P>
<P><B>
ERRORS
</B></P>
<P>These functions are always successful.
</P>
<P><B>
CONFORMS TO
</B></P>
<P>POSIX, BSD 4.3
</P>
<P><B>
SEE ALSO
</B></P>
<!-- CODE SNIP //-->
<PRE>
setreuid(2), setuid(2)
</PRE>
<!-- END CODE SNIP //-->
<P>Linux 0.99.11, 23 July 1993
</P>
<A NAME="PAGENUM-774"><P>Page 774</P></A>
<H3><A NAME="ch02_ 45">
idle
</A></H3>
<P>idle—Makes process 0 idle
</P0>
<P><B>
SYNOPSIS
</B></P>
<!-- CODE SNIP //-->
<PRE>
#include <unistd.h>
void idle(void);
</PRE>
<!-- END CODE SNIP //-->
<P><B>
DESCRIPTION
</B></P>
<P>idle is an internal system call used during bootstrap. It marks the process's pages as swappable, lowers its priority, and
enters the main scheduling loop. idle never returns.
</P>
<P>Only process 0 may call idle. Any user process, even a process with superuser permission, will receive
EPERM.
</P>
<P><B>
RETURN VALUE
</B></P>
<P>idle never returns for process 0, and always returns
_1 for a user process.
</P>
<P><B>
ERRORS
</B></P>
<TABLE>
<TR><TD>
EPERM
</TD><TD>
Always, for a user process.
</TD></TR></TABLE>
<P>Linux 1.1.46, 21 August 1994
</P>
<H3><A NAME="ch02_ 46">
ioctl
</A></H3>
<P>ioctl—Controls devices
</P>
<P><B>
SYNOPSIS
</B></P>
<!-- CODE SNIP //-->
<PRE>
#include <sys/ioctl.h>
int ioctl(int d,intrequest, ...);
</PRE>
<!-- END CODE SNIP //-->
<P>(The "third" argument is traditionally
char *argp and will be so named for this discussion.)
</P>
<P><B>
DESCRIPTION
</B></P>
<P>The ioctl function manipulates the underlying device parameters of special files. In particular, many operating
characteristics of character special files (for example, terminals) may be controlled with
ioctl requests. The argument d must be an open file descriptor.
</P>
<P>An ioctl request has encoded in it whether the argument is an
in parameter or out parameter, and the size of the
argument argp in bytes. Macros and defines used in specifying an
ioctl request are located in the file
<sys/ioctl.h>.
</P>
<P><B>
RETURN VALUE
</B></P>
<P>On success, 0 is returned. On error, _1 is returned and
errno is set appropriately.
</P>
<P><B>
ERRORS
</B></P>
<TABLE>
<TR><TD>
EBADF
</TD><TD>
d is not a valid descriptor.
</TD></TR><TR><TD>
ENOTTY
</TD><TD>
d is not associated with a character special device.
</TD></TR><TR><TD>
ENOTTY
</TD><TD>
The specified request does not apply to the kind of object that the descriptor
d references.
</TD></TR><TR><TD>
EINVAL
</TD><TD>
request or argp is not valid.
</TD></TR></TABLE>
<P><B>
HISTORY
</B></P>
<P>An ioctl function call appeared in version 7 AT&T UNIX.
</P>
<A NAME="PAGENUM-775"><P>Page 775</P></A>
<P><B>
SEE ALSO
</B></P>
<!-- CODE SNIP //-->
<PRE>
execve(2), fcntl(2), mt(4), sd(4), tty(4)
</PRE>
<!-- END CODE SNIP //-->
<P><B>
INTRODUCTION
</B></P>
<P>This is ioctl List 1.3.27, a list of ioctl calls in Linux/i386 kernel 1.3.27. It contains 421
ioctls from /usr/include/fasm,linuxg/*.h. For each
ioctl, you'll find the numerical value, name, and argument type.
</P>
<P>An argument type of const struct foo * means the argument is input to the kernel.
struct foo * means the kernel outputs the argument. If the kernel uses the argument for both input and output, this is marked with
// I-O.
</P>
<P>Some ioctls take more arguments or return more values than a single structure. These are marked
// MORE and are documented further in a separate section.
</P>
<P>This list is incomplete. It does not include
</P>
<UL>
<LI> ioctls defined internal to the kernel (scsi ioctl.h).
<LI> ioctls defined in modules distributed separately from the kernel.
</UL>
<P>And, of course, I may have errors and omissions.
</P>
<P>Please e-mail changes and comments to
mec@duracef.shout.net. I am particularly interested in loadable modules that
define their own ioctls. If you know of such a module, tell me where I can ftp it, and I'll include its
ioctls in my next release.
</P>
<P><B>
MAIN TABLE
</B></P>
<!-- CODE SNIP //-->
<PRE>
<include/asm-i386/socket.h>
</PRE>
<!-- END CODE SNIP //-->
<TABLE>
<TR><TD>
0x00008901
</TD><TD>
FIOSETOWN
</TD><TD>
const int *
</TD></TR><TR><TD>
0x00008902
</TD><TD>
SIOCSPGRP
</TD><TD>
const int *
</TD></TR><TR><TD>
0x00008903
</TD><TD>
FIOGETOWN
</TD><TD>
int *
</TD></TR><TR><TD>
0x00008904
</TD><TD>
SIOCGPGRP
</TD><TD>
int *
</TD></TR><TR><TD>
0x00008905
</TD><TD>
SIOCATMARK
</TD><TD>
int *
</TD></TR><TR><TD>
0x00008906
</TD><TD>
SIOCGSTAMP
</TD><TD>
timeval *
</TD></TR></TABLE>
<!-- CODE SNIP //-->
<PRE>
<include/asm-i386/termios.h>
</PRE>
<!-- END CODE SNIP //-->
<TABLE>
<TR><TD>
0x00005401
</TD><TD>
TCGETS
</TD><TD>
struct termios *
</TD></TR><TR><TD>
0x00005402
</TD><TD>
TCSETS
</TD><TD>
const struct termios *
</TD></TR><TR><TD>
0x00005403
</TD><TD>
TCSETSW
</TD><TD>
const struct termios *
</TD></TR><TR><TD>
0x00005404
</TD><TD>
TCSETSF
</TD><TD>
const struct termios *
</TD></TR><TR><TD>
0x00005405
</TD><TD>
TCGETA
</TD><TD>
struct termio *
</TD></TR><TR><TD>
0x00005406
</TD><TD>
TCSETA
</TD><TD>
const struct termio *
</TD></TR><TR><TD>
0x00005407
</TD><TD>
TCSETAW
</TD><TD>
const struct termio *
</TD></TR><TR><TD>
0x00005408
</TD><TD>
TCSETAF
</TD><TD>
const struct termio *
</TD></TR><TR><TD>
0x00005409
</TD><TD>
TCSBRK
</TD><TD>
int
</TD></TR><TR><TD>
0x0000540A
</TD><TD>
TCXONC
</TD><TD>
int
</TD></TR><TR><TD>
0x0000540B
</TD><TD>
TCFLSH
</TD><TD>
int
</TD></TR><TR><TD>
0x0000540C
</TD><TD>
TIOCEXCL
</TD><TD>
void
</TD></TR><TR><TD>
0x0000540D
</TD><TD>
TIOCNXCL
</TD><TD>
void
</TD></TR><TR><TD>
0x0000540E
</TD><TD>
TIOCSCTTY
</TD><TD>
int
</TD></TR><TR><TD>
0x0000540F
</TD><TD>
TIOCGPGRP
</TD><TD>
pid_t *
</TD></TR><TR><TD>
0x00005410
</TD><TD>
TIOCSPGRP
</TD><TD>
const pid_t *
</TD></TR></TABLE>
<P><CENTER>
<a href="0771-0771.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0776-0780.html">Next</A></CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -