~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to src/pkg/runtime/plan9/thread.c

  • Committer: Bazaar Package Importer
  • Author(s): Ondřej Surý
  • Date: 2011-08-03 17:04:59 UTC
  • mfrom: (14.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110803170459-wzd99m3567y80ila
Tags: 1:59-1
* Imported Upstream version 59
* Refresh patches to a new release
* Fix FTBFS on ARM (Closes: #634270)
* Update version.bash to work with Debian packaging and not hg
  repository

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
{
28
28
}
29
29
 
 
30
extern Tos *_tos;
30
31
void
31
32
runtime·exit(int32)
32
33
{
 
34
        int32 fd;
 
35
        uint8 buf[128];
 
36
        uint8 tmp[16];
 
37
        uint8 *p, *q;
 
38
        int32 pid;
 
39
        
 
40
        runtime·memclr(buf, sizeof buf);
 
41
        runtime·memclr(tmp, sizeof tmp);
 
42
        pid = _tos->pid;
 
43
 
 
44
        /* build path string /proc/pid/notepg */
 
45
        for(q=tmp; pid > 0;) {
 
46
                *q++ = '0' + (pid%10);
 
47
                pid = pid/10;
 
48
        }
 
49
        p = buf;
 
50
        runtime·mcpy((void*)p, (void*)"/proc/", 6);
 
51
        p += 6;
 
52
        for(q--; q >= tmp;)
 
53
                *p++ = *q--;
 
54
        runtime·mcpy((void*)p, (void*)"/notepg", 7);
 
55
        
 
56
        /* post interrupt note */
 
57
        fd = runtime·open(buf, OWRITE);
 
58
        runtime·write(fd, "interrupt", 9);
33
59
        runtime·exits(nil);
34
60
}
35
61
 
36
62
void
37
63
runtime·newosproc(M *m, G *g, void *stk, void (*fn)(void))
38
64
{
39
 
        USED(m, g, stk, fn);
40
 
        
41
65
        m->tls[0] = m->id;      // so 386 asm can find it
42
66
        if(0){
43
67
                runtime·printf("newosproc stk=%p m=%p g=%p fn=%p rfork=%p id=%d/%d ostk=%p\n",
44
68
                        stk, m, g, fn, runtime·rfork, m->id, m->tls[0], &m);
45
69
        }        
46
70
        
47
 
        if (runtime·rfork(RFPROC | RFMEM, stk, m, g, fn) < 0 )
 
71
        if (runtime·rfork(RFPROC|RFMEM|RFNOWAIT, stk, m, g, fn) < 0 )
48
72
                runtime·throw("newosproc: rfork failed");
49
73
}
50
74