I am porting C/pro*c code from UNIX to Linux. The code is:
#define __NFDBIT (8 * sizeof(unsigned long))
#define __FD_SETSIZ 1024
#define __FDSET_LONG (__FD_SETSIZ/__NFDBIT)
typedef struct {
unsigned long fds_bits [__FDSET_LONG];
} __ernel_fd_set;
typedef __ernel_fd_set fd_set_1;
int main()
{
fd_set_1 listen_set;
int listen_sd;
int socket_id;
FD_ZERO(&listen_set);
socket_id = t_open("/dev/tcp", O_RDWR|O_NONBLOCK, (struct t_info *) 0);
if ( socket_id <0 )
{
exit(FAILURE);
}
return 0;
}
In UNIX the value of socket_id is > 0
in Linux it is -1
. Reason is in UNIX, there is a /dev/tcp
. This is not present on Linux. Also in UNIX this tcp
file is character special file which is different from normal file.
Is there any way to create same character special file in Linux as in UNIX or how to proceed this further?