This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 256919
Collapse All | Expand All

(-)a/cnd.remote/src/org/netbeans/modules/cnd/remote/sync/RfsLocalController.java (+7 lines)
Lines 52-57 Link Here
52
import java.util.logging.Level;
52
import java.util.logging.Level;
53
import org.netbeans.modules.cnd.debug.DebugUtils;
53
import org.netbeans.modules.cnd.debug.DebugUtils;
54
import org.netbeans.modules.cnd.remote.mapper.RemotePathMap;
54
import org.netbeans.modules.cnd.remote.mapper.RemotePathMap;
55
import org.netbeans.modules.cnd.remote.support.RemoteLogger;
55
import org.netbeans.modules.cnd.remote.support.RemoteUtil;
56
import org.netbeans.modules.cnd.remote.support.RemoteUtil;
56
import org.netbeans.modules.cnd.remote.support.RemoteUtil.PrefixedLogger;
57
import org.netbeans.modules.cnd.remote.support.RemoteUtil.PrefixedLogger;
57
import org.netbeans.modules.cnd.utils.CndUtils;
58
import org.netbeans.modules.cnd.utils.CndUtils;
Lines 251-256 Link Here
251
252
252
    private boolean checkVersion() throws IOException {
253
    private boolean checkVersion() throws IOException {
253
        String versionsString = requestReader.readLine();
254
        String versionsString = requestReader.readLine();
255
        final String controllerVersionPattern = "CONTROLLER VERSION ";
256
        if (versionsString.startsWith(controllerVersionPattern)) { //NOI18N
257
            // for now we don't check controller versions, only protocol versions are checked
258
            RemoteLogger.fine("rfs_controller at {0} has version {1}", execEnv, versionsString.substring(controllerVersionPattern.length()+1));
259
            versionsString = requestReader.readLine();
260
        }
254
        if (versionsString == null) {
261
        if (versionsString == null) {
255
            return false;
262
            return false;
256
        }
263
        }
(-)a/cnd.remote/tools/nbproject/configurations.xml (-3 / +3 lines)
Lines 114-120 Link Here
114
        <rebuildPropChanged>false</rebuildPropChanged>
114
        <rebuildPropChanged>false</rebuildPropChanged>
115
      </toolsSet>
115
      </toolsSet>
116
      <flagsDictionary>
116
      <flagsDictionary>
117
        <element flagsID="0" commonFlags="-g -fPIC -m64"/>
117
        <element flagsID="0" commonFlags="-g -fPIC -std=c99 -m64"/>
118
      </flagsDictionary>
118
      </flagsDictionary>
119
      <codeAssistance>
119
      <codeAssistance>
120
      </codeAssistance>
120
      </codeAssistance>
Lines 831-837 Link Here
831
    </conf>
831
    </conf>
832
    <conf name="Previse_32" type="0">
832
    <conf name="Previse_32" type="0">
833
      <toolsSet>
833
      <toolsSet>
834
        <compilerSet>default</compilerSet>
834
        <compilerSet>OracleSolarisStudio_12.5|OSS</compilerSet>
835
        <dependencyChecking>false</dependencyChecking>
835
        <dependencyChecking>false</dependencyChecking>
836
        <rebuildPropChanged>false</rebuildPropChanged>
836
        <rebuildPropChanged>false</rebuildPropChanged>
837
      </toolsSet>
837
      </toolsSet>
Lines 915-921 Link Here
915
    </conf>
915
    </conf>
916
    <conf name="Previse_64" type="0">
916
    <conf name="Previse_64" type="0">
917
      <toolsSet>
917
      <toolsSet>
918
        <compilerSet>default</compilerSet>
918
        <compilerSet>OracleSolarisStudio_12.5|OSS</compilerSet>
919
        <dependencyChecking>false</dependencyChecking>
919
        <dependencyChecking>false</dependencyChecking>
920
        <rebuildPropChanged>false</rebuildPropChanged>
920
        <rebuildPropChanged>false</rebuildPropChanged>
921
      </toolsSet>
921
      </toolsSet>
(-)a/cnd.remote/tools/rfs_controller.c (-8 / +13 lines)
Lines 60-69 Link Here
60
static int emulate = false;
60
static int emulate = false;
61
61
62
enum  {
62
enum  {
63
    VERSION_1 = '3',
63
    PROTOCOL_VERSION_1 = '3',
64
    VERSION_2 = '5'
64
    PROTOCOL_VERSION_2 = '5'
65
} protocol_version = 0;
65
} protocol_version = 0;
66
66
67
#define CONTROLLER_MAJOR_VERSION 1
68
#define CONTROLLER_MID_VERSION 1
69
#define CONTROLLER_MINOR_VERSION 1
70
67
static struct timeval fs_skew;
71
static struct timeval fs_skew;
68
72
69
typedef struct connection_data {
73
typedef struct connection_data {
Lines 383-389 Link Here
383
        }
387
        }
384
        // VERSION_2: format is as in printf("%c %d %d %d %s", kind, length, seconds, milliseconds, path)
388
        // VERSION_2: format is as in printf("%c %d %d %d %s", kind, length, seconds, milliseconds, path)
385
        // so the beginning is the same, and two long values are inserted before path
389
        // so the beginning is the same, and two long values are inserted before path
386
        if (protocol_version == VERSION_2) {
390
        if (protocol_version == PROTOCOL_VERSION_2) {
387
            file_time->tv_sec = string2num(filename, buffer+bufsize, &filename);
391
            file_time->tv_sec = string2num(filename, buffer+bufsize, &filename);
388
            if (file_time->tv_sec < 0) {
392
            if (file_time->tv_sec < 0) {
389
                return false;
393
                return false;
Lines 412-418 Link Here
412
    int namelen = strlen(filename);
416
    int namelen = strlen(filename);
413
    int realpath_len = strlen(real_path);
417
    int realpath_len = strlen(real_path);
414
    int size = sizeof(file_elem) + namelen + realpath_len + 2;
418
    int size = sizeof(file_elem) + namelen + realpath_len + 2;
415
    file_elem *fe = (file_elem*) malloc(size);
419
    file_elem *fe = (file_elem*) malloc_wrapper(size);
416
    fe->next = NULL;
420
    fe->next = NULL;
417
    strcpy(fe->filename, filename);
421
    strcpy(fe->filename, filename);
418
    fe->state = state;
422
    fe->state = state;
Lines 519-526 Link Here
519
}
523
}
520
524
521
static int init() {
525
static int init() {
522
    trace("Initialization. Sending supported versions: %c %c\n", VERSION_1, VERSION_2);
526
    trace("Initialization. Sending supported versions: %c %c\n", PROTOCOL_VERSION_1, PROTOCOL_VERSION_2);
523
    fprintf(stdout, "VERSIONS %c %c 6\n", VERSION_1, VERSION_2);
527
    fprintf(stdout, "CONTROLLER VERSION %i.%i.%i  (%s %s)\n", CONTROLLER_MAJOR_VERSION, CONTROLLER_MID_VERSION, CONTROLLER_MINOR_VERSION, __DATE__, __TIME__);
528
    fprintf(stdout, "VERSIONS %c %c\n", PROTOCOL_VERSION_1, PROTOCOL_VERSION_2);
524
    fflush(stdout);
529
    fflush(stdout);
525
    int bufsize = 256;
530
    int bufsize = 256;
526
    char buffer[bufsize];
531
    char buffer[bufsize];
Lines 530-536 Link Here
530
            return false;
535
            return false;
531
        }
536
        }
532
        protocol_version = buffer[8];
537
        protocol_version = buffer[8];
533
        if (protocol_version != VERSION_1 && protocol_version != VERSION_2) {
538
        if (protocol_version != PROTOCOL_VERSION_1 && protocol_version != PROTOCOL_VERSION_2) {
534
            report_error("protocol error: unexpected version: %s\n", buffer);
539
            report_error("protocol error: unexpected version: %s\n", buffer);
535
            return false;
540
            return false;
536
        }
541
        }
Lines 784-790 Link Here
784
789
785
    while (1) {
790
    while (1) {
786
        /* wait for a client to talk to us */
791
        /* wait for a client to talk to us */
787
        connection_data* conn_data = (connection_data*) malloc(sizeof (connection_data));
792
        connection_data* conn_data = (connection_data*) malloc_wrapper(sizeof (connection_data));
788
        socklen_t addrlen = sizeof (conn_data->pin);
793
        socklen_t addrlen = sizeof (conn_data->pin);
789
        if ((conn_data->sd = accept(sd, (struct sockaddr *) & conn_data->pin, &addrlen)) == -1) {
794
        if ((conn_data->sd = accept(sd, (struct sockaddr *) & conn_data->pin, &addrlen)) == -1) {
790
            perror("accept");
795
            perror("accept");
(-)a/cnd.remote/tools/rfs_filedata.c (-3 / +3 lines)
Lines 112-118 Link Here
112
112
113
void stop_adding_file_data() {
113
void stop_adding_file_data() {
114
    int el_size = sizeof(struct file_data *);
114
    int el_size = sizeof(struct file_data *);
115
    data = malloc(data_cnt * el_size);
115
    data = malloc_wrapper(data_cnt * el_size);
116
    int next = 0;
116
    int next = 0;
117
    while (adding_file_data_root) {
117
    while (adding_file_data_root) {
118
        data[next++] = adding_file_data_root->fd;
118
        data[next++] = adding_file_data_root->fd;
Lines 131-139 Link Here
131
        return NULL;
131
        return NULL;
132
    }
132
    }
133
    data_cnt++;
133
    data_cnt++;
134
    struct adding_file_data_node *node = malloc(sizeof(struct adding_file_data_node));
134
    struct adding_file_data_node *node = malloc_wrapper(sizeof(struct adding_file_data_node));
135
135
136
    node->fd = (file_data*) malloc(sizeof(file_data) + strlen(filename) + 1);
136
    node->fd = (file_data*) malloc_wrapper(sizeof(file_data) + strlen(filename) + 1);
137
    pthread_mutex_init(&node->fd->mutex, NULL);
137
    pthread_mutex_init(&node->fd->mutex, NULL);
138
    strcpy(node->fd->filename, filename);
138
    strcpy(node->fd->filename, filename);
139
    node->fd->state = state;
139
    node->fd->state = state;
(-)a/cnd.remote/tools/rfs_preload.c (-4 / +6 lines)
Lines 354-364 Link Here
354
    if (dir) {
354
    if (dir) {
355
        dir = strdup(dir);
355
        dir = strdup(dir);
356
    } else {
356
    } else {
357
        char* p = malloc(PATH_MAX + 1);
357
        char* p = malloc_wrapper(PATH_MAX + 1);
358
        getcwd(p, PATH_MAX + 1);
358
        getcwd(p, PATH_MAX + 1);
359
        dir = p;
359
        dir = p;
360
    }
360
    }
361
    char* real_dir = malloc(PATH_MAX + 1);
361
    char* real_dir = malloc_wrapper(PATH_MAX + 1);
362
    if ( realpath(dir, real_dir)) {
362
    if ( realpath(dir, real_dir)) {
363
        char *to_free = dir;
363
        char *to_free = dir;
364
        dir = real_dir;
364
        dir = real_dir;
Lines 367-381 Link Here
367
        trace_unresolved_path(dir, "RFS startup");
367
        trace_unresolved_path(dir, "RFS startup");
368
    }
368
    }
369
    my_dir_len = strlen(dir);
369
    my_dir_len = strlen(dir);
370
    char *to_free = dir;
370
    if (dir[my_dir_len-1] == '/') {
371
    if (dir[my_dir_len-1] == '/') {
371
        dir = strdup(dir);
372
        dir = strdup(dir);
372
    } else {
373
    } else {
373
        my_dir_len++;
374
        my_dir_len++;
374
        void *p = malloc(my_dir_len + 1);
375
        void *p = malloc_wrapper(my_dir_len + 1);
375
        strcpy(p, dir);
376
        strcpy(p, dir);
376
        strcat(p, "/");
377
        strcat(p, "/");
377
        dir = p;
378
        dir = p;
378
    }
379
    }
380
    free(to_free);
379
    my_dir = dir;
381
    my_dir = dir;
380
382
381
    static int startup_count = 0;
383
    static int startup_count = 0;
Lines 422-428 Link Here
422
    if (!prev) {
424
    if (!prev) {
423
        prev = (int (*)(void*, void*, void * (*)(void *), void*)) get_real_addr(pthread_create);
425
        prev = (int (*)(void*, void*, void * (*)(void *), void*)) get_real_addr(pthread_create);
424
    }
426
    }
425
    pthread_routine_data *data = malloc(sizeof (pthread_routine_data));
427
    pthread_routine_data *data = malloc_wrapper(sizeof (pthread_routine_data));
426
    // TODO: check for null???
428
    // TODO: check for null???
427
    data->user_start_routine = user_start_routine;
429
    data->user_start_routine = user_start_routine;
428
    data->arg = arg;
430
    data->arg = arg;
(-)a/cnd.remote/tools/rfs_util.c (+10 lines)
Lines 148-150 Link Here
148
        trace("Awoke\n");
148
        trace("Awoke\n");
149
    }
149
    }
150
}
150
}
151
152
// NB: don't use malloc_wrapper in preload!!!
153
void *malloc_wrapper(size_t size) {
154
    void *p = malloc(size);
155
    if (!p) {
156
        report_error("Not enough of memory for auto-copy harness\n");
157
        exit(12);
158
    }
159
    return p;
160
}
(-)a/cnd.remote/tools/rfs_util.h (+2 lines)
Lines 77-79 Link Here
77
#define dbg_sleep(time) if (trace_flag) { _dbg_sleep(time); }
77
#define dbg_sleep(time) if (trace_flag) { _dbg_sleep(time); }
78
void _dbg_sleep(int time);
78
void _dbg_sleep(int time);
79
79
80
// NB: don't use malloc_wrapper in preload!!!
81
void *malloc_wrapper(size_t size);

Return to bug 256919