Sponsored Content
Top Forums UNIX for Advanced & Expert Users how to use exceptfds argument in select system call Post 302212997 by bvijaya on Wednesday 9th of July 2008 02:32:44 AM
Old 07-09-2008
how to use exceptfds argument in select system call

Hi,

Can any one tell me how to use the fourth argument of select system call.I saw example "port forwarding" on the net,but it was too complex for me to understand.Can any one explain me about the usage of exceptfds argument of select system call with simple example.

Thanks.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

how to differentiate system call from library call

Hi, Ho do I differentiate system call from library call? for example if I am using chmod , how do I find out if it is a system call or library call? Thanks Muru (2 Replies)
Discussion started by: muru
2 Replies

2. Programming

error "Invalid argument" returned after call sched_setscheduler

the code is below and the was run on Solaris 9. ----------------------------- struct sched_param param; param.sched_priority = 99; if(sched_setscheduler(0, SCHED_RR, &param) == -1) { perror("setting priority"); exit(1); } ------------------------------- after the... (1 Reply)
Discussion started by: robin.zhu
1 Replies

3. Shell Programming and Scripting

Function call with argument doubt

Hi all, I am having a problem with user defined function call. I am new into the concept of shell script UDFs. My function is: iterate_directory() { cd $1 k=0 for i in * do if then ARR=${i} fi done echo ${ARR } } (4 Replies)
Discussion started by: canishk
4 Replies

4. Programming

Having some trouble with select() call in C

I have this while loop: while (notdone) { //Set the timers waitd.tv_sec = 5; waitd.tv_usec = 0; FD_ZERO(&tempreadfds); FD_ZERO(&tempwritefds); FD_ZERO(&readfds); /* initialize the read fd set */ FD_ZERO(&writefds); /* initialize the write fd set */ ... (1 Reply)
Discussion started by: Legend986
1 Replies

5. Shell Programming and Scripting

Passing argument to system call in awk script

So, I have this script. It reads a CSV file that has a mixture of object names with IP addresses (parsing out that part I have working), and object names which have a DNS name. I want to be able to run a "dig +short" based off of the name given to me in the line of the awk script, and then deal... (6 Replies)
Discussion started by: mikesimone
6 Replies

6. Programming

select() system call takes longer than the timeout specified

Below is my code. Every once in a while the select call takes as long as 150 seconds (discovered by printing time before and after this statement) while the timeout specified into it is only 1 second. Any clue why? I can't believe that select call which has been around for centuries can have a bug,... (15 Replies)
Discussion started by: old_as_a_fossil
15 Replies

7. UNIX for Dummies Questions & Answers

How to select correct partition and kernel argument for grub?

I use command-line mode of GRUB to load kernel, but I can not know how to chose the partition and kernel argument, as followed : please tell me how to do deal with , thanks! (0 Replies)
Discussion started by: cqlouis
0 Replies

8. Homework & Coursework Questions

program to send messages to parent using pipes and select system call

Write a program using select, which will create some number of child processes that continuously send text messages to the parent process using pipes. Each child has its own pipe that it uses to communicate with the parent. The parent uses select () to decide what pipes should be processed to... (1 Reply)
Discussion started by: ripssingh
1 Replies

9. UNIX for Advanced & Expert Users

Issues with select system call

1. We are using client-server model communication using TCP/IP protocol 2. The TCP socket created with O_NON_BLOCK flag 3. When we make attempt to send large data to other process, the send is partially successful. It means we attempt to send 90K data, OS sent only 40K data successfully. ... (3 Replies)
Discussion started by: MasthanDudekula
3 Replies

10. Shell Programming and Scripting

Conditionally replace nth argument of every function call

I have very large perl source code file and I want to replace every occurrence function say foo,The function foo has some arguments and I want to replace 2nd argument,the current argument is hex integer and i want to replace it to equivalent string.Also I want to replace function name foo with... (4 Replies)
Discussion started by: pravint
4 Replies
explain_select(3)					     Library Functions Manual						 explain_select(3)

NAME
explain_select - explain select(2) errors SYNOPSIS
#include <sys/select.h> #include <libexplain/select.h> const char *explain_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); const char *explain_errno_select(int errnum, int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); void explain_message_select(char *message, int message_size, int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); void explain_message_errno_select(char *message, int message_size, int errnum, int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); DESCRIPTION
These functions may be used to obtain explanations for errors returned by the select(2) system call. explain_select const char *explain_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); The explain_select function is used to obtain an explanation of an error returned by the select(2) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. This function is intended to be used in a fashion similar to the following example: if (select(nfds, readfds, writefds, exceptfds, timeout) < 0) { fprintf(stderr, "%s ", explain_select(nfds, readfds, writefds, exceptfds, timeout)); exit(EXIT_FAILURE); } nfds The original nfds, exactly as passed to the select(2) system call. readfds The original readfds, exactly as passed to the select(2) system call. writefds The original writefds, exactly as passed to the select(2) system call. exceptfds The original exceptfds, exactly as passed to the select(2) system call. timeout The original timeout, exactly as passed to the select(2) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. explain_errno_select const char *explain_errno_select(int errnum, int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); The explain_errno_select function is used to obtain an explanation of an error returned by the select(2) system call. The least the mes- sage will contain is the value of strerror(errnum), but usually it will do much better, and indicate the underlying cause in more detail. This function is intended to be used in a fashion similar to the following example: if (select(nfds, readfds, writefds, exceptfds, timeout) < 0) { int err = errno; fprintf(stderr, "%s ", explain_errno_select(err, nfds, readfds, writefds, exceptfds, timeout)); exit(EXIT_FAILURE); } errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. nfds The original nfds, exactly as passed to the select(2) system call. readfds The original readfds, exactly as passed to the select(2) system call. writefds The original writefds, exactly as passed to the select(2) system call. exceptfds The original exceptfds, exactly as passed to the select(2) system call. timeout The original timeout, exactly as passed to the select(2) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. explain_message_select void explain_message_select(char *message, int message_size, int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); The explain_message_select function may be used to obtain an explanation of an error returned by the select(2) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. This function is intended to be used in a fashion similar to the following example: if (select(nfds, readfds, writefds, exceptfds, timeout) < 0) { char message[3000]; explain_message_select(message, sizeof(message), nfds, readfds, writefds, exceptfds, timeout); fprintf(stderr, "%s ", message); exit(EXIT_FAILURE); } message The location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. message_size The size in bytes of the location in which to store the returned message. nfds The original nfds, exactly as passed to the select(2) system call. readfds The original readfds, exactly as passed to the select(2) system call. writefds The original writefds, exactly as passed to the select(2) system call. exceptfds The original exceptfds, exactly as passed to the select(2) system call. timeout The original timeout, exactly as passed to the select(2) system call. explain_message_errno_select void explain_message_errno_select(char *message, int message_size, int errnum, int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); The explain_message_errno_select function may be used to obtain an explanation of an error returned by the select(2) system call. The least the message will contain is the value of strerror(errnum), but usually it will do much better, and indicate the underlying cause in more detail. This function is intended to be used in a fashion similar to the following example: if (select(nfds, readfds, writefds, exceptfds, timeout) < 0) { int err = errno; char message[3000]; explain_message_errno_select(message, sizeof(message), err, nfds, readfds, writefds, exceptfds, timeout); fprintf(stderr, "%s ", message); exit(EXIT_FAILURE); } message The location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. message_size The size in bytes of the location in which to store the returned message. errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. nfds The original nfds, exactly as passed to the select(2) system call. readfds The original readfds, exactly as passed to the select(2) system call. writefds The original writefds, exactly as passed to the select(2) system call. exceptfds The original exceptfds, exactly as passed to the select(2) system call. timeout The original timeout, exactly as passed to the select(2) system call. SEE ALSO
select(2) blah blah explain_select_or_die(3) blah blah and report errors COPYRIGHT
libexplain version 0.52 Copyright (C) 2008 Peter Miller explain_select(3)
All times are GMT -4. The time now is 10:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy