Antwort: AW: linux-l: AW: Zwei Dateien vergleichen

Siegfried Pohl spohl at bert.in-berlin.de
Fr Apr 16 20:43:43 CEST 1999


*Vogler, Hartmut <Hartmut.Vogler at telekom.de> wrote:
> 
> > Ist auch nicht ganz korrekt. Bei der Neuvergabe der PID's werden nur die
> > freien
> > Nummern vergeben. Eingeschraenkt ist nur die Gesamtzahl der parallel
> > laufenden
> > Prozesse (halt 32768).
> > 
> > 
> Da man diesen Thread noch Jahre weiter führen kann, hier nun die finale
> Aussage:
> Kernelauszug:
> 
> static int get_pid(unsigned long flags)
> {
>         static int next_safe = PID_MAX;
>         struct task_struct *p;
> 
>         if (flags & CLONE_PID)
>                 return current->pid;
> 
>         spin_lock(&lastpid_lock);
>         if((++last_pid) & 0xffff8000) {
>                 last_pid = 300;         /* Skip daemons etc. */
>                 goto inside;
>         }
>         if(last_pid >= next_safe) {
> inside:
>                 next_safe = PID_MAX;
>                 read_lock(&tasklist_lock);
>         repeat:
>                 for_each_task(p) {
>                         if(p->pid == last_pid   ||
>                            p->pgrp == last_pid  ||
>                            p->pgrp == last_pid  ||
>                            p->session == last_pid) {
>                                 if(++last_pid >= next_safe) {
>                                         if(last_pid & 0xffff8000)
>                                                 last_pid = 300;
>                                         next_safe = PID_MAX;
>                                         goto repeat;
>                                 }
>                         }
>                         if(p->pid > last_pid && next_safe > p->pid)
>                                 next_safe = p->pid;
>                         if(p->pgrp > last_pid && next_safe > p->pgrp)
>                                 next_safe = p->pgrp;
>                         if(p->session > last_pid && next_safe > p->session)
>                                 next_safe = p->session;
>                 }
>                 read_unlock(&tasklist_lock);
>         }
>         spin_unlock(&lastpid_lock);
> 
>         return last_pid;
> }
> 
> Ich hoffe wir können uns nun wieder wichtigen Dingen witmen.
> 

Angeber


--
| Siegfried Pohl <spohl at bert.in-berlin.de> 
| http://www.in-berlin.de/User/bert
| Tel: +49 3381 718056; Fax: +49 3381 718058 
| -> Real men dont use WYSIWYG editors; they use YAFIYGI editors
| -> like vi/ex (You Asked For It You Got It) 



Mehr Informationen über die Mailingliste linux-l