bsd
This commit is contained in:
parent
bc5d577127
commit
c54b8b69ed
6 changed files with 16 additions and 13 deletions
|
|
@ -904,17 +904,6 @@ extern int post9pservice(int, char*);
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* this really shouldn't be here */
|
|
||||||
#if defined(__OpenBSD__) || (defined(__NetBSD__) && !defined(sched_yield))
|
|
||||||
#define sched_yield() \
|
|
||||||
do { \
|
|
||||||
struct timespec ts; \
|
|
||||||
ts.tv_sec = 0; \
|
|
||||||
ts.tv_nsec = 10; \
|
|
||||||
nanosleep(&ts, NULL); \
|
|
||||||
} while(0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* command line */
|
/* command line */
|
||||||
extern char *argv0;
|
extern char *argv0;
|
||||||
extern void __fixargv0(void);
|
extern void __fixargv0(void);
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,7 @@ typedef int32_t s32int;
|
||||||
* Gcc is too smart for its own good.
|
* Gcc is too smart for its own good.
|
||||||
*/
|
*/
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
|
# undef strcmp /* causes way too many warnings */
|
||||||
# if __GNUC__ >= 4 || (__GNUC__==3 && !defined(__APPLE_CC__))
|
# if __GNUC__ >= 4 || (__GNUC__==3 && !defined(__APPLE_CC__))
|
||||||
# undef AUTOLIB
|
# undef AUTOLIB
|
||||||
# define AUTOLIB(x) int __p9l_autolib_ ## x __attribute__ ((weak));
|
# define AUTOLIB(x) int __p9l_autolib_ ## x __attribute__ ((weak));
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,19 @@
|
||||||
#include <u.h>
|
#include <u.h>
|
||||||
#define NOPLAN9DEFINES
|
#define NOPLAN9DEFINES
|
||||||
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
|
|
||||||
|
#if defined(__NetBSD__) || (defined(__OpenBSD__) && OpenBSD <= 200511)
|
||||||
|
# define sched_yield() \
|
||||||
|
# do{ struct timespec ts; \
|
||||||
|
# ts.tv_sec = 0; \
|
||||||
|
# ts.tv_nsec = 10; \
|
||||||
|
# nanosleep(&ts, 0); \
|
||||||
|
# }while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
p9sleep(long milli)
|
p9sleep(long milli)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ typedef struct ucontext ucontext_t;
|
||||||
|
|
||||||
extern int swapcontext(ucontext_t*, ucontext_t*);
|
extern int swapcontext(ucontext_t*, ucontext_t*);
|
||||||
extern void makecontext(ucontext_t*, void(*)(), int, ...);
|
extern void makecontext(ucontext_t*, void(*)(), int, ...);
|
||||||
|
extern int getmcontext(mcontext_t*);
|
||||||
|
extern void setmcontext(mcontetx_t*);
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1999 Marcel Moolenaar
|
* Copyright (c) 1999 Marcel Moolenaar
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ _threadlock(Lock *l, int block, ulong pc)
|
||||||
for(i=0; i<1000; i++){
|
for(i=0; i<1000; i++){
|
||||||
if(!_tas(&l->held))
|
if(!_tas(&l->held))
|
||||||
return 1;
|
return 1;
|
||||||
sched_yield();
|
sleep(0);
|
||||||
}
|
}
|
||||||
/* increasingly slow */
|
/* increasingly slow */
|
||||||
for(i=0; i<10; i++){
|
for(i=0; i<10; i++){
|
||||||
|
|
|
||||||
|
|
@ -96,4 +96,5 @@ ENTRY(rfork_thread)
|
||||||
movl %ebp, %esp
|
movl %ebp, %esp
|
||||||
popl %ebp
|
popl %ebp
|
||||||
PIC_PROLOGUE
|
PIC_PROLOGUE
|
||||||
jmp PIC_PLT(_C_LABEL(__cerror))
|
jmp PIC_PLT(_C_LABEL(__cerror))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue