/*
 * src/resource.h
 *
 * Copyright (C) 2013, Samsung Electronics Co., Ltd.
 *
 * Resource limits support
 */

#ifndef __RESOURCE_H__
#define __RESOURCE_H__

#ifndef TRUE
#define TRUE        (1)
#endif

#ifndef FALSE
#define FALSE       (0)
#endif

#define RLIM_INFINITY           0xFFFFFFFF
/* Open file limit increased due to migrate to POSIX messaging.
 * Main problem is fd exhaustion in root TA when max available TA
 * instances are spawned. It caused by getpid() malfunction because
 * it's impossibe to open proc device) */
#define FILE_OPEN_LIMIT         320	/* # opened file limit */
#define FILE_NAME_LEN           256	/* # chars in a file name */

#define RLIM_MAX_PRIORITY       15
#define RLIM_DEF_PRIORITY       (RLIM_MAX_PRIORITY / 2)
#define RLIM_MIN_PRIORITY       1
#define RLIM_MIN_STACK		PAGE_SIZE
#define RLIM_DEF_STACK		(PAGE_SIZE << 2)

enum resource_type {
	RLIMIT_AS,
	RLIMIT_NPROC,
	RLIMIT_STACK,
	RLIMIT_PRIO,
	RLIMIT_DEFAULT_ANON_MMAP_FLAGS,
};

struct rlimit {
    unsigned long rlim_cur;  /* Soft limit */
    unsigned long rlim_max;  /* Hard limit (ceiling for rlim_cur) */
};


#endif /* __RESOURCE_H__ */
