 4f294c247f
			
		
	
	
		4f294c247f
		
	
	
	
	
		
			
			This patch mainly copies and modifies files existing in the current libc implementing minix specific functions. To keep consisten with the NetBSD libc, we remove namespace stubs and we use "namespace.h" and weak links.
		
			
				
	
	
		
			54 lines
		
	
	
		
			1021 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			1021 B
		
	
	
	
		
			C
		
	
	
	
	
	
| /*	getrlimit                             Author: Erik van der Kouwe
 | |
|  *      query resource consumtion limits      4 December 2009
 | |
|  *
 | |
|  * Based on these specifications:
 | |
|  * http://www.opengroup.org/onlinepubs/007908775/xsh/getdtablesize.html 
 | |
|  * http://www.opengroup.org/onlinepubs/007908775/xsh/getrlimit.html 
 | |
|  */
 | |
|  
 | |
| #include <sys/cdefs.h>
 | |
| #include "namespace.h"
 | |
| 
 | |
| #include <errno.h>
 | |
| #include <limits.h>
 | |
| #include <sys/resource.h>
 | |
| #include <unistd.h>
 | |
| 
 | |
| int getrlimit(int resource, struct rlimit *rlp)
 | |
| {
 | |
| 	rlim_t limit;
 | |
| 	
 | |
| 	switch (resource)
 | |
| 	{
 | |
| 		case RLIMIT_CORE:
 | |
| 			/* no core currently produced */
 | |
| 			limit = 0;
 | |
| 			break;
 | |
| 
 | |
| 		case RLIMIT_CPU:
 | |
| 		case RLIMIT_DATA:
 | |
| 		case RLIMIT_FSIZE:
 | |
| 		case RLIMIT_STACK:
 | |
| 		case RLIMIT_AS:
 | |
| 			/* no limit enforced (however architectural limits 
 | |
| 			 * may apply) 
 | |
| 			 */	
 | |
| 			limit = RLIM_INFINITY;
 | |
| 			break;
 | |
| 
 | |
| 		case RLIMIT_NOFILE:
 | |
| 			limit = OPEN_MAX;
 | |
| 			break;
 | |
| 
 | |
| 		default:
 | |
| 			errno = EINVAL;
 | |
| 			return -1;
 | |
| 	}		
 | |
| 
 | |
| 	/* return limit */
 | |
| 	rlp->rlim_cur = limit;
 | |
| 	rlp->rlim_max = limit;
 | |
| 	return 0;
 | |
| }
 | |
| 
 |