📄 tioctl.c
字号:
/* $Header: /usr/cvsroot/target/src/wrn/wm/demo/socktest/tioctl.c,v 1.1.1.1 2001/11/05 17:49:14 tneale Exp $ *//* * Copyright (C) 1999-2005 Wind River Systems, Inc. * All rights reserved. Provided under license only. * Distribution or other use of this software is only * permitted pursuant to the terms of a license agreement * from Wind River Systems (and is otherwise prohibited). * Refer to that license agreement for terms of use. *//**************************************************************************** * Copyright 1998 Integrated Systems, Inc. * All rights reserved. ****************************************************************************//* * $Log: tioctl.c,v $ * Revision 1.1.1.1 2001/11/05 17:49:14 tneale * Tornado shuffle * * Revision 1.2 2001/01/19 22:24:54 paul * Update copyright. * * Revision 1.1 2000/10/16 19:22:41 paul * Renamed from test_ioctl.c * * Revision 1.7 2000/03/17 00:14:47 meister * Update copyright message * * Revision 1.6 1999/07/30 21:29:44 paul * enhanced test_fail, test_pass * * Revision 1.5 1999/05/03 19:23:28 paul * Disabled async test for the time being. * * Revision 1.4 1999/02/18 04:16:04 wes * Socket Merge: new code (socket tests). * * Revision 1.3.2.4 1998/11/06 23:36:51 paul * rototill to support tcp * *//* [clearcase]modification history-------------------01a,19apr05,job update copyright notices*/#include "test.h"voidtest_ioctl(int flags){ int s; long opt; s = socket(PF_INET, SOCK_DGRAM, 0); if (s < 0) { test_fail(0, "ioctl", "socket"); return; } opt = -1; test(0, "ioctl FIONBIO", ioctl(s, FIONBIO, (char *) &opt), 0, 0);#if 0 /* disable this until we have async delivery working */ test(0, "ioctl FIOASYNC", ioctl(s, FIOASYNC, (char *) &opt), 0, 0);#endif test(0, "ioctl FIONREAD", ioctl(s, FIONREAD, (char *) &opt), 0, 0); if (verbose) printf(" nread = %lu\n", opt); test(0, "ioctl SIOCATMARK", ioctl(s, SIOCATMARK, (char *) &opt), 0, 0); if (verbose) printf(" atmark = %lu\n", opt); test(0, "ioctl bogorequest", ioctl(s, 0x10081966, (char *) &opt), -1, EINVAL); test(0, "ioctl null request", ioctl(s, 0x10081966, 0), -1, EINVAL); close(s); test(0, "ioctl closed socket", ioctl(s, SIOCATMARK, (char *) &opt), -1, EBADF);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -