aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
...
| * | | | | build/windows: Ignore whitespace when applying patchesb-r-o-c-k2018-03-18
| |/ / / / | | | | | | | | | | | | | | | | | | | | The --ignore-whitespace argument was added when applying patches to prevent failures when patched files have different line endings.
* / / / / log/channels: Formatting. Also log loopback channel. #8146Justin M. Keyes2018-03-18
|/ / / /
* | | | Merge #8107 'jobs: separate process-group'Justin M. Keyes2018-03-18
|\ \ \ \
| * | | | test/win: use cmd.exe for testJustin M. Keyes2018-03-18
| | | | | | | | | | | | | | | | | | | | Can revert this after #8120.
| * | | | test: jobstop() kills entire process treeJustin M. Keyes2018-03-18
| | | | | | | | | | | | | | | | | | | | | | | | | Test correctly fails before 8d90171f8be6. ref #6530
| * | | | API: nvim_get_proc()Justin M. Keyes2018-03-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TODO: "exepath" field (win32: QueryFullProcessImageName()) On unix-likes `ps` is used because the platform-specific APIs are a nightmare. For reference, below is a (incomplete) attempt: diff --git a/src/nvim/os/process.c b/src/nvim/os/process.c index 09769925aca5..99afbbf290c1 100644 --- a/src/nvim/os/process.c +++ b/src/nvim/os/process.c @@ -208,3 +210,60 @@ int os_proc_children(int ppid, int **proc_list, size_t *proc_count) return 0; } +/// Gets various properties of the process identified by `pid`. +/// +/// @param pid Process to inspect. +/// @return Map of process properties, empty on error. +Dictionary os_proc_info(int pid) +{ + Dictionary pinfo = ARRAY_DICT_INIT; +#ifdef WIN32 + +#elif defined(__APPLE__) + char buf[PROC_PIDPATHINFO_MAXSIZE]; + if (proc_pidpath(pid, buf, sizeof(buf))) { + name = getName(buf); + PUT(pinfo, "exepath", STRING_OBJ(cstr_to_string(buf))); + return name; + } else { + ILOG("proc_pidpath() failed for pid: %d", pid); + } +#elif defined(BSD) +# if defined(__FreeBSD__) +# define KP_COMM(o) o.ki_comm +# else +# define KP_COMM(o) o.p_comm +# endif + struct kinfo_proc *proc = kinfo_getproc(pid); + if (proc) { + PUT(pinfo, "name", cstr_to_string(KP_COMM(proc))); + xfree(proc); + } else { + ILOG("kinfo_getproc() failed for pid: %d", pid); + } + +#elif defined(__linux__) + char fname[256] = { 0 }; + char buf[MAXPATHL]; + snprintf(fname, sizeof(fname), "/proc/%d/comm", pid); + FILE *fp = fopen(fname, "r"); + // FileDescriptor *f = file_open_new(&error, fname, kFileReadOnly, 0); + // ptrdiff_t file_read(FileDescriptor *const fp, char *const ret_buf, + // const size_t size) + if (fp == NULL) { + ILOG("fopen() of /proc/%d/comm failed", pid); + } else { + size_t n = fread(buf, sizeof(char), sizeof(buf) - 1, fp); + if (n == 0) { + WLOG("fread() of /proc/%d/comm failed", pid); + } else { + size_t end = MIN(sizeof(buf) - 1, n); + end = (end > 0 && buf[end - 1] == '\n') ? end - 1 : end; + buf[end] = '\0'; + PUT(pinfo, "name", STRING_OBJ(cstr_to_string(buf))); + } + } + fclose(fp); +#endif + return pinfo; +}
| * | | | win: nvim_get_proc_children()Justin M. Keyes2018-03-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TODO: Raymond Chen explains[1] racy behavior of the CreateToolhelp32Snapshot approach. Better approach: > create a job object and put process P in it. Then call > QueryInformationJobObject with JobObjectBasicProcessIdList to get the > list of child processes. [1] "Why is CreateToolhelp32Snapshot returning incorrect parent process IDs all of a sudden?" https://blogs.msdn.microsoft.com/oldnewthing/20150403-00/?p=44313
| * | | | nvim_get_proc_children: fallback to shellJustin M. Keyes2018-03-16
| | | | | | | | | | | | | | | | | | | | | | | | | /proc/…/children may be unavailable because of an unset kernel option. Fallback to `pgrep` invoked in a shell.
| * | | | API: nvim_get_proc_children()Justin M. Keyes2018-03-16
| | | | | | | | | | | | | | | | | | | | ref https://github.com/libuv/libuv/pull/836
| * | | | win: os_proc_tree_kill()Justin M. Keyes2018-03-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | XXX: comment at https://stackoverflow.com/q/1173342 : > Windows recycles PIDs quite fast, you have to be extra careful not > to kill unrelated processes. These APIs will report PPIDs for long > dead processes whose PIDs may have been recycled. Check the parent > start date to make sure it is related to the processes you spawned.
| * | | | jobs: child proc must have a separate process-groupJustin M. Keyes2018-03-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UV_PROCESS_DETACHED compels libuv:uv__process_child_init() to call setsid() in the child just after fork(). That ensures the process and its descendants are grouped in a separate session (and process group). The following jobstart() call correctly groups `sh` and `sleep` in a new session (and process-group), where `sh` is the "session leader" (and process-group leader): :call jobstart(['sh','-c','sleep 60']) SESN PGRP PID PPID Command 30383 30383 30383 3620 │ ├─ -bash 30383 31432 31432 30383 │ │ └─ nvim -u NORC 30383 31432 31433 30383 │ │ ├─ nvim -u NORC 8105 8105 8105 31432 │ │ └─ sh -c sleep 60 8105 8105 8106 8105 │ │ └─ sleep 60 closes #6530 ref: https://stackoverflow.com/q/1046933 ref: https://unix.stackexchange.com/a/404065 Helped-by: Marco Hinz <mh.codebro+github@gmail.com> Discussion ------------------------------------------------------------------------ On my linux box before this patch, the termclose_spec.lua:'kills job trapping SIGTERM' test indirectly causes cmake/busted to wait for 60s. That's because the test spawns a `sleep 60` descendant process which hangs around even after nvim exits: nvim killed the parent PID, but not PGID (process-group), so the grandchild "reparented" to init (PID 1). Session contains processes (and process-groups) which are logically part of the same "login session". Process-group is a set of logically/informally-related processes within a session; for example, shells assign a process group to each "job". Session IDs and PGIDs both have type pid_t (like PIDs). These OS-level mechanisms are, as usual, legacy accidents whose purpose is upheld by convention and folklore. We can use session-level grouping (setsid), or we could use process-group-level grouping (setpgid). Vim uses setsid() if available, otherwise setpgid(0,0). Windows ------------------------------------------------------------------------ UV_PROCESS_DETACHED on win32 sets CREATE_NEW_PROCESS_GROUP flag. But uv_kill() does not kill the process-group: https://github.com/nodejs/node/issues/3617 Ideas: - Set UV_PROCESS_DETACHED (CREATE_NEW_PROCESS_GROUP), then call GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, pid) - Maybe won't work because MSDN says "Only processes that share the same console as the calling process receive the signal." https://docs.microsoft.com/en-us/windows/console/generateconsolectrlevent But CREATE_NEW_PROCESS_GROUP creates a new console ... ref https://stackoverflow.com/q/1453520 - Group processes within a "job". libuv does that *globally* for non-detached processes: uv__init_global_job_handle. - Iterate through CreateToolhelp32Snapshot(). - https://stackoverflow.com/q/1173342 - Vim does this, see terminate_all()
| * | | | test: use luv.now() instead of os.time()Justin M. Keyes2018-03-16
| | | | |
* | | | | screen.c: define column width by function (#5802)Matthieu Coudron2018-03-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This does not change the behavior but centralizes column size for future use (like dynamic signcolumn width depending on the maximum number of signs on a line). The returned value is limited by the size of the `extra` tab in win_line (currently allows for 18 ASCII characters).
* | | | | Merge #8142 'build/msvc: fix some warnings'Justin M. Keyes2018-03-18
|\ \ \ \ \
| * | | | | build/MSVC: fix "C4005: RGB: macro redefinition"Justin M. Keyes2018-03-18
| | | | | |
| * | | | | build/MSVC: fix "C4003: not enough actual parameters for macro"Justin M. Keyes2018-03-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the case of TV_DICTITEM_STRUCT, we can't just pass `1` because: https://github.com/neovim/neovim/pull/8142#discussion_r175262436 > this variant will trigger array overrun warnings from various static analyzers.
| * | | | | build/MSVC: fix "C4028: formal parameter different from declaration"Justin M. Keyes2018-03-18
| | | | | |
| * | | | | ci/travis: report cache sizeJustin M. Keyes2018-03-18
| | | | | |
| * | | | | ci/travis: also cache $DEPS_DOWNLOAD_DIRJustin M. Keyes2018-03-18
| | | | | | | | | | | | | | | | | | | | | | | | ref #5166
| * | | | | ci/travis: Don't destroy cache during prepareJustin M. Keyes2018-03-17
|/ / / / / | | | | | | | | | | | | | | | | | | | | This change was missed in c7f95fde1bb1. ref #5166
* / / / / vim-patch:8.0.0344: unlet command leaks memory (#8141)KunMing Xie2018-03-17
|/ / / / | | | | | | | | | | | | | | | | Problem: Unlet command leaks memory. (Nikolai Pavlov) Solution: Free the memory on error. (closes vim/vim#1497) https://github.com/vim/vim/commit/49439c4cdf7d2822255f292adda4226656fe144d
* | | | DirChanged: support <buffer> (#8140)Marco Hinz2018-03-16
| | | |
* | | | doc: nodejsJustin M. Keyes2018-03-15
| | | |
* | | | node/provider: support g:node_host_prog #8135chemzqm2018-03-15
| | | |
* | | | vim-patch:8.0.0316: :help z? does not work (#8134)KunMing Xie2018-03-14
| | | | | | | | | | | | | | | | | | | | Problem: ":help z?" does not work. (Pavol Juhas) Solution: Remove exception for z?. https://github.com/vim/vim/commit/dad7309dd22f0c6b5de0b031acd7f54d3aa94326
* | | | Merge pull request #8127 from jamessan/update-pvs-headersJames McCoy2018-03-11
|\ \ \ \ | | | | | | | | | | Add missing PVS headers to new files
| * | | | pvscheck: Ignore exit code of pvs-studio-analyzerJames McCoy2018-03-11
| | | | | | | | | | | | | | | | | | | | | | | | | Since its typically non-zero, the script immediately exits instead of converting the binary log into useful formats.
| * | | | Add missing PVS headers to new filesJames McCoy2018-03-11
| | | | |
* | | | | ci/AppVeyor: use PowerShell (#8124)b-r-o-c-k2018-03-11
|/ / / /
* | | | ci/travis: Don't destroy cache during prepareJustin M. Keyes2018-03-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Use `cp -r` instead of `mv`. Remove use of `dirname`, that was missed in 10cdf8c28621. closes #5166
* | | | Merge #8117 'build/CI/MSVC/LuaRocks'Justin M. Keyes2018-03-11
|\ \ \ \
| * | | | ci/travis: rename $BUILD_NVIM_DEPS to $CACHE_ENABLEJustin M. Keyes2018-03-11
| | | | |
| * | | | build: respect $DEPS_BUILD_DIRJustin M. Keyes2018-03-11
| | | | | | | | | | | | | | | | | | | | | | | | | Without this, the CI_TARGET=lint travis job cant't find the cached deps (in $HOME/nvim-deps), nor can it update the cache.
| * | | | ci/macOS: skip python2 on travis macOSJustin M. Keyes2018-03-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | macOS travis builds recently started failing (travis caches were cleared recently, maybe related). python2 is reasonably covered by linux CI. Not going to waste time on it for macOS CI. ==> Installing python@2 ==> Downloading https://homebrew.bintray.com/bottles/python@2-2.7.14_3.el_capita ==> Pouring python@2-2.7.14_3.el_capitan.bottle.tar.gz Error: The `brew link` step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink bin/2to3-2 Target /usr/local/bin/2to3-2 is a symlink belonging to python. You can unlink it: brew unlink python To force the link and overwrite all conflicting files: brew link --overwrite python@2 To list all files that would be deleted: brew link --overwrite --dry-run python@2 Possible conflicting files are: /usr/local/bin/2to3-2 -> /usr/local/Cellar/python/2.7.12_1/bin/2to3-2 /usr/local/bin/2to3-2.7 -> /usr/local/Cellar/python/2.7.12_1/bin/2to3-2.7 /usr/local/bin/idle -> /usr/local/Cellar/python/2.7.12_1/bin/idle ...
| * | | | ci/travis: use ninja instead of makeJustin M. Keyes2018-03-11
| | | | |
| * | | | ci/AppVeyor: disable MSVC_32 buildJustin M. Keyes2018-03-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MSVC_32 currently hangs. When MSVC becomes the primary Windows target, we can enable MSVC_32 and retire one of the mingw builds. In the meantime it adds too much time.
| * | | | build/luarocks: avoid parallelism for luarocks buildJustin M. Keyes2018-03-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Is there a race between the luarocks `make bootstrap` dependencies? reverts f73b4911312b35bfe38ed068672a2f8ba8875ba7 ref https://github.com/luarocks/luarocks/pull/774
| * | | | build/luarocks: apply "Fix siteconfig" patchJustin M. Keyes2018-03-11
| | | | | | | | | | | | | | | | | | | | upstream: https://github.com/luarocks/luarocks/pull/774
| * | | | test: next_msg(): default `timeout` to 10sJustin M. Keyes2018-03-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Infinite timeout results in hangs which waste time. If some test needs longer than 10s to wait for a message, it should specify the timeout explicitly.
| * | | | test: rename next_message() to next_msg()Justin M. Keyes2018-03-11
| | | | |
| * | | | ci/AppVeyor: fix `set` whitespace quotingJustin M. Keyes2018-03-11
| | | | |
| * | | | test: handle non-deterministic message cadenceJustin M. Keyes2018-03-11
| | | | |
* | | | | vim-patch:8.0.0262,8.0.0263 (#8123)KunMing Xie2018-03-11
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | vim-patch:8.0.0262: Farsi support is barely tested Problem: Farsi support is barely tested. Solution: Add more tests for Farsi. Clean up the code. https://github.com/vim/vim/commit/ddf662a1c86ef0b4bd0c55c5f0aa192ebd6d9a5e vim-patch:8.0.0263: Farsi support is not tested enough Problem: Farsi support is not tested enough. Solution: Add more tests for Farsi. Clean up the code. https://github.com/vim/vim/commit/80627cf51fd4274320875193a43ce11cee58c96e
* | | | Merge pull request #8122 from jamessan/appimagev2James McCoy2018-03-09
|\ \ \ \ | | | | | | | | | | Create v2 AppImages and include update information
| * | | | genappimage: Include update information for releases/nightliesJames McCoy2018-03-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will allow users to use AppImageUpdate to update their AppImage. It requires publishing the created zsync file alongside the appimage file for the releases.
| * | | | genappimage: Create a type 2 AppImageJames McCoy2018-03-09
| | | | |
| * | | | genappimage: Use AppImage/AppImages repo to avoid redirectsJames McCoy2018-03-09
|/ / / /
* | | | vim-patch.sh: more colorful #8115Giuseppe2018-03-09
| | | |
* | | | Merge #8084 'build/win: support MSVC'Justin M. Keyes2018-03-08
|\ \ \ \
| * | | | build/msvc: Fix AppVeyor build script for 'MINGW_64-gcov' configurationb-r-o-c-k2018-03-07
| | | | |