All the answers are in the emc.nml file.
Currently a component called emcsvr (emc server) is the master of NML 
channels.
It is started pretty early in the 'emc' runscript, before task and the GUI 
are started.

If you want to have a different approach, you can have your component as the 
master (but then you can't hijack the xemc entry from the nml, as the GUIs 
also use that).
It would work to add a new name (mycomp), have it set up as the master, 
clear the master flag from emcsvr. Then you need to make sure you start your 
component first, and you try to open all NML channels from the ini.
When a new process tries to open a NML channel, it checks first if it's a 
master or not. If it is, it initializes the channel rather than connecting 
to it.

Regards,
Alex


----- Original Message ----- 
From: "Frank Tkalcevic" <[email protected]>
To: "'EMC developers'" <[email protected]>
Sent: Tuesday, July 21, 2009 12:48
Subject: Re: [Emc-developers] Shared memory errors


>I think I can partly answer my own questions...
>
> It appears that the important MASTER bit needs to be up and running first.
> If I load my component after emc has started, it works.  I'm currently 
> using
> the POSTGUI_HALFILE to do this.  Obviously my code wasn't working as I
> thought.
>
> Some questions...
>
> Who is the master, and who is responsible for starting him?
> I have a usr component, with pins and parameters, that also wants to 
> monitor
> the emc statuses.  Is there any notifications that tell me the master is 
> up
> and I can connect?  Or should I just keep trying periodically to connect
> until successful?
>
> Thanks,
> Frank
>
>> -----Original Message-----
>> From: Frank Tkalcevic [mailto:[email protected]]
>> Sent: Tuesday, 21 July 2009 6:50 PM
>> To: 'EMC developers'
>> Subject: Shared memory errors
>>
>> I've been writing a component, based on emclcd.cc and
>> shcom.cc.  I think the code was working - it would start up
>> in a halrun, but now it fails to start with nml errors.
>>
>> I'm not sure how the shared memory works.  Do I need to
>> allocate a new key(?) for my application?  I just took
>> shcom.cc which uses "xemc".
>>
>> My component is also a usr component.  Can it connect to the
>> share memory buffers?
>>
>> Can someone point me in the right direction?
>>
>> This is a snippet of the errors.....
>>
>>
>>
>> libnml/os_intf/_shm.c 206: shmget(1001(0x3E9),8192,0) failed:
>> (errno = 2): No such file or directory libnml/os_intf/_shm.c
>> 225: No shared memory buffer exists for this key and the
>> IPC_CREAT was not given.
>> shmctl: Invalid argument
>> libnml/cms/cms_cfg.cc 905: cms_config:
>> -4(CMS_NO_MASTER_ERROR: An error occured becouse the master
>> was not started.) Error occured during SHMEM create.
>> libnml/nml/nml.cc 368: NML: cms_config returned -1.
>>
>> **********************************************************
>> * Current Directory = /home/frankt/emc2/config/sim
>> *
>> **********************************************************
>> * BufferName = emcCommand
>> * BufferType = 0
>> * ProcessName = xemc
>> * Configuration File = emc.nml
>> * CMS Status = -4 (CMS_NO_MASTER_ERROR: An error occured
>> becouse the master was not started.)
>> * Recent errors repeated:
>> NML: cms_config returned -1.
>>
>> shmget(1001(0x3E9),8192,0) failed: (errno = 2): No such file
>> or directory
>>
>> No shared memory buffer exists for this key and the IPC_CREAT
>> was not given.
>>
>> cms_config: -4(CMS_NO_MASTER_ERROR: An error occured becouse
>> the master was not started.) Error occ
>> * BufferLine: B emcCommand            SHMEM   localhost
>> 8192    0       0       1       16 1001 TCP=5005 xdr
>> * ProcessLine: P xemc          emcCommand      LOCAL
>> localhost       W       0       10.0    0       10
>> * Config File = emc.nml
>> * error_type = 0 (NML_NO_ERROR)
>> ************************************************************
>>
>> libnml/os_intf/_shm.c 206: shmget(1002(0x3EA),10240,0)
>> failed: (errno = 2): No such file or directory
>> libnml/os_intf/_shm.c 225: No shared memory buffer exists for
>> this key and the IPC_CREAT was not given.
>> shmctl: Invalid argument
>> libnml/cms/cms_cfg.cc 905: cms_config:
>> -4(CMS_NO_MASTER_ERROR: An error occured becouse the master
>> was not started.) Error occured during SHMEM create.
>> libnml/nml/nml.cc 368: NML: cms_config returned -1.
>>
>> **********************************************************
>> * BufferName = emcStatus
>> * BufferType = 0
>> * ProcessName = xemc
>> * Configuration File = emc.nml
>> * CMS Status = -4 (CMS_NO_MASTER_ERROR: An error occured
>> becouse the master was not started.)
>> * Recent errors repeated:
>>
>
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full 
> prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Emc-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/emc-developers
> 


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to