1*5af32e75SAxel Dörfler /* 2*5af32e75SAxel Dörfler ** Copyright 2004, Jérôme Duval. All rights reserved. 3*5af32e75SAxel Dörfler ** Distributed under the terms of the Haiku License. 4*5af32e75SAxel Dörfler */ 5*5af32e75SAxel Dörfler 6*5af32e75SAxel Dörfler #include <time.h> 7*5af32e75SAxel Dörfler #include <errno.h> 8*5af32e75SAxel Dörfler #include "syscalls.h" 9*5af32e75SAxel Dörfler 10*5af32e75SAxel Dörfler // ToDo: replace zero by a ROOT_UID when usergroup.c is implemented 11*5af32e75SAxel Dörfler 12*5af32e75SAxel Dörfler int 13*5af32e75SAxel Dörfler stime(const time_t *tp) 14*5af32e75SAxel Dörfler { 15*5af32e75SAxel Dörfler status_t status; 16*5af32e75SAxel Dörfler 17*5af32e75SAxel Dörfler if (tp == NULL) { 18*5af32e75SAxel Dörfler errno = EINVAL; 19*5af32e75SAxel Dörfler return -1; 20*5af32e75SAxel Dörfler } 21*5af32e75SAxel Dörfler if (geteuid() != 0) { 22*5af32e75SAxel Dörfler errno = EPERM; 23*5af32e75SAxel Dörfler return -1; 24*5af32e75SAxel Dörfler } 25*5af32e75SAxel Dörfler status = _kern_set_real_time_clock(*tp); 26*5af32e75SAxel Dörfler if (status < B_OK) { 27*5af32e75SAxel Dörfler errno = status; 28*5af32e75SAxel Dörfler return -1; 29*5af32e75SAxel Dörfler } 30*5af32e75SAxel Dörfler return 0; 31*5af32e75SAxel Dörfler } 32*5af32e75SAxel Dörfler 33