os/ossrv/genericopenlibs/openenvcore/libc/src/Pmscalls.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:   
    15 *
    16 */
    17 
    18 
    19 #include <errno.h>
    20 #include <sys/types.h>
    21 #include <sys/stat.h>
    22 #include <unistd.h>
    23 #include <sched.h>
    24 
    25 #include "sysif.h"
    26 #include "sysusrinclude.h"
    27 
    28 
    29 #define MASK_RWUSR    0066   // Read and write permission for user alone
    30 
    31 extern "C" {
    32 // Calling Process GID observer and modifier
    33 
    34 EXPORT_C int setgid( gid_t gid )
    35 	{
    36 	return _setgid(gid );
    37 	}
    38 
    39 
    40 
    41 EXPORT_C gid_t getegid( void )
    42 	{
    43 	return _getegid();
    44 	}
    45 
    46 
    47 
    48 EXPORT_C int setegid( gid_t gid )
    49 	{		
    50 	return _setegid(gid);
    51 	}
    52 
    53 
    54 EXPORT_C int setregid( gid_t rgid, gid_t egid )
    55 	{		
    56 	return _setregid(rgid, egid);
    57 	}
    58 
    59 
    60 // Calling Process UID observer and modifier 
    61 
    62 EXPORT_C gid_t getgid( void )
    63 	{	
    64 	return _getgid();
    65 	}
    66 
    67 EXPORT_C uid_t getuid( void )
    68 	{	
    69 	return _getuid();
    70 	}
    71 
    72 EXPORT_C int setuid( uid_t uid )
    73 	{	
    74 	return _setuid(uid);
    75 	}
    76 
    77 
    78 EXPORT_C uid_t geteuid( void )
    79 	{	
    80 	return _geteuid();
    81 	}
    82 
    83 EXPORT_C int seteuid( uid_t uid )
    84 	{		
    85 	return _seteuid(uid);
    86 	}
    87 
    88 
    89 EXPORT_C int setreuid( uid_t ruid, uid_t euid )
    90 	{		
    91 	return _setreuid(ruid, euid);
    92 	}
    93 
    94 
    95 // Process group ID observer and modifier 
    96 
    97 EXPORT_C pid_t getpgid( pid_t pid )
    98 	{		
    99 	return _getpgid(pid);
   100 	}
   101 
   102 EXPORT_C pid_t setpgid( pid_t pid, pid_t pgid )
   103 	{		
   104 	return _setpgid(pid, pgid);
   105 	}
   106 
   107 
   108 EXPORT_C pid_t getpgrp( void )
   109 	{		
   110 	return _getpgrp();
   111 	}
   112 
   113 
   114 
   115 EXPORT_C int setpgrp( pid_t _pid, pid_t  _pgrp )
   116 	{		
   117 	return _setpgrp(_pid,_pgrp);
   118 	}
   119 
   120 
   121 // Supplementary Group ID observer
   122 
   123 EXPORT_C int getgroups( int size, gid_t grouplist[] )
   124 	{				
   125 	return _getgroups(size, grouplist);
   126 	}
   127 
   128 
   129 // Create New Session(process group)
   130 
   131 EXPORT_C pid_t setsid( void )
   132 	{				
   133 	return _setsid();
   134 	} 
   135 
   136 
   137 // Parent process ID
   138 
   139 EXPORT_C pid_t getppid( void )
   140 	{				
   141 	return _getppid();
   142 	} 
   143 
   144 
   145 // Set file mode creation mask
   146 
   147 EXPORT_C mode_t umask(mode_t cmask)
   148 	{				
   149 	return _umask(cmask);
   150 	} 
   151 
   152 
   153 // change owner and group of a file
   154 
   155 EXPORT_C int chown(const char *path, uid_t owner, gid_t group)
   156 	{				
   157 	return _chown(path, owner, group);
   158 	} 
   159 
   160 
   161 //change the owner and group of a symbolic link
   162 
   163 EXPORT_C int lchown(const char *path, uid_t owner, gid_t group)
   164 	{
   165 	return _lchown(path, owner, group);
   166 	}
   167 
   168 
   169 // Initialize supplementry group list
   170 
   171 EXPORT_C int initgroups(const char */*name*/, gid_t /*basegid*/)
   172 	{
   173 	return 0;
   174 	}
   175 
   176 // yield control to a similar or higher priority thread
   177 
   178 EXPORT_C int sched_yield( void )
   179 	{
   180 	return usleep(0);
   181 	}
   182 
   183 
   184 //Return the maximum priority as 0. 
   185 
   186 
   187 EXPORT_C int sched_get_priority_max(int /*policy*/)
   188 	{
   189 	/* returning absolute max priorit, needs to be reviewed*/
   190 	return (255);
   191 	}
   192 
   193 
   194 // Return the minimum priority as 0.
   195 
   196 EXPORT_C int sched_get_priority_min(int /*policy*/)
   197 	{
   198 	return 0;
   199 	}
   200 
   201 // Set end of the data segment to specified value.
   202 EXPORT_C int brk(const void* /*end_data_seg*/)
   203 	{
   204 	return 0;
   205 	}
   206 
   207 } // extern "C"