source: rtems/cpukit/posix/src/setitimer.c @ 3bacb250

4.104.115
Last change on this file since 3bacb250 was 5860b90, checked in by Joel Sherrill <joel.sherrill@…>, on 05/15/09 at 17:43:02

2009-05-15 Joel Sherrill <joel.sherrill@…>

  • posix/src/getitimer.c, posix/src/setitimer.c: Add error checks and clean up so coverage analysis is possible.
  • Property mode set to 100644
File size: 880 bytes
Line 
1/*
2 *  COPYRIGHT (c) 1989-2008.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <time.h>
17#include <sys/time.h>
18#include <errno.h>
19#include <rtems/seterr.h>
20
21int setitimer(
22  int                     which,
23  const struct itimerval *value,
24  struct itimerval       *ovalue
25)
26{
27  if ( !value )
28    rtems_set_errno_and_return_minus_one( EFAULT );
29
30  if ( !ovalue )
31    rtems_set_errno_and_return_minus_one( EFAULT );
32
33  switch ( which ) {
34    case ITIMER_REAL:
35    case ITIMER_VIRTUAL:
36    case ITIMER_PROF:
37      rtems_set_errno_and_return_minus_one( ENOSYS );
38    default:
39      break;
40  }
41  rtems_set_errno_and_return_minus_one( EINVAL );
42}
43
Note: See TracBrowser for help on using the repository browser.