os/ossrv/genericopenlibs/openenvcore/libc/src/Pmscalls.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/libc/src/Pmscalls.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,207 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:   
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#include <errno.h>
    1.23 +#include <sys/types.h>
    1.24 +#include <sys/stat.h>
    1.25 +#include <unistd.h>
    1.26 +#include <sched.h>
    1.27 +
    1.28 +#include "sysif.h"
    1.29 +#include "sysusrinclude.h"
    1.30 +
    1.31 +
    1.32 +#define MASK_RWUSR    0066   // Read and write permission for user alone
    1.33 +
    1.34 +extern "C" {
    1.35 +// Calling Process GID observer and modifier
    1.36 +
    1.37 +EXPORT_C int setgid( gid_t gid )
    1.38 +	{
    1.39 +	return _setgid(gid );
    1.40 +	}
    1.41 +
    1.42 +
    1.43 +
    1.44 +EXPORT_C gid_t getegid( void )
    1.45 +	{
    1.46 +	return _getegid();
    1.47 +	}
    1.48 +
    1.49 +
    1.50 +
    1.51 +EXPORT_C int setegid( gid_t gid )
    1.52 +	{		
    1.53 +	return _setegid(gid);
    1.54 +	}
    1.55 +
    1.56 +
    1.57 +EXPORT_C int setregid( gid_t rgid, gid_t egid )
    1.58 +	{		
    1.59 +	return _setregid(rgid, egid);
    1.60 +	}
    1.61 +
    1.62 +
    1.63 +// Calling Process UID observer and modifier 
    1.64 +
    1.65 +EXPORT_C gid_t getgid( void )
    1.66 +	{	
    1.67 +	return _getgid();
    1.68 +	}
    1.69 +
    1.70 +EXPORT_C uid_t getuid( void )
    1.71 +	{	
    1.72 +	return _getuid();
    1.73 +	}
    1.74 +
    1.75 +EXPORT_C int setuid( uid_t uid )
    1.76 +	{	
    1.77 +	return _setuid(uid);
    1.78 +	}
    1.79 +
    1.80 +
    1.81 +EXPORT_C uid_t geteuid( void )
    1.82 +	{	
    1.83 +	return _geteuid();
    1.84 +	}
    1.85 +
    1.86 +EXPORT_C int seteuid( uid_t uid )
    1.87 +	{		
    1.88 +	return _seteuid(uid);
    1.89 +	}
    1.90 +
    1.91 +
    1.92 +EXPORT_C int setreuid( uid_t ruid, uid_t euid )
    1.93 +	{		
    1.94 +	return _setreuid(ruid, euid);
    1.95 +	}
    1.96 +
    1.97 +
    1.98 +// Process group ID observer and modifier 
    1.99 +
   1.100 +EXPORT_C pid_t getpgid( pid_t pid )
   1.101 +	{		
   1.102 +	return _getpgid(pid);
   1.103 +	}
   1.104 +
   1.105 +EXPORT_C pid_t setpgid( pid_t pid, pid_t pgid )
   1.106 +	{		
   1.107 +	return _setpgid(pid, pgid);
   1.108 +	}
   1.109 +
   1.110 +
   1.111 +EXPORT_C pid_t getpgrp( void )
   1.112 +	{		
   1.113 +	return _getpgrp();
   1.114 +	}
   1.115 +
   1.116 +
   1.117 +
   1.118 +EXPORT_C int setpgrp( pid_t _pid, pid_t  _pgrp )
   1.119 +	{		
   1.120 +	return _setpgrp(_pid,_pgrp);
   1.121 +	}
   1.122 +
   1.123 +
   1.124 +// Supplementary Group ID observer
   1.125 +
   1.126 +EXPORT_C int getgroups( int size, gid_t grouplist[] )
   1.127 +	{				
   1.128 +	return _getgroups(size, grouplist);
   1.129 +	}
   1.130 +
   1.131 +
   1.132 +// Create New Session(process group)
   1.133 +
   1.134 +EXPORT_C pid_t setsid( void )
   1.135 +	{				
   1.136 +	return _setsid();
   1.137 +	} 
   1.138 +
   1.139 +
   1.140 +// Parent process ID
   1.141 +
   1.142 +EXPORT_C pid_t getppid( void )
   1.143 +	{				
   1.144 +	return _getppid();
   1.145 +	} 
   1.146 +
   1.147 +
   1.148 +// Set file mode creation mask
   1.149 +
   1.150 +EXPORT_C mode_t umask(mode_t cmask)
   1.151 +	{				
   1.152 +	return _umask(cmask);
   1.153 +	} 
   1.154 +
   1.155 +
   1.156 +// change owner and group of a file
   1.157 +
   1.158 +EXPORT_C int chown(const char *path, uid_t owner, gid_t group)
   1.159 +	{				
   1.160 +	return _chown(path, owner, group);
   1.161 +	} 
   1.162 +
   1.163 +
   1.164 +//change the owner and group of a symbolic link
   1.165 +
   1.166 +EXPORT_C int lchown(const char *path, uid_t owner, gid_t group)
   1.167 +	{
   1.168 +	return _lchown(path, owner, group);
   1.169 +	}
   1.170 +
   1.171 +
   1.172 +// Initialize supplementry group list
   1.173 +
   1.174 +EXPORT_C int initgroups(const char */*name*/, gid_t /*basegid*/)
   1.175 +	{
   1.176 +	return 0;
   1.177 +	}
   1.178 +
   1.179 +// yield control to a similar or higher priority thread
   1.180 +
   1.181 +EXPORT_C int sched_yield( void )
   1.182 +	{
   1.183 +	return usleep(0);
   1.184 +	}
   1.185 +
   1.186 +
   1.187 +//Return the maximum priority as 0. 
   1.188 +
   1.189 +
   1.190 +EXPORT_C int sched_get_priority_max(int /*policy*/)
   1.191 +	{
   1.192 +	/* returning absolute max priorit, needs to be reviewed*/
   1.193 +	return (255);
   1.194 +	}
   1.195 +
   1.196 +
   1.197 +// Return the minimum priority as 0.
   1.198 +
   1.199 +EXPORT_C int sched_get_priority_min(int /*policy*/)
   1.200 +	{
   1.201 +	return 0;
   1.202 +	}
   1.203 +
   1.204 +// Set end of the data segment to specified value.
   1.205 +EXPORT_C int brk(const void* /*end_data_seg*/)
   1.206 +	{
   1.207 +	return 0;
   1.208 +	}
   1.209 +
   1.210 +} // extern "C"