equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
94 |
94 |
95 // Helper function; describes pthread attributes as short string. String is written |
95 // Helper function; describes pthread attributes as short string. String is written |
96 // to buf with len buflen; buf is returned. |
96 // to buf with len buflen; buf is returned. |
97 static char* describe_pthread_attr(char* buf, size_t buflen, const pthread_attr_t* attr); |
97 static char* describe_pthread_attr(char* buf, size_t buflen, const pthread_attr_t* attr); |
98 |
98 |
|
99 // A safe implementation of realpath which will not cause a buffer overflow if the resolved path |
|
100 // is longer than PATH_MAX. |
|
101 // On success, returns 'outbuf', which now contains the path. |
|
102 // On error, it will return NULL and set errno. The content of 'outbuf' is undefined. |
|
103 // On truncation error ('outbuf' too small), it will return NULL and set errno to ENAMETOOLONG. |
|
104 static char* realpath(const char* filename, char* outbuf, size_t outbuflen); |
|
105 |
99 }; |
106 }; |
100 |
107 |
101 /* |
108 /* |
102 * Crash protection for the watcher thread. Wrap the callback |
109 * Crash protection for the watcher thread. Wrap the callback |
103 * with a sigsetjmp and in case of a SIGSEGV/SIGBUS we siglongjmp |
110 * with a sigsetjmp and in case of a SIGSEGV/SIGBUS we siglongjmp |