Sponsored Content
Top Forums Programming How to make a C code reentrant? Post 8178 by neelam on Monday 8th of October 2001 01:20:50 AM
Old 10-08-2001
Question How to make a C code reentrant?

Dear reader,

This is a query related to multiuser environment. I have a piece of code written in C. Now I want to make this code as reentrant and execute on several trminals at the same time, such that there exists only one copy of code in the memory.

Please tell me..
1. What are the parameters required to make a code reentrant?
2. Can we use the same parameters on a linux environment?

Thanking you,
 

9 More Discussions You Might Find Interesting

1. Linux

Need direction to make code for cellphone in C,C++ or Perl

Hi All, I need a help from the techie guys in this group.Actually, i need to make a code which can make wallpaper and ringtone for a mobile phone using any method. I know C,C++ and perl langauges but doesnot having much knowledge of JAVA. So can anybody tell me that whether i can... (0 Replies)
Discussion started by: basileis
0 Replies

2. Shell Programming and Scripting

Please make this code elegant.

Hi All, Following is the part of my script.It does contain many for loops and is not elegant. Please feel free to suggest any changes to make this elegant. Thanks! nua7 for i in `ls $CATALINA_HOME/shared/lib/*.jar`; do LOCALCLASSPATH="$LOCALCLASSPATH:$i" done for i in... (3 Replies)
Discussion started by: nua7
3 Replies

3. UNIX for Advanced & Expert Users

how to port a package to huge source code having its own make and compilers

In general for intalling a package like we do ./configure, make , make install But if we want to integrate the package with a huge source base what are the things to be taken care could some one have a light on purpose of ./configure , make and make install along with above question. I... (1 Reply)
Discussion started by: Gopi Krishna P
1 Replies

4. Solaris

Gani Network Driver Won't Install - make: Fatal error: Don't know how to make targ...

I attached a README file that I will refer to. I successfully completed everything in the README file until step 4. # pwd /gani/gani-2.4.4 # ls COPYING Makefile.macros gem.c Makefile Makefile.sparc_gcc gem.h Makefile.amd64_gcc ... (1 Reply)
Discussion started by: Bradj47
1 Replies

5. Shell Programming and Scripting

trying to make an AWK code for ordering numbers in a column from least to highest

Hi all, I have a large column of numbers like 5.6789 2.4578 9.4678 13.5673 1.6589 ..... I am trying to make an awk code so that awk can easily go through the column and arrange the numbers from least to highest like 1.6589 2.4578 5.6789 ....... can anybody suggest, how can I do... (5 Replies)
Discussion started by: ananyob
5 Replies

6. UNIX for Advanced & Expert Users

How to Make Sql Plus Exit with an Error Code

Dear all, How to make sqlplus command to exit with an apt error code in bash script, It always returns 0 for me. Thanks (9 Replies)
Discussion started by: vetrivendhan
9 Replies

7. Programming

Help with make this Fortran code more efficient (in HPC manner)

Hi there, I had run into some fortran code to modify. Obviously, it was written without thinking of high performance computing and not parallelized... Now I would like to make the code "on track" and parallel. After a whole afternoon thinking, I still cannot find where to start. Can any one... (3 Replies)
Discussion started by: P_E_M_Lee
3 Replies

8. Shell Programming and Scripting

Code to make sure Script runs only on sunday -

Hi I have written a script which restarts the application , I want to add a piece of code in my script , to make sure this gets executed only on sunday . So that even if someone runs it on any other day by mistake it should exit throwing an error message . Can someone please assist what will... (6 Replies)
Discussion started by: honey26
6 Replies

9. Shell Programming and Scripting

How to make this code working?

Hi Gurus, I wrote a simple code, but it doesn't work, can body help me to fix the issue. awk -F',' 'BEGIN{n=0}{ NR == FNR {fname;next} { if ($3==fname) n=1 } END{if n==0} }' tmpsrc srcfile.txt Thanks in advance (4 Replies)
Discussion started by: ken6503
4 Replies
SETENV(3P)						     POSIX Programmer's Manual							SETENV(3P)

PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
setenv - add or change environment variable SYNOPSIS
#include <stdlib.h> int setenv(const char *envname, const char *envval, int overwrite); DESCRIPTION
The setenv() function shall update or add a variable in the environment of the calling process. The envname argument points to a string containing the name of an environment variable to be added or altered. The environment variable shall be set to the value to which envval points. The function shall fail if envname points to a string which contains an '=' character. If the environment variable named by envname already exists and the value of overwrite is non-zero, the function shall return success and the environment shall be updated. If the envi- ronment variable named by envname already exists and the value of overwrite is zero, the function shall return success and the environment shall remain unchanged. If the application modifies environ or the pointers to which it points, the behavior of setenv() is undefined. The setenv() function shall update the list of pointers to which environ points. The strings described by envname and envval are copied by this function. The setenv() function need not be reentrant. A function that is not required to be reentrant is not required to be thread-safe. RETURN VALUE
Upon successful completion, zero shall be returned. Otherwise, -1 shall be returned, errno set to indicate the error, and the environment shall be unchanged. ERRORS
The setenv() function shall fail if: EINVAL The name argument is a null pointer, points to an empty string, or points to a string containing an '=' character. ENOMEM Insufficient memory was available to add a variable or its value to the environment. The following sections are informative. EXAMPLES
None. APPLICATION USAGE
See exec(), for restrictions on changing the environment in multi-threaded applications. RATIONALE
Unanticipated results may occur if setenv() changes the external variable environ. In particular, if the optional envp argument to main() is present, it is not changed, and thus may point to an obsolete copy of the environment (as may any other copy of environ). However, other than the aforementioned restriction, the developers of IEEE Std 1003.1-2001 intended that the traditional method of walking through the environment by way of the environ pointer must be supported. It was decided that setenv() should be required by this revision because it addresses a piece of missing functionality, and does not impose a significant burden on the implementor. There was considerable debate as to whether the System V putenv() function or the BSD setenv() function should be required as a mandatory function. The setenv() function was chosen because it permitted the implementation of the unsetenv() function to delete environmental variables, without specifying an additional interface. The putenv() function is available as an XSI extension. The standard developers considered requiring that setenv() indicate an error when a call to it would result in exceeding {ARG_MAX}. The requirement was rejected since the condition might be temporary, with the application eventually reducing the environment size. The ulti- mate success or failure depends on the size at the time of a call to exec, which returns an indication of this error condition. FUTURE DIRECTIONS
None. SEE ALSO
exec(), getenv(), unsetenv(), the Base Definitions volume of IEEE Std 1003.1-2001, <stdlib.h>, <sys/types.h>, <unistd.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 SETENV(3P)
All times are GMT -4. The time now is 03:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy