resmgr_attach and _RESMGR_FLAG_EXCL

What happened to _RESMGR_FLAG_EXCL, why was it removed?
And whats the correct workaround to ensure a no-race-condition
exclusive resmgr_attach?

Thanks in advance!

Cheers,
-RK


Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at www.parse.com.
Email my initials at parse dot com.

David Gibbs <dagibbs@qnx.com> wrote:

Robert Krten <> nospam83@parse.com> > wrote:
What happened to _RESMGR_FLAG_EXCL, why was it removed?
And whats the correct workaround to ensure a no-race-condition
exclusive resmgr_attach?

Um…try a name_attach() first…whoever win’s the name_attach()
does the resmgr_attach()? > :slight_smile:

Thanks, I’ll give that a try – any insight as to why it was
removed? It just seems so, oh, I don’t know, USEFUL! :slight_smile:

Cheers,
-RK

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.


Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at www.parse.com.
Email my initials at parse dot com.

Robert Krten <nospam83@parse.com> wrote:

What happened to _RESMGR_FLAG_EXCL, why was it removed?
And whats the correct workaround to ensure a no-race-condition
exclusive resmgr_attach?

Um…try a name_attach() first…whoever win’s the name_attach()
does the resmgr_attach()? :slight_smile:

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Robert Krten <nospam83@parse.com> wrote:

David Gibbs <> dagibbs@qnx.com> > wrote:
Robert Krten <> nospam83@parse.com> > wrote:
What happened to _RESMGR_FLAG_EXCL, why was it removed?
And whats the correct workaround to ensure a no-race-condition
exclusive resmgr_attach?

Um…try a name_attach() first…whoever win’s the name_attach()
does the resmgr_attach()? > :slight_smile:

Thanks, I’ll give that a try – any insight as to why it was
removed? It just seems so, oh, I don’t know, USEFUL! > :slight_smile:

I have no idea. I don’t actually remember it being around. It is
not documented in my Neutrino v2.0 printed docs (1999), so it hasn’t
been around for quite a while.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

David Gibbs <dagibbs@qnx.com> wrote:

Robert Krten <> nospam83@parse.com> > wrote:
David Gibbs <> dagibbs@qnx.com> > wrote:
Robert Krten <> nospam83@parse.com> > wrote:
What happened to _RESMGR_FLAG_EXCL, why was it removed?
And whats the correct workaround to ensure a no-race-condition
exclusive resmgr_attach?

Um…try a name_attach() first…whoever win’s the name_attach()
does the resmgr_attach()? > :slight_smile:

Thanks, I’ll give that a try – any insight as to why it was
removed? It just seems so, oh, I don’t know, USEFUL! > :slight_smile:

I have no idea. I don’t actually remember it being around. It is
not documented in my Neutrino v2.0 printed docs (1999), so it hasn’t
been around for quite a while.

Huh. You’re right :slight_smile: I seem to recall it being there around
Neutrino 1.00 – and now it lives in the resmgr_compat.h module
as a #define 0.

Oh well…

Thanks,
-RK

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.


Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at www.parse.com.
Email my initials at parse dot com.

Kris Warkentin <kewarken@qnx.com> wrote:

“Robert Krten” <> nospam83@parse.com> > wrote in message
news:avvfo2$ad9$> 1@inn.qnx.com> …
I have no idea. I don’t actually remember it being around. It is
not documented in my Neutrino v2.0 printed docs (1999), so it hasn’t
been around for quite a while.

Huh. You’re right > :slight_smile: > I seem to recall it being there around
Neutrino 1.00 – and now it lives in the resmgr_compat.h module
as a #define 0.

Time for an updated 2nd edition of you book I guess.

Hah! It’s not in my book – I think someone caught that already.
It’s just stuck in my brain :slight_smile:

Cheers,
-RK

\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at www.parse.com.
Email my initials at parse dot com.

“Robert Krten” <nospam83@parse.com> wrote in message
news:avvfo2$ad9$1@inn.qnx.com

I have no idea. I don’t actually remember it being around. It is
not documented in my Neutrino v2.0 printed docs (1999), so it hasn’t
been around for quite a while.

Huh. You’re right > :slight_smile: > I seem to recall it being there around
Neutrino 1.00 – and now it lives in the resmgr_compat.h module
as a #define 0.

Time for an updated 2nd edition of you book I guess.

:wink:

Kris

Hi David could you just give a little explanation about this trick?
Thanks,
Alain.

David Gibbs a écrit:

Robert Krten <> nospam83@parse.com> > wrote:


What happened to _RESMGR_FLAG_EXCL, why was it removed?
And whats the correct workaround to ensure a no-race-condition
exclusive resmgr_attach?



Um…try a name_attach() first…whoever win’s the name_attach()
does the resmgr_attach()? > :slight_smile:

-David

David, could you give us some detail on how that works? I thought
name_attach() just called resmgr_attach. Also, the docs don’t mention
name_attach() returning an error if the name already exists.

Murf

David Gibbs wrote:

Robert Krten <> nospam83@parse.com> > wrote:
What happened to _RESMGR_FLAG_EXCL, why was it removed?
And whats the correct workaround to ensure a no-race-condition
exclusive resmgr_attach?

Um…try a name_attach() first…whoever win’s the name_attach()
does the resmgr_attach()? > :slight_smile:

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

name_attach() IS calling resmgr_attach() (may change later though), but
it have special arrangement.

  1. non-root application CAN call name_attach() (normally only root
    applicaiton
    can resmgr_attach())

  2. because of one, no multiple attach to same name. (otherwise, you can have
    a
    bad non-root guy, just attach to same name and “hijack” your clients).

  3. is translated to “exclusively attach” :slight_smile:

-xtang

John A. Murphy <murf@perftech.com> wrote in message
news:3E26BE21.D02DAACF@perftech.com

David, could you give us some detail on how that works? I thought
name_attach() just called resmgr_attach. Also, the docs don’t mention
name_attach() returning an error if the name already exists.

Murf

David Gibbs wrote:

Robert Krten <> nospam83@parse.com> > wrote:
What happened to _RESMGR_FLAG_EXCL, why was it removed?
And whats the correct workaround to ensure a no-race-condition
exclusive resmgr_attach?

Um…try a name_attach() first…whoever win’s the name_attach()
does the resmgr_attach()? > :slight_smile:

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Wow, now I’m really confused! I don’t see how 2) follows from 1), and looking
at the source for name_attach() in the CVS log for lib/c/dispatch/name.c I don’t
see how the difference between root and non-root applications is detected. What
am I missing?

Murf

Xiaodan Tang wrote:

name_attach() IS calling resmgr_attach() (may change later though), but
it have special arrangement.

  1. non-root application CAN call name_attach() (normally only root
    applicaiton
    can resmgr_attach())

  2. because of one, no multiple attach to same name. (otherwise, you can have
    a
    bad non-root guy, just attach to same name and “hijack” your clients).

  3. is translated to “exclusively attach” > :slight_smile:

-xtang

John A. Murphy <> murf@perftech.com> > wrote in message
news:> 3E26BE21.D02DAACF@perftech.com> …
David, could you give us some detail on how that works? I thought
name_attach() just called resmgr_attach. Also, the docs don’t mention
name_attach() returning an error if the name already exists.

Murf

David Gibbs wrote:

Robert Krten <> nospam83@parse.com> > wrote:
What happened to _RESMGR_FLAG_EXCL, why was it removed?
And whats the correct workaround to ensure a no-race-condition
exclusive resmgr_attach?

Um…try a name_attach() first…whoever win’s the name_attach()
does the resmgr_attach()? > :slight_smile:

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

John A. Murphy <murf@perftech.com> wrote in message
news:3E26D305.B974DB39@perftech.com

Wow, now I’m really confused! I don’t see how 2) follows from 1), and
looking
at the source for name_attach() in the CVS log for lib/c/dispatch/name.c I
don’t
see how the difference between root and non-root applications is detected.
What
am I missing?

The enforcement is in the path manager (procnto). It check for any attach of
_FTYPE_NAME, and let non-root application attach it if the path is not
taken.

If you have an application name_attach() “mysrv”. If no exclusive enforced,
somebody could name_attach() “mysrv” again, and “cheat” the clients doing
name_open(“mysrv”) that he IS you. This is not a threat for resmgr_attach(),
because the “somebody” have to obtain root permissition to attach.

-xtang

Murf

Xiaodan Tang wrote:

name_attach() IS calling resmgr_attach() (may change later though), but
it have special arrangement.

  1. non-root application CAN call name_attach() (normally only root
    applicaiton
    can resmgr_attach())

  2. because of one, no multiple attach to same name. (otherwise, you can
    have
    a
    bad non-root guy, just attach to same name and “hijack” your
    clients).

  3. is translated to “exclusively attach” > :slight_smile:

-xtang

John A. Murphy <> murf@perftech.com> > wrote in message
news:> 3E26BE21.D02DAACF@perftech.com> …
David, could you give us some detail on how that works? I thought
name_attach() just called resmgr_attach. Also, the docs don’t mention
name_attach() returning an error if the name already exists.

Murf

David Gibbs wrote:

Robert Krten <> nospam83@parse.com> > wrote:
What happened to _RESMGR_FLAG_EXCL, why was it removed?
And whats the correct workaround to ensure a no-race-condition
exclusive resmgr_attach?

Um…try a name_attach() first…whoever win’s the name_attach()
does the resmgr_attach()? > :slight_smile:

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Ah, I see! Thanks you!

Murf

Xiaodan Tang wrote:

John A. Murphy <> murf@perftech.com> > wrote in message
news:> 3E26D305.B974DB39@perftech.com> …
Wow, now I’m really confused! I don’t see how 2) follows from 1), and
looking
at the source for name_attach() in the CVS log for lib/c/dispatch/name.c I
don’t
see how the difference between root and non-root applications is detected.
What
am I missing?

The enforcement is in the path manager (procnto). It check for any attach of
_FTYPE_NAME, and let non-root application attach it if the path is not
taken.

If you have an application name_attach() “mysrv”. If no exclusive enforced,
somebody could name_attach() “mysrv” again, and “cheat” the clients doing
name_open(“mysrv”) that he IS you. This is not a threat for resmgr_attach(),
because the “somebody” have to obtain root permissition to attach.

-xtang


Murf

Xiaodan Tang wrote:

name_attach() IS calling resmgr_attach() (may change later though), but
it have special arrangement.

  1. non-root application CAN call name_attach() (normally only root
    applicaiton
    can resmgr_attach())

  2. because of one, no multiple attach to same name. (otherwise, you can
    have
    a
    bad non-root guy, just attach to same name and “hijack” your
    clients).

  3. is translated to “exclusively attach” > :slight_smile:

-xtang

John A. Murphy <> murf@perftech.com> > wrote in message
news:> 3E26BE21.D02DAACF@perftech.com> …
David, could you give us some detail on how that works? I thought
name_attach() just called resmgr_attach. Also, the docs don’t mention
name_attach() returning an error if the name already exists.

Murf

David Gibbs wrote:

Robert Krten <> nospam83@parse.com> > wrote:
What happened to _RESMGR_FLAG_EXCL, why was it removed?
And whats the correct workaround to ensure a no-race-condition
exclusive resmgr_attach?

Um…try a name_attach() first…whoever win’s the name_attach()
does the resmgr_attach()? > :slight_smile:

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.