Changeset 582a0b8 in mainline for uspace/lib/c/generic/time.c


Ignore:
Timestamp:
2017-05-08T19:20:39Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d2c8533
Parents:
73db198
Message:

Remove unistd.h

  • Rename usleep() and sleep() to thread_usleep() and thread_sleep() and move to thread.[hc].
  • Include stddef.h in order to provide NULL.
  • Move getpagesize() to libposix.
  • Sync uspace/dist/src/c/demos with originals.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/time.c

    r73db198 r582a0b8  
    4949#include <ctype.h>
    5050#include <assert.h>
    51 #include <unistd.h>
    5251#include <loc.h>
    5352#include <device/clock_dev.h>
    5453#include <malloc.h>
     54#include <thread.h>
    5555
    5656#define ASCTIME_BUF_LEN  26
     
    685685}
    686686
    687 /** Wait unconditionally for specified number of microseconds
    688  *
    689  */
    690 int usleep(useconds_t usec)
    691 {
    692         (void) __SYSCALL1(SYS_THREAD_USLEEP, usec);
    693         return 0;
    694 }
    695 
    696687void udelay(useconds_t time)
    697688{
    698689        (void) __SYSCALL1(SYS_THREAD_UDELAY, (sysarg_t) time);
    699 }
    700 
    701 
    702 /** Wait unconditionally for specified number of seconds
    703  *
    704  */
    705 unsigned int sleep(unsigned int sec)
    706 {
    707         /*
    708          * Sleep in 1000 second steps to support
    709          * full argument range
    710          */
    711        
    712         while (sec > 0) {
    713                 unsigned int period = (sec > 1000) ? 1000 : sec;
    714                
    715                 usleep(period * 1000000);
    716                 sec -= period;
    717         }
    718        
    719         return 0;
    720690}
    721691
Note: See TracChangeset for help on using the changeset viewer.