NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/53125: sys/timevar.h is absent in installed systems.



The following reply was made to PR lib/53125; it has been noted by GNATS.

From: Utkarsh Anand <utkarsh009%yandex.com@localhost>
To: "gnats-bugs%NetBSD.org@localhost" <gnats-bugs%netbsd.org@localhost>
Cc: 
Subject: Re: lib/53125: sys/timevar.h is absent in installed systems.
Date: Sun, 25 Mar 2018 11:41:51 +0530

 25.03.2018, 06:36, "Utkarsh Anand" <utkarsh009%yandex.com@localhost>:
 > I'll see what needs to be done and also check if kvm_getproc2() solves the issue and report back after sometime.
 https://github.com/neovim/neovim/blob/f8d2aef4f20887bb5a407b5a34cd5dc29fc6771c/src/nvim/os/process.c#L169
 The above line feeds in all the constants/macros (which seek to extract out all the processes), and populates p_list with all the processes (which we want to be of kinfo_proc2()) 
 https://github.com/neovim/neovim/blob/f8d2aef4f20887bb5a407b5a34cd5dc29fc6771c/src/nvim/os/process.c#L179
 The above line intends to find out if the parent (i.e. the the process having its process id equal to `ppid' variable in the program) exists in the list of processes (p_list). If not it will  return with an exit code of 1 right here: https://github.com/neovim/neovim/blob/f8d2aef4f20887bb5a407b5a34cd5dc29fc6771c/src/nvim/os/process.c#L187
 https://github.com/neovim/neovim/blob/f8d2aef4f20887bb5a407b5a34cd5dc29fc6771c/src/nvim/os/process.c#L180
 The above line checks if the process in the current iteration has a parent process id equal to `ppid' (i.e. it is, if it is an immediate child of the parent). If so, it stores its pid in `temp' and increases `proc_count' by 1.
 The problem with kvm_getproc2() is that it requires the first argument to be of type kvm_t (which should hold the list of processes which is to be bifurcated). Where should we get that argument from? Furthermore, the man page says that we can get a list of all the processes by using `KERN_PROC_ALL' and https://nxr.netbsd.org/xref/src/lib/libkvm/kvm_proc.c#496 confirms that we don't need `name' to get it because we already have those extra constants/macros in there. So, the only problem seems to be to figure out what the rest of the arguments should be, and then we can replace sysctl(). The next snippet (which I've described above this paragraph), should remain the same.
 https://github.com/neovim/neovim/blob/f8d2aef4f20887bb5a407b5a34cd5dc29fc6771c/src/nvim/os/process.c#L155
 The above macros should automatically detect the required members, so now we don't need any special conditionals.
 
 Do note, however, that I am yet to test these changes. I will report back once after today's power cut is over (There's a festival today that requires power cut for, in worst case, until evening).
 


Home | Main Index | Thread Index | Old Index