当前位置: 技术问答>linux和unix
sco unix程序移植到suse linux的问题(急)
来源: 互联网 发布时间:2015-12-22
本文导语: sco下一个socket的程序,大致代码如下: int sockid=socket(AF_INET,SOCK_STREAM,0); int ret=connect(sockid,(struct sockaddr *)&client,sizeof(client)); int blockflag=1; //unblock if(ioctl(sockid,FIONBIO,&blockflag)!=0){ ... } 在linux下编译报错:`FIONBIO' u...
sco下一个socket的程序,大致代码如下:
int sockid=socket(AF_INET,SOCK_STREAM,0);
int ret=connect(sockid,(struct sockaddr *)&client,sizeof(client));
int blockflag=1; //unblock
if(ioctl(sockid,FIONBIO,&blockflag)!=0){
...
}
在linux下编译报错:`FIONBIO' undeclared。
请问这个ioctl函数应该怎么改呢?
int sockid=socket(AF_INET,SOCK_STREAM,0);
int ret=connect(sockid,(struct sockaddr *)&client,sizeof(client));
int blockflag=1; //unblock
if(ioctl(sockid,FIONBIO,&blockflag)!=0){
...
}
在linux下编译报错:`FIONBIO' undeclared。
请问这个ioctl函数应该怎么改呢?
|
用man ioctl_list找你想要的ioctl操作请求和所在的头文件。
|
看个示例吧
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define BASE_VALUE 257
int main(int argc,char *argv[])
{
int mixer_fd=0;
char *names[SOUND_MIXER_NRDEVICES]=SOUND_DEVICE_LABELS;
int value,i;
printf("nusage:%s dev_no.[0..24] value[0..100]nn",argv[0]);
printf("eg. %s 0 100n",argv[0]);
printf(" will change the volume to MAX volume.nn");
printf("The dev_no. are as below:n");
for (i=0;i
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define BASE_VALUE 257
int main(int argc,char *argv[])
{
int mixer_fd=0;
char *names[SOUND_MIXER_NRDEVICES]=SOUND_DEVICE_LABELS;
int value,i;
printf("nusage:%s dev_no.[0..24] value[0..100]nn",argv[0]);
printf("eg. %s 0 100n",argv[0]);
printf(" will change the volume to MAX volume.nn");
printf("The dev_no. are as below:n");
for (i=0;i