|
Packit |
b5b901 |
/* Copyright libuv project contributors. All rights reserved.
|
|
Packit |
b5b901 |
*
|
|
Packit |
b5b901 |
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
Packit |
b5b901 |
* of this software and associated documentation files (the "Software"), to
|
|
Packit |
b5b901 |
* deal in the Software without restriction, including without limitation the
|
|
Packit |
b5b901 |
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
Packit |
b5b901 |
* sell copies of the Software, and to permit persons to whom the Software is
|
|
Packit |
b5b901 |
* furnished to do so, subject to the following conditions:
|
|
Packit |
b5b901 |
*
|
|
Packit |
b5b901 |
* The above copyright notice and this permission notice shall be included in
|
|
Packit |
b5b901 |
* all copies or substantial portions of the Software.
|
|
Packit |
b5b901 |
*
|
|
Packit |
b5b901 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
Packit |
b5b901 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
Packit |
b5b901 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
Packit |
b5b901 |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
Packit |
b5b901 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
Packit |
b5b901 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
Packit |
b5b901 |
* IN THE SOFTWARE.
|
|
Packit |
b5b901 |
*/
|
|
Packit |
b5b901 |
|
|
Packit |
b5b901 |
#include "uv.h"
|
|
Packit |
b5b901 |
#include "internal.h"
|
|
Packit |
b5b901 |
|
|
Packit |
b5b901 |
#include <sys/sysinfo.h>
|
|
Packit |
b5b901 |
#include <unistd.h>
|
|
Packit |
b5b901 |
|
|
Packit |
b5b901 |
int uv_uptime(double* uptime) {
|
|
Packit |
b5b901 |
struct sysinfo info;
|
|
Packit |
b5b901 |
|
|
Packit |
b5b901 |
if (sysinfo(&info) < 0)
|
|
Packit |
b5b901 |
return UV__ERR(errno);
|
|
Packit |
b5b901 |
|
|
Packit |
b5b901 |
*uptime = info.uptime;
|
|
Packit |
b5b901 |
return 0;
|
|
Packit |
b5b901 |
}
|
|
Packit |
b5b901 |
|
|
Packit |
b5b901 |
int uv_resident_set_memory(size_t* rss) {
|
|
Packit |
b5b901 |
/* FIXME: read /proc/meminfo? */
|
|
Packit |
b5b901 |
*rss = 0;
|
|
Packit Service |
e08953 |
return 0;
|
|
Packit |
b5b901 |
}
|
|
Packit |
b5b901 |
|
|
Packit |
b5b901 |
int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
|
|
Packit |
b5b901 |
/* FIXME: read /proc/stat? */
|
|
Packit |
b5b901 |
*cpu_infos = NULL;
|
|
Packit |
b5b901 |
*count = 0;
|
|
Packit |
b5b901 |
return UV_ENOSYS;
|
|
Packit |
b5b901 |
}
|
|
Packit |
b5b901 |
|
|
Packit Service |
e08953 |
uint64_t uv_get_constrained_memory(void) {
|
|
Packit Service |
e08953 |
return 0; /* Memory constraints are unknown. */
|
|
Packit |
b5b901 |
}
|