How to programmatically set EXTSHM=ON for shmat()

  • Permalink
  • submit to reddit
  • Email
  • Follow


Hi,

I am looking for a way of setting EXTSHM=ON programmatically (in C)
such that it is recognised by shmat() calls in the same process (yes I
know it can be set in the environment at the shell level, but I don't
want to do that, I want it built into the application, library etc.). I
am using AIX 5.x. (see the shmat() man page for information about the
effect of setting the environment variable EXTSHM)

Simply coding a 'putenv("EXTSHM=ON")' only works for a subsequent
shmat() call if there is an exec() call after the putenv().

One kludgy way I have found (for a simple application) is to re-exec()
the main() of the program with EXTSHM=ON set, but this technique is not
suitable for hiding away in a library.

Does anybody know of any other way?

Thanks,
Greg

0
Reply gregn2211 (2) 1/10/2006 5:25:30 AM

See related articles to this posting


gregn2211 wrote:
> I am looking for a way of setting EXTSHM=ON programmatically (in C)
> such that it is recognised by shmat() calls in the same process (yes I
> know it can be set in the environment at the shell level, but I don't
> want to do that, I want it built into the application, library etc.).

You can't.  It takes effect at exec time, and by then it's too late.
You either set it in your shell, or use putenv/exec, or use a
shell script wrapper for your application.  No other options.

> the main() of the program with EXTSHM=ON set, but this technique is not
> suitable for hiding away in a library.

Why on earth are you trying to hide on OS-level setting?  If your
code requires EXTSHM, document the requirement and get on with
your life.
0
Reply noway (263) 1/12/2006 3:24:20 AM

Hi Gary,

I just think the usage of this EXTSHM environment variable is kludgy,
and the developers of AIX could have achieved the same thing in a much
better way using an API or maybe even a linker option etc. (considering
that EXTSHM has performance ramifications and setting it can actually
break existing applications). Other UNIXes dont have such a restriction
on the number of shared memory segments used by an app, and even if
they did, they certainly wouldn't control it using an environment
variable. That's why I am trying to hide it, because I dont want to
have the requirement that some stupid environment variable be set prior
to running the software, the software should be able to set it itself.
Obviously a shell script wrapper is OK for confining the setting to a
particular application, but if you are just writing a plugin library to
an existing application, then that's not really an option.
Anyway, thanks for your input. At the least, I can check if EXTSHM is
not set, and issue an error message.

Greg

0
Reply gregn2211 (2) 1/15/2006 10:59:08 PM
comp.unix.aix 10884 articles. 5 followers. Post

2 Replies
187 Views

Similar Articles

[PageSpeed] 24


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

Set onBlur() programmatically?
Is it possible to set the onBlur of a link or other focusable element programmatically? A search of the archive showed plenty of examples of setting the onBlur() for each link or form element when it was defined, but I am after something that can iterate all links in the page and add a common onBlur functionality to every one. [ I only require this to fix problems with particular pages, but then I need to apply the fix to whatever focusable elements are on the page. ] -- Andrew Thompson http://www.PhySci.org/ Open-source software suite http://www.PhySci.org/codes/ Web & IT Help h...

Setting DSN programmatically ?
Hello. I have a MS Access front-end working with PostgreSQL database. I have successfully created saved File DSN. My paa-through queries are referring to that file as well as linked tables. But I don't understand what will happen when I distribute my front-end to some other PC. How will Access know where is File DSN ? Is there any way that I set the connection programmatically. For example, some login form with neccessary informations ? Thanks. I use only DSN-less connections with SQL Server, Oracle and other databases. It makes things so much easier and so much more portable. Belo...

set LinkMasterFields programmatically
Hi: I have a database created in A2003 that I'm converting to A2007. It's throwing an error that's driving me crazy because the code has worked perfectly for years in A2003. I have a main form with an unbound subform, and I change the subform's recordsource based on what the user is doing. So there's some standard code that handles that switch. The subform is called "changeSub" ....snip Me!changeSub.SourceObject = "xxx subform" Me!changeSub.LinkMasterFields = "callID" Me!changeSub.LinkChildFields = "callID&q...

Set textfield programmatically
Can someone explain how to programmatically set the text in a textfield in an iPhone app? A code snippet would be very helpful. Thanks. In article <gqh80605tl@enews2.newsguy.com>, "fripper" <young@indiana.edu> wrote: > Can someone explain how to programmatically set the text in a textfield in > an iPhone app? A code snippet would be very helpful. > > Thanks. [textField setText:@"some Text"]; That doesn't work. Do I need to use Interface Builder to make some sort of connection between the test field control and my ...

