📄 libopenmosix.h
字号:
/* Copyright (c) 2006 David Santo Orcero irbis@orcero.org *//* http://www.orcero.org/irbis *//* Code derived from MOSIX code from Ariel Rosenblatt, Amnon Shiloh *//* what also was derived from previous work by Amnon Shiloh and *//* Oren Laadan. *//* OpenMosix is (c) of Moshe Bar http://www.openmosix.com *//* Mosix is (c) of prof. Barak http://www.mosix.org *//* Each respective trademark is of its own owner *//* All rights reserved. *//* This software is distributed under GPL 2 *//* THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTY IS ASSUMED. *//* NO LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING *//* FROM THE USE OF THIS SOFTWARE WILL BE ACCEPTED. IT CAN BURN *//* YOUR HARD DISK, ERASE ALL YOUR DATA AND BROKE DOWN YOUR *//* MICROWAVE OVEN. YOU ARE ADVISED. */#ifndef __libopenmosix__#define __libopenmosix__#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <errno.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <string.h>#include <ctype.h>#include <sys/socket.h>#include <stdint.h>#include <linux/config.h>#include <netinet/in.h>#include <arpa/inet.h>#include <sys/utsname.h>#include <sys/socket.h>/* configuration */#define MOSIX_MAX 65535 /* max number of hosts in openMosix */#define MAX_MOSNET_ENTS 256 /* max number of netx in openMosix */struct decay_params{ int interval; int slow; int fast;};struct process_info{ pid_t pid; char *where; int baseorder;};/*struct mosixnet{ int base; struct sockaddr saddr; int cnt;};*/enum om_cmd{ D_STAY, /* Disable automatic migration from here */ D_NOSTAY, /* Allow automatic migrations from here */ D_LSTAY, /* Disable automatic mig. of local processes */ D_NOLSTAY, /* Allow automatic mig. of local processes */ D_BLOCK, /* Block automatic migration to here */ D_NOBLOCK, /* Enable automatic migration to here */ D_EXPEL, /* Expel all processes to remote processors */ D_BRING, /* Bring back all processes */ D_GETLOAD, /* Get current load */ D_QUIET, /* Stop internal load-balancing activity */ D_NOQUIET, /* Resume internal load-balancing activity */ D_TUNE, /* Enter tuning mode */ D_NOTUNE, /* Exit tuning mode */ D_NOMFS, /* Disallow MFS access to this node */ D_MFS, /* Reallow MFS access to this node */ D_SETSSPEED, /* Set the standard speed, affecting D_GETLOAD */ D_GETSSPEED, /* Get the standard speed (default=1000) */ D_GETSPEED, /* Get machine's speed */ D_SETSPEED, /* Set machine's speed */ D_MOSIX_TO_IP, /* Convert MOSIX to IP address */ D_IP_TO_MOSIX, /* Convert IP to MOSIX address */ D_GETNTUNE, /* get number of kernel tuning parameters */ D_GETTUNE, /* get kernel tuning parameters */ D_GETSTAT, /* get MOSIX status */ D_GETMEM, /* get current memory (free and total) */ D_GETDECAY, /* get decay parameters */ D_SETDECAY, /* set decay parameters */ D_GETRMEM, /* get OS's idea of memory (free and total) */ D_GETUTIL, /* get CPU utilizability % */ D_SETWHERETO, /* send a process somewhere */ D_GETPE, /* get node number */ D_GETCPUS, /* get number of CPUs */ D_GETLOADLOCAL, D_GETLOADREMOTE, D_GETCPULOCAL, D_GETCPUREMOTE};#define D_GOBACKHOME 0 /* just go back home */#define D_BALANCE (-1) /* perform load balancing */#define D_LEAVE (-2) /* leave the process where it is */#define D_UNLOCK 0#define D_LOCK 1#define D_NOCHANGE 2#define D_MIGNOLOCK 3typedef enum om_cmd om_cmd_t;int om_isopenmosix (void);int om_read (const char *path);char *om_read_s (const char *path);int om_readproc (int pid, const char *item);char *om_readproc_s (int pid, const char *item);int om_readval (const char *path, int64_t * val);int om_readval_s (const char *path, char ** val);int om_readval2 (const char *path, int *val1, int *val2);int64_t om_readnode (char *node, const char *item);int om_write (const char *path, int64_t val);int om_write2 (const char *path, int val, int64_t val2);int om_write_s (const char *fn, char *val);int om_writeproc (int pid, const char *item, int64_t val);int om_writeproc_s (int pid, const char *item, char *val);int om_replace (const char *fn, int64_t val);int om_count_ints (const char *fn);int om_fill_ints (const char *fn, int *, int);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -