SPVM-Sys

 view release on metacpan or  search on metacpan

lib/SPVM/Sys.spvm  view on Meta::CPAN

    Sys::User->setuid($uid);
  }
  
  static method set_effective_user_id : void ($euid : int) {
    Sys::User->seteuid($euid);
  }
  
  static method set_real_group_id : void ($real_group_id : int) {
    Sys::User->setgid($real_group_id);
  }
  
  static method set_effective_group_id : void ($effective_group_id : int) {
    Sys::User->setegid($effective_group_id);
  }
  
  static method setpwent : void () {
    Sys::User->setpwent;
  }
  
  static method endpwent : void () {
    Sys::User->endpwent;
  }
  
  static method getpwent : Sys::User::Passwd () {
    
    my $pwent = Sys::User->getpwent;
    
    return $pwent;
  }
  
  static method setgrent : void () {
    Sys::User->setgrent;
  }
  
  static method endgrent : void () {
    Sys::User->endgrent;
  }
  
  static method getgrent : Sys::User::Group () {
    
    my $grent = Sys::User->getgrent;
    
    return $grent;
  }
  
  static method getgroups : int[] () {
    
    my $group_ids_length = Sys::User->getgroups(0, undef);
    
    my $group_ids = new int [$group_ids_length];
    
    Sys::User->getgroups($group_ids_length, $group_ids);
    
    return $group_ids;
  }
  
  static method setgroups : void ($group_ids : int[]) {
    Sys::User->setgroups($group_ids);
  }
  
  static method getpwuid : Sys::User::Passwd ($id : int) {
    
    my $pwent = Sys::User->getpwuid($id);
    
    return $pwent;
  }
  
  static method getpwnam : Sys::User::Passwd ($name : string) {
    
    my $pwent = Sys::User->getpwnam($name);
    
    return $pwent;
  }
  
  static method getgrgid : Sys::User::Group ($id : int) {
    
    my $grent = Sys::User->getgrgid($id);
    
    return $grent;
  }
  
  static method getgrnam : Sys::User::Group ($name : string) {
    
    my $grent = Sys::User->getgrnam($name);
    
    return $grent;
  }
  
  static method srand : void ($seed : int) {
    Fn->set_seed($seed);
  }
  
  static method rand : double ($max : int = 1) {
    
    my $seed_initialized = Fn->seed_initialized;
    my $seed = 0;
    if ($seed_initialized) {
      $seed = Fn->get_seed;
    }
    else {
      $seed = &process_id * (int)&time;
    }
    
    my $random_number = Fn->rand(\$seed, $max);
    
    &srand($seed);
    
    return $random_number;
  }
  
}



( run in 1.078 second using v1.01-cache-2.11-cpan-5837b0d9d2c )