Merge branch 'master' of postpeta.pccluster.org:mckernel
This commit is contained in:
@@ -312,18 +312,22 @@ struct vm_regions {
|
||||
|
||||
struct process_vm;
|
||||
|
||||
struct sigfd {
|
||||
struct sigfd *next;
|
||||
struct mckfd {
|
||||
struct mckfd *next;
|
||||
int fd;
|
||||
__sigset_t mask;
|
||||
long data;
|
||||
void *opt;
|
||||
long (*read_cb)(struct mckfd *, ihk_mc_user_context_t *);
|
||||
int (*ioctl_cb)(struct mckfd *, ihk_mc_user_context_t *);
|
||||
int (*close_cb)(struct mckfd *, ihk_mc_user_context_t *);
|
||||
};
|
||||
|
||||
#define SFD_CLOEXEC 02000000
|
||||
#define SFD_NONBLOCK 04000
|
||||
|
||||
struct sig_common {
|
||||
ihk_spinlock_t lock;
|
||||
ihk_atomic_t use;
|
||||
struct sigfd *sigfd;
|
||||
struct k_sigaction action[_NSIG];
|
||||
struct list_head sigpending;
|
||||
};
|
||||
@@ -343,7 +347,7 @@ typedef void pgio_func_t(void *arg);
|
||||
* special "init" process */
|
||||
struct process {
|
||||
struct list_head hash_list;
|
||||
mcs_rwlock_lock_t update_lock; // lock for parent, status, ...?
|
||||
mcs_rwlock_lock_t update_lock; // lock for parent, status, cpu time...
|
||||
|
||||
// process vm
|
||||
struct process_vm *vm;
|
||||
@@ -425,6 +429,16 @@ struct process {
|
||||
/* Store signal sent to parent when the process terminates. */
|
||||
int termsig;
|
||||
|
||||
ihk_spinlock_t mckfd_lock;
|
||||
struct mckfd *mckfd;
|
||||
|
||||
// cpu time (summary)
|
||||
struct timespec stime;
|
||||
struct timespec utime;
|
||||
|
||||
// cpu time (children)
|
||||
struct timespec stime_children;
|
||||
struct timespec utime_children;
|
||||
};
|
||||
|
||||
void hold_thread(struct thread *ftn);
|
||||
@@ -512,6 +526,20 @@ struct thread {
|
||||
unsigned long *ptrace_debugreg; /* debug registers for ptrace */
|
||||
struct sig_pending *ptrace_recvsig;
|
||||
struct sig_pending *ptrace_sendsig;
|
||||
|
||||
// cpu time
|
||||
struct timespec stime;
|
||||
struct timespec utime;
|
||||
struct timespec btime;
|
||||
int times_update;
|
||||
int in_kernel;
|
||||
|
||||
// interval timers
|
||||
int itimer_enabled;
|
||||
struct itimerval itimer_virtual;
|
||||
struct itimerval itimer_prof;
|
||||
struct timespec itimer_virtual_value;
|
||||
struct timespec itimer_prof_value;
|
||||
};
|
||||
|
||||
struct process_vm {
|
||||
@@ -615,5 +643,6 @@ void process_unlock(struct process *proc, struct mcs_rwlock_node_irqsave *lock);
|
||||
void chain_process(struct process *);
|
||||
void chain_thread(struct thread *);
|
||||
void proc_init();
|
||||
void set_timer();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -66,6 +66,8 @@
|
||||
#define SCD_MSG_SYSFS_RESP_SETUP 0x41
|
||||
/* #define SCD_MSG_SYSFS_REQ_CLEANUP 0x42 */
|
||||
/* #define SCD_MSG_SYSFS_RESP_CLEANUP 0x43 */
|
||||
#define SCD_MSG_PROCFS_TID_CREATE 0x44
|
||||
#define SCD_MSG_PROCFS_TID_DELETE 0x45
|
||||
|
||||
#define ARCH_SET_GS 0x1001
|
||||
#define ARCH_SET_FS 0x1002
|
||||
@@ -314,6 +316,7 @@ struct procfs_read {
|
||||
int ret; /* read bytes (answer) */
|
||||
int status; /* non-zero if done (answer) */
|
||||
int newcpu; /* migrated new cpu (answer) */
|
||||
int readwrite; /* 0:read, 1:write */
|
||||
char fname[PROCFS_NAME_MAX]; /* procfs filename (request) */
|
||||
};
|
||||
|
||||
@@ -334,4 +337,7 @@ struct tod_data_s {
|
||||
};
|
||||
extern struct tod_data_s tod_data; /* residing in arch-dependent file */
|
||||
|
||||
void reset_cputime();
|
||||
void set_cputime(int mode);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -53,5 +53,72 @@ struct timezone
|
||||
int tz_dsttime; /* Nonzero if DST is ever in effect. */
|
||||
};
|
||||
|
||||
#define ITIMER_REAL 0
|
||||
#define ITIMER_VIRTUAL 1
|
||||
#define ITIMER_PROF 2
|
||||
|
||||
struct itimerval {
|
||||
struct timeval it_interval;
|
||||
struct timeval it_value;
|
||||
};
|
||||
|
||||
static inline void
|
||||
ts_add(struct timespec *ats, const struct timespec *bts)
|
||||
{
|
||||
ats->tv_sec += bts->tv_sec;
|
||||
ats->tv_nsec += bts->tv_nsec;
|
||||
while(ats->tv_nsec >= 1000000000){
|
||||
ats->tv_sec++;
|
||||
ats->tv_nsec -= 1000000000;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
ts_sub(struct timespec *ats, const struct timespec *bts)
|
||||
{
|
||||
ats->tv_sec -= bts->tv_sec;
|
||||
ats->tv_nsec -= bts->tv_nsec;
|
||||
while(ats->tv_nsec < 0){
|
||||
ats->tv_sec--;
|
||||
ats->tv_nsec += 1000000000;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
tv_add(struct timeval *ats, const struct timeval *bts)
|
||||
{
|
||||
ats->tv_sec += bts->tv_sec;
|
||||
ats->tv_usec += bts->tv_usec;
|
||||
while(ats->tv_usec >= 1000000){
|
||||
ats->tv_sec++;
|
||||
ats->tv_usec -= 1000000;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
tv_sub(struct timeval *ats, const struct timeval *bts)
|
||||
{
|
||||
ats->tv_sec -= bts->tv_sec;
|
||||
ats->tv_usec -= bts->tv_usec;
|
||||
while(ats->tv_usec < 0){
|
||||
ats->tv_sec--;
|
||||
ats->tv_usec += 1000000;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
tv_to_ts(struct timespec *ats, const struct timeval *bts)
|
||||
{
|
||||
ats->tv_sec = bts->tv_sec;
|
||||
ats->tv_nsec = bts->tv_usec * 1000;
|
||||
}
|
||||
|
||||
static inline void
|
||||
ts_to_tv(struct timeval *ats, const struct timespec *bts)
|
||||
{
|
||||
ats->tv_sec = bts->tv_sec;
|
||||
ats->tv_usec = bts->tv_nsec / 1000;
|
||||
}
|
||||
|
||||
#endif // __TIME_H
|
||||
|
||||
|
||||
Reference in New Issue
Block a user