Sponsored Content
Full Discussion: Which is more expensive ?
Top Forums Programming Which is more expensive ? Post 302131746 by vino on Monday 13th of August 2007 01:55:39 PM
Old 08-13-2007
Quote:
Originally Posted by reborg
I don't think there would be any real difference here, there might me a very marginal improvement in the second case due to the number of comparison you are doing, but would expect that to be marginal. You are after all incrementing the same number of times in both cases anc calling close() the same number of time.

Just curious, is this shutdown code or is it after forking that you are closing the open fds?
This is for closing the open fds after forking. I was told that you generally need to close only 64 fds instead of the RLIMIT.rlim_cur after forking. Any thoughts ?
 

2 More Discussions You Might Find Interesting

1. Programming

calling pthread_self (on ubuntu), expensive?

Hi all, Is anyone aware of what operations are involved when a call to pthread_self() is made, obtaining the unique thread ID on a Ubuntu system (or even any Linux flavour)? Specifically, to retrieve the thread id, is there any locking required or atomic operations? I'm building an... (11 Replies)
Discussion started by: gorga
11 Replies

2. What is on Your Mind?

Very Expensive Running Shoes

You really should not need one third of the entire US budget to buy a pair of running shoes... even if they are name brand. What have these guys been smoking? It reminds me of the old joke... Customer: At those prices you aren't going to sell many shoes. Salesman: Ah, but all we need to do is... (4 Replies)
Discussion started by: Perderabo
4 Replies
xpagetfd(3)							SAORD Documentation						       xpagetfd(3)

NAME
XPAGetFd - retrieve data from one or more XPA servers and write to files SYNOPSIS
#include <xpa.h> int XPAGetFd(XPA xpa, char *template, char *paramlist, char *mode, int *fds, char **names, char **messages, int n); DESCRIPTION
Retrieve data from one or more XPA servers whose class:name identifier matches the specified template and write it to files associated with one or more standard I/O fds (i.e, handles returned by open()). A template of the form "class1:name1" is sent to the XPA name server, which returns a list of at most ABS(n) matching XPA servers. A con- nection is established with each of these servers and the paramlist string is passed to the server as the data transfer request is initi- ated. If an XPA struct is passed to the call, then the persistent connections are updated as described above. Otherwise, temporary connec- tions are made to the servers (which will be closed when the call completes). The XPAGetFd() routine then retrieves data from the XPA servers, and write these data to the fds associated with one or more fds (i.e., results from open). Is n is positive, then there will be n fds and the data from each server will be sent to a separate fd. If n is nega- tive, then there is only 1 fd and all data is sent to this single fd. (The latter is how xpaget is implemented.) A string containing the class:name and ip:port is stored in the name array. If a given server returned an error or the server callback sends a message back to the client, then the message will be stored in the associated element of the messages array. NB: if specified, the name and messages arrays must be of size n or greater. The returned message string will be of the form: XPA$ERROR error-message (class:name ip:port) or XPA$MESSAGE message (class:name ip:port) Note that when there is an error stored in an messages entry, the corresponding bufs and lens entry may or may not be NULL and 0 (respec- tively), depending on the particularities of the server. The return value will contain the actual number of servers that were processed. This value thus will hold the number of valid entries in the bufs, lens, names, and messages arrays, and can be used to loop through these arrays. In names and/or messages is NULL, no information is passed back in that array. The mode string is of the form: "key1=value1,key2=value2,..." The following keywords are recognized: key value default explanation ------ -------- -------- ----------- ack true/false true if false, don't wait for ack from server (after callback completes) The ack keyword is not very useful, since the server completes the callback in order to return the data anyway. It is here for completion (and perhaps for future usefulness). Example - #include <xpa.h> #define NXPA 10 int i, got; int fds[NXPA]; char *names[NXPA]; char *messages[NXPA]; for(i=0; i<NXPA; i++) fds[i] = open(...); got = XPAGetFd(NULL, "ds9", "file", NULL, fds, names, messages, NXPA); for(i=0; i<got; i++){ if( messages[i] != NULL ){ /* error processing */ fprintf(stderr, "ERROR: %s (%s) ", messages[i], names[i]); } if( names[i] ) free(names[i]); if( messages[i] ) free(messages[i]); } SEE ALSO
See xpa(7) for a list of XPA help pages version 2.1.14 June 7, 2012 xpagetfd(3)
All times are GMT -4. The time now is 09:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy