Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup: follow review comments by various folk
  • Loading branch information
zokker13 committed Jul 7, 2018
commit bf86dcca09a5a2422824b26885896f506617e82e
22 changes: 11 additions & 11 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -1647,21 +1647,22 @@ This feature is not available in [`Worker`][] threads.
added: REPLACEME
-->

* `inc` {integer} The new nice value for the process.
* `inc` {integer} The nice value which is added to the current nice value.

Returns the new nice value of the process.

The `process.nice()` method sets or gets the nice value of the process.
(See nice(2).) The `inc` is supposed to be an integer, consisting of the
_difference_ you want to add to the current nice value.
_difference_ the user wants to add to the current nice value.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe "to be added to the current nice value"?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's cool. Changed: 2a8e90ad0ab93f07b67628b0e7c876603da47c8a

The higher the nice value of the process, the nicer the process and the less
time is given by the scheduler.

You can get the current nice value by passing 0 or nothing to the method.
time is given by the scheduler (effectively lowering the priority).

Unless you have super user permissions, you can only increase your nice value.
Though, it is also possible to increase the priority if a limit (RLIMIT_NICE)
is set. (See getrlimit(2).)
It is possible to get the current nice value by passing 0 or `undefined`
to the method.

**NOTE**: Once you incremented your niceness, you can no longer reduce it!
In a common environment, it is only possible to increase the nice value.
A decrease of the value at a later time might not be possible (unless
the specified permissions are set) (See getrlimit(2).)

```js
if (process.nice) {
Expand All @@ -1672,8 +1673,7 @@ if (process.nice) {
}
```

This function is only available on POSIX platforms (i.e. not Windows or
Android).
This function is only available on POSIX platforms (i.e. not Windows).
This feature is not available in [`Worker`][] threads.

## process.setgid(id)
Expand Down
5 changes: 4 additions & 1 deletion src/node_internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -948,12 +948,15 @@ void StopProfilerIdleNotifier(const v8::FunctionCallbackInfo<v8::Value>& args);
void Umask(const v8::FunctionCallbackInfo<v8::Value>& args);
void Uptime(const v8::FunctionCallbackInfo<v8::Value>& args);

#if defined(__POSIX__) && !defined(__CloudABI__)
void Nice(const v8::FunctionCallbackInfo<v8::Value>& args);
#endif // __POSIX__ && !defined(__CloudABI__)

#if defined(__POSIX__) && !defined(__ANDROID__) && !defined(__CloudABI__)
void SetGid(const v8::FunctionCallbackInfo<v8::Value>& args);
void SetEGid(const v8::FunctionCallbackInfo<v8::Value>& args);
void SetUid(const v8::FunctionCallbackInfo<v8::Value>& args);
void SetEUid(const v8::FunctionCallbackInfo<v8::Value>& args);
void Nice(const v8::FunctionCallbackInfo<v8::Value>& args);
void SetGroups(const v8::FunctionCallbackInfo<v8::Value>& args);
void InitGroups(const v8::FunctionCallbackInfo<v8::Value>& args);
void GetUid(const v8::FunctionCallbackInfo<v8::Value>& args);
Expand Down