programmatically set a Favourites Folder
Hi. Is there a way in SAS 9.1.3 on Windows XP to programmatically create a Favourite Folder for use in the Explorer Dock in the SAS environment? Thanks, Jared Jared, I would still take a look at the two threads mentioned in my previous post. If you combine those ideas with the idea provided in the following thread ( http://xrl.us/uase ), namely permanently assigning a libname in an autoexec.sas file, I think you may be able to accomplish what you want. Art --------- On Tue, 16 Jan 2007 21:17:01 -0800, webonomic <webonomic@GMAIL.COM> wrote: >I'll clarify. Just like a pers...

Set Page Scaling programmatically
I'm creating a PDF document using FOP but to print it correctly, I have to set Page Scaling to None in the print dialog box. Is there a way to programmically stop page scaling (ie default it to None?) Thanks for help. ...

How to programmatically set a tunable parameter?
In Simulink, if you set the inline option in the Configuration/Optimization for your model, you can make a parameter tunable by hitting the Configure button and adding it to the Global (tunable) parameters list. I want to perform the same functionality programmatically yet I have been unable to find a Matlab command to do this? Can this be done programmatically? There are a couple of ways to tackle this. A. If you are using straight MATLAB variables for your parameters, e.g. you say K1 = MyValue to create the parameters, then you need to set the following 2 model properties. set_param(gcs,...

Set volume label programmatically ?
Hi, Is there a way of setting the volume label programmatically on VMS ? Any system services to achive the same as SET VOLUME / LABEL -Malav Malav wrote: > Hi, > > Is there a way of setting the volume label programmatically on VMS ? > Any system services to achive the same as SET VOLUME / LABEL > > -Malav > I don't think so. I did a quick scan of the code for SET VOLUME and it is does it 'by hand'. So you are left with LIB$SPAWN. -- John Reagan HP Pascal/{A|I}MACRO for OpenVMS Project Leader Hewlett-Packard Company In article <inYfg.1420$5R5....

Setting CGI parameter programmatically
I have a form with a couple of submit buttons, plus a "pseudolink" that is also supposed to submit the form; the submitted form data feeds to a CGI script. The two submit buttons have the name "go_for_it", so that when the form is submitted, the CGI script looks for the value of the CGI parameter "go_for_it". I want the pseudolink to set the value of this CGI parameter prior to submitting the form, but I can't get it to work. Here's the latest version of the HTML+JavaScript code for the pseudolink: <a onclick="var f = document.forms['...

programmatic processor sets trouble
Hi, In my program I'm trying to set myself to different processor sets at different times during execution. I've given myself PRIV_SYS_RES_CONFIG by adding sys_res_config to my entry in /etc/ user_attr so I think I should be able to do this. I'm doing something roughly like this (I've stripped error handling etc from this example): if (pset_exists) pset_destroy(pset); pset_create(&pset)) unsigned b = get_bitmask(), i = 0; while (b) { if (b&1) { pset_assign(pset, i, NULL); b >>= 1; i++; } pset_bind(pset, P_PID, P_MYID, NULL)) No errors o...

Programmatically setting the Toggle Key?
I want to programmatically change the Toggle Key settings for a Boolean control. I can easily use the server property ToggleKeyBind to revoke any settings (by creating a default constant), but try as I might, I can't work out how to set the Return Key to the Toggle. If I use '\n' to insert a return character key, I get an error: "Error 15, Resource Not Found." I just cannot figure out how to programmatically set the Return Key as the Toggle setting. Does anyone know how to do this?Thanks in advance for everyone's suggestions. Is there anything unclear in the online h...

Programmatically setting a radio buttones
I am trying to programmatically set a radio button in a table of radio buttons. I have two problems with the code below: 1 - I can not prepare the <Form> statement to be printed by php. (syntax of the hyphens, quotes) my fault! 2 - If I delete the <Form> and </Form> statements I can build the table of radio buttons correctly, HTML wise. The fifth radio button has 'checked=True'. The problem is even though I set radio button 5 to be checked only the last radio button is checked when it is displayed on the screen. But viewing the page code says it should be th...

Programmatically set up desktop shortcut
First question - how do you do it? Second - there must be other installation-related API calls, like insertion into Start..Programs.. and file associations. Clue? TIA On 15 Dec 2003 01:56:06 -0800, w.w.milner@bham.ac.uk (Walter Milner) wrote: >First question - how do you do it? I believe the proper function is SHCreateShortcut. But a shortcut is really a file, so you might be able to do it "by hand" (for Windows CE, the contents are plain text; for "big" Windows the contents are some other format). > >Second - there must be other installation-re...

Setting the virtual memory programmatically
Hi We have a requirement to set the virtual memory programatically in Windows Vista. =E2=80=A8i.e. when we launch a application, set the virtual memory(say 2GB). =E2=80=A8When we quit the application reset it to the original virtual memory. I have used VirtualAllocEx(). It works only when "Automatically manage paging file size for all drives" (This option is not there in Windows Xp). is selected in System Preference/Performance Options. It doesn't work when "Custom size" is selected in System Preference/ Performance Options(works fine in Windows Xp). =E...

set Action on Button programmatically.
thanks, hi All, i am creating NSButton Programmatically but when i setAction on NSButton which i created programmatically, but it is not working. NSButton *my = [[[NSButton alloc] initWithFrame: NSMakeRect(14,100,120,40)] autorelease]; [[window contentView] addSubview: my]; [my setTitle: @"Hide"]; [my setTarget:self]; [my setAction:@selector(invisible)]; [my setButtonType:NSMomentaryLightButton]; ...

Setting Microphone Gain programmatically
Hi I am working on windows mobile application development using both native C++ and embedded visual basic. I was wondering if there is any way to set the microphone settings like microphone gain, bass boost, trebble adjustment programmatically. primarily i am interested in enabling/disabling microphone gain settings and adjusting the manual gain to my desired figures of +3db, +9db etc .. I have read about the "mixerSetControlDetails" API. But it does not give any straight-forward and convincing implementation routine for setting the "microphone gain", whci...

Changing printer setting programmatically
I want print to another printer than default printer. // I generate a PRINTDLG structure using PrintDlg() pd.Flags= PD_RETURNDEFAULT | PD_NOSELECTION ; PrintDlg(&pd); //I've got now the settings for default printer. Let's change //pd.hDevaNames to something else lp=(DEVNAMES *)GlobalLock(pd.hDevNames); strcpy((char *)&lp[lp->wDriverOffset],"winspool"); //OK strcpy((char *)&lp[lp->wDeviceOffset],"Epson FX"); //Violation! .... What am I doing wrong? The lp structure is wDriverOffset is 8 wDeviceOffset is 17 wOutputOffset is 40...

Programmatically setting up logon script
Can i set up a logon script through my c++ program? If possible please tell me how to do it. Thanks in advance, John. johnemmatty@gmail.com writes: >Can i set up a logon script through my c++ program? If possible please >tell me how to do it. What exactly do you mean? Do you want to dynamically create and/or execute it at logon? If your program does that, then make a small logon script that calls your program... then let your program do the rest of the work. -- May no harm befall you, flip Ich habe keine Ahnung was das bedeutet, oder vielleicht doch? Remove origin ...

how can set window title programmatically
how to set the window title programmatically for example the main vi i have a combo box&nbsp; which stores some names exp: abc &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bcd &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cde then it will pass the data to another vi all the names use the same vi to display the data i want the window title to be the name of particular name user selected. &nbsp;can anyone help me? Hi jeyanthi, use a property node. connect the reference of the vi to it and select frontpanel-window -&gt; title. Mike ...

set visa resource name programmatically
There is a way to set visa resource name programmatically, &nbsp; ex; ini file look likes: &nbsp; Id&nbsp;&nbsp;&nbsp; port&nbsp; D1&nbsp; com2 D2&nbsp; com3 ... &nbsp; Thanks, &nbsp; LabView 8.0 ...

How do I get/set a shared variable programmatically?
I've seen discussions about how to get access to a shared variable programmatically, but I'm having trouble filling in the blanks.&nbsp; We are not using DSC or DataSockets.&nbsp; Here's what I want to do: I want to write a VI that operates on a pair of network shared variables.&nbsp; I have a number of shared variable pairs that I want to use my VI with.&nbsp; The VI reads one shared variable (numeric), does some operations, and writes to another variable (boolean).&nbsp; How do I write my VI so that it takes as an input references to the shared variables?&...

Re: Programmatically set datasocket url
Peter,<br><br>I think you might have to prime the pump a little bit by conf= iguring the relevant front panel controls on your VI to expect a DataSocket= connection before you actually run the VI and assign the connection(s).<br= ><br>For instance, if you've got a graph that you want to use to display da= ta, right-click on the graph, select Data Operations >> DataSocket Connecti= on..., give it some arbitrary URL (I used dstp://localhost/placeholder) tha= t doesn't correspond to any source that you actually plan to use, and save = your VI this way. As l...

Re: programmatically set a Favourites Folder
Jared, I'm not quite sure what you mean by either 'programatically' or 'Favourite Folder' but, possibly, one or both of the following past posts may lead you in the write direction: http://xrl.us/uamp and http://xrl.us/uamq Art ----------- On Tue, 16 Jan 2007 14:22:29 -0800, webonomic <webonomic@GMAIL.COM> wrote: >Hi. > >Is there a way in SAS 9.1.3 on Windows XP to programmatically create a >Favourite Folder for use in the Explorer Dock in the SAS environment? > >Thanks, > >Jared I'll clarify. Just like a person can create a libname wi...

Is it Possible to Programmatically Customizing Firefox3 Settings?
In my app (for Windows-based OS), I would need to 1. set the size (width and height) of Firefox (v3) upon launch; 2. set a download folder/directory, say, C:\myApp\createdFiles\, instead of default desktop or else; On Respect and Concern for user security: the app would request user permission to do so upfront and if a user chooses not to grant permission, the app would advise him/her to reset them for the app manually, the latter is clumsy but appropriate as well. A step further would be resetting these changes to user default upon exit of the app, fair enough? Another thing, to programma...