diff options
author | Roland McGrath <roland@hack.frob.com> | 2012-08-17 13:52:32 -0700 |
---|---|---|
committer | Roland McGrath <roland@hack.frob.com> | 2012-08-17 13:52:32 -0700 |
commit | 7c6f9d53c1f57bb9b679fcdb39d2b5a9c63e46d3 (patch) | |
tree | a74652f06f7bc02a2bb11ce3dc7adbdfe756fbee /sysdeps/unix | |
parent | 3bd9e9931bcb4ae2874a95319a11dff4c604afb6 (diff) | |
download | glibc-7c6f9d53c1f57bb9b679fcdb39d2b5a9c63e46d3.tar.gz glibc-7c6f9d53c1f57bb9b679fcdb39d2b5a9c63e46d3.tar.xz glibc-7c6f9d53c1f57bb9b679fcdb39d2b5a9c63e46d3.zip |
Move some things from sysdeps/unix to sysdeps/posix.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r-- | sysdeps/unix/alarm.c | 50 | ||||
-rw-r--r-- | sysdeps/unix/mkfifo.c | 29 | ||||
-rw-r--r-- | sysdeps/unix/mkfifoat.c | 31 | ||||
-rw-r--r-- | sysdeps/unix/nice.c | 52 | ||||
-rw-r--r-- | sysdeps/unix/time.c | 41 | ||||
-rw-r--r-- | sysdeps/unix/utime.c | 49 |
6 files changed, 0 insertions, 252 deletions
diff --git a/sysdeps/unix/alarm.c b/sysdeps/unix/alarm.c deleted file mode 100644 index 730f2c4c77..0000000000 --- a/sysdeps/unix/alarm.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (C) 1991,1992,1994,1997,2002,2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <unistd.h> -#include <sys/time.h> - -/* Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. - If SECONDS is zero, any currently scheduled alarm will be cancelled. - The function returns the number of seconds remaining until the last - alarm scheduled would have signaled, or zero if there wasn't one. - There is no return value to indicate an error, but you can set `errno' - to 0 and check its value after calling `alarm', and this might tell you. - The signal may come late due to processor scheduling. */ -unsigned int -alarm (seconds) - unsigned int seconds; -{ - struct itimerval old, new; - unsigned int retval; - - new.it_interval.tv_usec = 0; - new.it_interval.tv_sec = 0; - new.it_value.tv_usec = 0; - new.it_value.tv_sec = (long int) seconds; - if (__setitimer (ITIMER_REAL, &new, &old) < 0) - return 0; - - retval = old.it_value.tv_sec; - /* Round to the nearest second, but never report zero seconds when - the alarm is still set. */ - if (old.it_value.tv_usec >= 500000 - || (retval == 0 && old.it_value.tv_usec > 0)) - ++retval; - return retval; -} -libc_hidden_def (alarm) diff --git a/sysdeps/unix/mkfifo.c b/sysdeps/unix/mkfifo.c deleted file mode 100644 index 70329bd12a..0000000000 --- a/sysdeps/unix/mkfifo.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <errno.h> -#include <stddef.h> -#include <sys/stat.h> -#include <sys/types.h> - -/* Create a named pipe (FIFO) named PATH with protections MODE. */ -int -mkfifo (const char *path, mode_t mode) -{ - dev_t dev = 0; - return __xmknod (_MKNOD_VER, path, mode | S_IFIFO, &dev); -} diff --git a/sysdeps/unix/mkfifoat.c b/sysdeps/unix/mkfifoat.c deleted file mode 100644 index 33fa6bde71..0000000000 --- a/sysdeps/unix/mkfifoat.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sys/stat.h> - - -/* Create a new FIFO with permission bits MODE. But interpret - relative PATH names relative to the directory associated with FD. */ -int -mkfifoat (fd, file, mode) - int fd; - const char *file; - mode_t mode; -{ - dev_t dev = 0; - return __xmknodat (_MKNOD_VER, fd, file, mode | S_IFIFO, &dev); -} diff --git a/sysdeps/unix/nice.c b/sysdeps/unix/nice.c deleted file mode 100644 index b986ffbf30..0000000000 --- a/sysdeps/unix/nice.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (C) 1992, 1996, 1997, 2001, 2002, 2006 - Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <errno.h> -#include <unistd.h> -#include <sys/resource.h> - -/* Increment the scheduling priority of the calling process by INCR. - The superuser may use a negative INCR to decrement the priority. */ -int -nice (int incr) -{ - int save; - int prio; - int result; - - /* -1 is a valid priority, so we use errno to check for an error. */ - save = errno; - __set_errno (0); - prio = getpriority (PRIO_PROCESS, 0); - if (prio == -1) - { - if (errno != 0) - return -1; - else - __set_errno (save); - } - - result = setpriority (PRIO_PROCESS, 0, prio + incr); - if (result == -1) - { - if (errno == EACCES) - errno = EPERM; - return -1; - } - return getpriority (PRIO_PROCESS, 0); -} diff --git a/sysdeps/unix/time.c b/sysdeps/unix/time.c deleted file mode 100644 index e026a384df..0000000000 --- a/sysdeps/unix/time.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 1991,92,97,2001,02 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <stddef.h> /* For NULL. */ -#include <time.h> -#include <sys/time.h> - - -/* Return the current time as a `time_t' and also put it in *T if T is - not NULL. Time is represented as seconds from Jan 1 00:00:00 1970. */ -time_t -time (t) - time_t *t; -{ - struct timeval tv; - time_t result; - - if (__gettimeofday (&tv, (struct timezone *) NULL)) - result = (time_t) -1; - else - result = (time_t) tv.tv_sec; - - if (t != NULL) - *t = result; - return result; -} -libc_hidden_def (time) diff --git a/sysdeps/unix/utime.c b/sysdeps/unix/utime.c deleted file mode 100644 index a750ecc290..0000000000 --- a/sysdeps/unix/utime.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (C) 1991,94,97,2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <errno.h> -#include <utime.h> -#include <time.h> -#include <sys/types.h> -#include <sys/time.h> - - -/* Set the access and modification times of FILE to those given in TIMES. - If TIMES is NULL, set them to the current time. */ -int -utime (file, times) - const char *file; - const struct utimbuf *times; -{ - struct timeval timevals[2]; - struct timeval *tvp; - - if (times != NULL) - { - timevals[0].tv_sec = (time_t) times->actime; - timevals[0].tv_usec = 0L; - timevals[1].tv_sec = (time_t) times->modtime; - timevals[1].tv_usec = 0L; - tvp = timevals; - } - else - tvp = NULL; - - return __utimes (file, tvp); -} -libc_hidden_def (utime) |