Re: kinfo_proc structure
Re: kinfo_proc structure
- Subject: Re: kinfo_proc structure
- From: mm w <email@hidden>
- Date: Thu, 2 Jul 2009 10:35:34 -0700
Hello,
> How can I handle these special cases?
It's why you need to plug the "CFBunleIdentifier" with your pid and
not only trust the executable name you have 3 parameters to work with
your equation has 3 members, moreover you have to make the difference
between a bundle process and a "regular" process.
myprocess {
pid;
CFBunleIdentifier;
exec;
myprocessotherinfo {};
};
I gave you all the tools you need to achieve your task.
> uid = ep->e_ucred.cr_uid;
>
> I feel this will work. I will try this soon.
it takes at least 34 sec (if you are slow) to plug this in your code... :-)
Best,
On Thu, Jul 2, 2009 at 9:38 AM, Rahulkumar
Tibdewal<email@hidden> wrote:
> Thanks for interest MIKE.
>
>
>
> I am preparing an application where I can manage the MAC machines processes.
>
> For example: quitting the process.
>
>
>
> For this I have prepared one kinfo_proc structure and populated it.
>
> Using kp_proc.p_comm and kp_proc.p_pid I am preparing a another structure
> CProcessEntry which has pid and process name
>
> and store that structure in vector array.
>
>
>
> Now when we pass particular name say firefox, it should be effective enough
> to quit firefox of only that user.
>
>
>
> To get the user id I got reply from [mm w] as below:
>
>
>
> struct _pcred e_pcred; /* process
> credentials */
>
> struct _ucred e_ucred; /* current
> credentials */
>
>
>
> struct kinfo_proc *kp;
>
> struct eproc *ep;
>
>
>
> ep = &kp->kp_eproc;
>
> uid = ep->e_ucred.cr_uid;
>
>
>
> I feel this will work. I will try this soon.
>
>
>
> Another problem was we don’t have always the same name of application and
> process name.
>
> Example, firefox.app application has process name firefox-bin. This will
> fail my application. I want to handle these cases.
>
>
>
> Again I got few pointers from [mm w]. But I don’t have clear Idea of its
> implementation.
>
>
>
> However I also discovered one more thing about java applications run under
> same process name JavaApplicationStub.
>
> If I have two or more Java Application there process name is same i.e.
> JavaApplicationStub But There PSN are different.
>
> How can I handle these special cases?
>
>
>
> Thanks
>
> Rahul
>
>
>
>
>
> From: Michael Smith [mailto:email@hidden]
> Sent: Thursday, July 02, 2009 9:50 PM
> To: Rahulkumar Tibdewal
> Cc: carbon-dev; email@hidden
> Subject: Re: kinfo_proc structure
>
>
>
>
>
> Rahul,
>
>
>
> You seem confused. What are you trying to do?
>
>
>
> Without explaining your overall objective, it will be difficult for us to
> give you relevant advice.
>
>
>
> = Mike
>
>
>
> On Jul 2, 2009, at 7:29 AM, Rahulkumar Tibdewal wrote:
>
> Hello Again,
>
>
>
> I just noticed few things between process names and there app names.
>
> For example, firefox.app process name is i.e. kp_proc.p_comm is firefox-bin.
>
> I am just confused. If this is the case then my application may fail for
> several cases.
>
> How can I handle these cases?
>
>
>
> Thanks
>
> Rahul
>
>
>
> From: Rahulkumar Tibdewal
> Sent: Thursday, July 02, 2009 6:48 PM
> To: carbon-dev; email@hidden
> Subject: kinfo_proc structure
>
>
>
> Hello All,
>
>
>
> I have a kinfo_proc populated. I am facing 2 problems mainly.
>
>
>
> 1. This one may be simple to answer but it is giving me tough time.
>
> I want to find the user id with the associated process id. Process id is
> already available to us from kinfo_proc.
>
>
>
> 2. Another one is little wired. Once kinfo_proc is populated, one can
> think that it has been populated by all running process in the system.
>
> Whereas it misses one ccollabgui.app process. And I can see its entry from
> ps-ef. Am I missing something?
>
>
>
> Any help is highly appreciated.
>
>
>
> Thanks
>
> Rahul
>
> DISCLAIMER ========== This e-mail may contain privileged and confidential
> information which is the property of Persistent Systems Ltd. It is intended
> only for the use of the individual or entity to which it is addressed. If
> you are not the intended recipient, you are not authorized to read, retain,
> copy, print, distribute or use this message. If you have received this
> communication in error, please notify the sender and delete all copies of
> this message. Persistent Systems Ltd. does not accept any liability for
> virus infected mails.
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-kernel mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
>
>
> --
>
> Ars longa, vita brevis, occasio praeceps, experimentum periculosum, iudicium
> difficile -- Hippocrates
>
>
>
>
>
>
>
>
>
>
>
>
>
> DISCLAIMER ========== This e-mail may contain privileged and confidential
> information which is the property of Persistent Systems Ltd. It is intended
> only for the use of the individual or entity to which it is addressed. If
> you are not the intended recipient, you are not authorized to read, retain,
> copy, print, distribute or use this message. If you have received this
> communication in error, please notify the sender and delete all copies of
> this message. Persistent Systems Ltd. does not accept any liability for
> virus infected mails.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden