Changeset 84439d7 in mainline for uspace/app


Ignore:
Timestamp:
2010-12-05T09:34:46Z (15 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
75732da
Parents:
56b962d (diff), 35537a7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge with development/

Location:
uspace/app
Files:
3 added
29 edited
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/modules/bdd/bdd.c

    r56b962d r84439d7  
    3030#include <stdlib.h>
    3131#include <str.h>
     32#include <sys/typefmt.h>
    3233#include "config.h"
    3334#include "util.h"
     
    122123                rc = block_read_direct(handle, ba, 1, blk);
    123124                if (rc != EOK) {
    124                         printf("%s: Error reading block %llu\n", cmdname, ba);
     125                        printf("%s: Error reading block %" PRIuOFF64 "\n", cmdname, ba);
    125126                        free(blk);
    126127                        block_fini(handle);
  • uspace/app/bdsh/cmds/modules/cp/cp.c

    r56b962d r84439d7  
    9595
    9696        if (vb)
    97                 printf("%d bytes to copy\n", total);
     97                printf("%" PRIu64 " bytes to copy\n", total);
    9898
    9999        lseek(fd1, 0, SEEK_SET);
     
    130130                 */
    131131                if (res != 0) {
    132                         printf("\n%d more bytes than actually exist were copied\n", res);
     132                        printf("\n%zd more bytes than actually exist were copied\n", res);
    133133                        goto err;
    134134                }
     
    187187                        return CMD_SUCCESS;
    188188                case 'v':
    189                         printf("%d\n", CP_VERSION);
     189                        printf("%s\n", CP_VERSION);
    190190                        return CMD_SUCCESS;
    191191                case 'V':
     
    223223
    224224        if (verbose)
    225                 printf("%d bytes copied\n", ret);
     225                printf("%" PRId64 " bytes copied\n", ret);
    226226
    227227        if (ret >= 0)
  • uspace/app/bdsh/cmds/modules/mkfile/mkfile.c

    r56b962d r84439d7  
    168168                rc = write(fd, buffer, to_write);
    169169                if (rc <= 0) {
    170                         printf("%s: Error writing file (%d).\n", cmdname, rc);
     170                        printf("%s: Error writing file (%zd).\n", cmdname, rc);
    171171                        close(fd);
    172172                        return CMD_FAILURE;
     
    177177        rc = close(fd);
    178178        if (rc != 0) {
    179                 printf("%s: Error writing file (%d).\n", cmdname, rc);
     179                printf("%s: Error writing file (%zd).\n", cmdname, rc);
    180180                return CMD_FAILURE;
    181181        }
  • uspace/app/bdsh/cmds/modules/unmount/unmount.c

    r56b962d r84439d7  
    4747        } else {
    4848                help_cmd_unmount(HELP_SHORT);
    49                 printf("Usage:  %s <mp>\n", cmdname);
     49                printf("Usage: %s <mp>\n", cmdname);
    5050        }
    5151        return;
     
    6868        rc = unmount(argv[1]);
    6969        if (rc != EOK) {
    70                 printf("Unable to unmount %s (rc=%d)\n", argv[1]);
     70                printf("Unable to unmount %s (rc=%d)\n", argv[1], rc);
    7171                return CMD_FAILURE;
    7272        }
  • uspace/app/bdsh/exec.c

    r56b962d r84439d7  
    133133        rc = task_wait(tid, &texit, &retval);
    134134        if (rc != EOK) {
    135                 printf("%s: Failed waiting for command (%s)\n", str_error(rc));
     135                printf("%s: Failed waiting for command (%s)\n", progname,
     136                    str_error(rc));
    136137        } else if (texit != TASK_EXIT_NORMAL) {
    137138                printf("%s: Command failed (unexpectedly terminated)\n", progname);
  • uspace/app/edit/edit.c

    r56b962d r84439d7  
    781781                        c = str_decode(row_buf, &pos, size);
    782782                        if (c != '\t') {
    783                                 printf("%lc", c);
     783                                printf("%lc", (wint_t) c);
    784784                                s_column += 1;
    785785                        } else {
     
    830830        int n = printf(" %d, %d: File '%s'. Ctrl-Q Quit  Ctrl-S Save  "
    831831            "Ctrl-E Save As", coord.row, coord.column, fname);
    832         printf("%*s", scr_columns - 1 - n, "");
     832       
     833        int pos = scr_columns - 1 - n;
     834        printf("%*s", pos, "");
    833835        fflush(stdout);
    834836        console_set_style(con, STYLE_NORMAL);
     
    11531155        console_set_pos(con, 0, scr_rows - 1);
    11541156        console_set_style(con, STYLE_INVERTED);
    1155         printf(" %*s ", -(scr_columns - 3), str);
     1157       
     1158        int pos = -(scr_columns - 3);
     1159        printf(" %*s ", pos, str);
    11561160        fflush(stdout);
    11571161        console_set_style(con, STYLE_NORMAL);
  • uspace/app/netecho/netecho.c

    r56b962d r84439d7  
    220220        // check the buffer size
    221221        if (size <= 0) {
    222                 fprintf(stderr, "Receive size too small (%d). Using 1024 bytes instead.\n", size);
     222                fprintf(stderr, "Receive size too small (%zu). Using 1024 bytes instead.\n", size);
    223223                size = 1024;
    224224        }
     
    262262                // check the backlog
    263263                if (backlog <= 0) {
    264                         fprintf(stderr, "Accepted sockets queue size too small (%d). Using 3 instead.\n", size);
     264                        fprintf(stderr, "Accepted sockets queue size too small (%zu). Using 3 instead.\n", size);
    265265                        backlog = 3;
    266266                }
     
    325325                                                break;
    326326                                        default:
    327                                                 fprintf(stderr, "Address family %d (0x%X) is not supported.\n", address->sa_family);
     327                                                fprintf(stderr, "Address family %u (%#x) is not supported.\n",
     328                                                    address->sa_family, address->sa_family);
    328329                                        }
    329330                                        // parse the source address
     
    334335                                                } else {
    335336                                                        data[length] = '\0';
    336                                                         printf("Socket %d received %d bytes from %s:%d\n%s\n", socket_id, length, address_string, port, data);
     337                                                        printf("Socket %d received %zu bytes from %s:%d\n%s\n",
     338                                                            socket_id, length, address_string, port, data);
    337339                                                }
    338340                                        }
  • uspace/app/nettest1/nettest1.c

    r56b962d r84439d7  
    356356        /* Check data buffer size */
    357357        if (size <= 0) {
    358                 fprintf(stderr, "Data buffer size too small (%d). Using 1024 "
     358                fprintf(stderr, "Data buffer size too small (%zu). Using 1024 "
    359359                    "bytes instead.\n", size);
    360360                size = 1024;
     
    410410        }
    411411
    412         printf("Tested in %d microseconds\n", tv_sub(&time_after,
     412        printf("Tested in %ld microseconds\n", tv_sub(&time_after,
    413413            &time_before));
    414414
  • uspace/app/nettest2/nettest2.c

    r56b962d r84439d7  
    302302        /* Check data buffer size. */
    303303        if (size <= 0) {
    304                 fprintf(stderr, "Data buffer size too small (%d). Using 1024 "
     304                fprintf(stderr, "Data buffer size too small (%zu). Using 1024 "
    305305                    "bytes instead.\n", size);
    306306                size = 1024;
     
    375375                printf("\tOK\n");
    376376
    377         printf("sendto + recvfrom tested in %d microseconds\n",
     377        printf("sendto + recvfrom tested in %ld microseconds\n",
    378378            tv_sub(&time_after, &time_before));
    379379
     
    403403                printf("\tOK\n");
    404404
    405         printf("sendto, recvfrom tested in %d microseconds\n",
     405        printf("sendto, recvfrom tested in %ld microseconds\n",
    406406            tv_sub(&time_after, &time_before));
    407407
  • uspace/app/ping/ping.c

    r56b962d r84439d7  
    337337        }
    338338       
    339         printf("PING %s (%s) %u(%u) bytes of data\n", config.dest_addr,
     339        printf("PING %s (%s) %zu(%zu) bytes of data\n", config.dest_addr,
    340340            config.dest_str, config.size, config.size);
    341341       
     
    378378                switch (result) {
    379379                case ICMP_ECHO:
    380                         printf("%u bytes from ? (?): icmp_seq=%u ttl=? time=%u.%04u\n",
     380                        printf("%zu bytes from ? (?): icmp_seq=%u ttl=? time=%ld.%04ld\n",
    381381                                config.size, seq, elapsed / 1000, elapsed % 1000);
    382382                        break;
    383383                case ETIMEOUT:
    384                         printf("%u bytes from ? (?): icmp_seq=%u Timed out\n",
     384                        printf("%zu bytes from ? (?): icmp_seq=%u Timed out\n",
    385385                                config.size, seq);
    386386                        break;
  • uspace/app/redir/redir.c

    r56b962d r84439d7  
    7878{
    7979        const char **args;
    80         task_id_t id;
     80        task_id_t id = 0;
    8181        int rc;
    8282
  • uspace/app/stats/stats.c

    r56b962d r84439d7  
    5656       
    5757        uint64_t sec = time.tv_sec;
    58         printf("%02" PRIu64 ":%02" PRIu64 ":%02" PRIu64, (sec % DAY) / HOUR,
    59             (sec % HOUR) / MINUTE, sec % MINUTE);
     58        printf("%02" PRIu64 ":%02" PRIu64 ":%02" PRIu64,
     59            (sec % DAY) / HOUR, (sec % HOUR) / MINUTE, sec % MINUTE);
    6060       
    6161        sysarg_t uptime = stats_get_uptime();
    62         printf(", up %u days, %u hours, %u minutes, %u seconds", uptime / DAY,
    63             (uptime % DAY) / HOUR, (uptime % HOUR) / MINUTE, uptime % MINUTE);
     62        printf(", up %" PRIun " days, %" PRIun " hours, "
     63            "%" PRIun " minutes, %" PRIun " seconds",
     64            uptime / DAY, (uptime % DAY) / HOUR,
     65            (uptime % HOUR) / MINUTE, uptime % MINUTE);
    6466       
    6567        size_t count;
  • uspace/app/taskdump/taskdump.c

    r56b962d r84439d7  
    8585        rc = connect_task(task_id);
    8686        if (rc < 0) {
    87                 printf("Failed connecting to task %" PRIdTASKID ".\n", task_id);
     87                printf("Failed connecting to task %" PRIu64 ".\n", task_id);
    8888                return 1;
    8989        }
     
    9292        app_symtab = NULL;
    9393
    94         printf("Dumping task '%s' (task ID %" PRIdTASKID ").\n", app_name, task_id);
     94        printf("Dumping task '%s' (task ID %" PRIu64 ").\n", app_name, task_id);
    9595        autoload_syms();
    9696        putchar('\n');
     
    126126        if (rc < 0) {
    127127                printf("Error connecting\n");
    128                 printf("ipc_connect_task(%" PRIdTASKID ") -> %d ", task_id, rc);
     128                printf("ipc_connect_task(%" PRIu64 ") -> %d ", task_id, rc);
    129129                return rc;
    130130        }
     
    168168                                core_file_name = *argv;
    169169                        } else {
    170                                 printf("Uknown option '%s'\n", arg[0]);
     170                                printf("Uknown option '%c'\n", arg[0]);
    171171                                print_syntax();
    172172                                return -1;
     
    240240        printf("Threads:\n");
    241241        for (i = 0; i < n_threads; i++) {
    242                 printf(" [%d] hash: %p\n", 1+i, thash_buf[i]);
     242                printf(" [%zu] hash: %p\n", 1 + i, (void *) thash_buf[i]);
    243243
    244244                thread_dump(thash_buf[i]);
     
    284284        printf("Address space areas:\n");
    285285        for (i = 0; i < n_areas; i++) {
    286                 printf(" [%d] flags: %c%c%c%c base: %p size: %p\n", 1+i,
     286                printf(" [%zu] flags: %c%c%c%c base: %p size: %zu\n", 1 + i,
    287287                    (ainfo_buf[i].flags & AS_AREA_READ) ? 'R' : '-',
    288288                    (ainfo_buf[i].flags & AS_AREA_WRITE) ? 'W' : '-',
    289289                    (ainfo_buf[i].flags & AS_AREA_EXEC) ? 'X' : '-',
    290290                    (ainfo_buf[i].flags & AS_AREA_CACHEABLE) ? 'C' : '-',
    291                     ainfo_buf[i].start_addr, ainfo_buf[i].size);
     291                    (void *) ainfo_buf[i].start_addr, ainfo_buf[i].size);
    292292        }
    293293
     
    326326
    327327        sym_pc = fmt_sym_address(pc);
    328         printf("Thread %p crashed at %s. FP = %p\n", thash, sym_pc, fp);
     328        printf("Thread %p crashed at %s. FP = %p\n", (void *) thash,
     329            sym_pc, (void *) fp);
    329330        free(sym_pc);
    330331
     
    334335        while (stacktrace_fp_valid(&st, fp)) {
    335336                sym_pc = fmt_sym_address(pc);
    336                 printf("  %p: %s\n", fp, sym_pc);
     337                printf("  %p: %s\n", (void *) fp, sym_pc);
    337338                free(sym_pc);
    338339
     
    457458
    458459        if (rc == EOK) {
    459                 rc = asprintf(&str, "%p (%s+%p)", addr, name, offs);
     460                rc = asprintf(&str, "%p (%s+%zu)", (void *) addr, name, offs);
    460461        } else {
    461                 rc = asprintf(&str, "%p", addr);
     462                rc = asprintf(&str, "%p", (void *) addr);
    462463        }
    463464
  • uspace/app/tasks/tasks.c

    r56b962d r84439d7  
    7777                order_suffix(stats_tasks[i].kcycles, &kcycles, &ksuffix);
    7878               
    79                 printf("%8" PRIu64 "%8u %8" PRIu64"%c %12"
     79                printf("%8" PRIu64 "%8zu %8" PRIu64 "%c %12"
    8080                    PRIu64 "%c %12" PRIu64 "%c %s\n", stats_tasks[i].task_id,
    8181                    stats_tasks[i].threads, virtmem, vmsuffix, ucycles, usuffix,
     
    160160        }
    161161       
    162         printf("%s: %u CPU(s) detected\n", NAME, count);
     162        printf("%s: %zu CPU(s) detected\n", NAME, count);
    163163       
    164164        size_t i;
  • uspace/app/tester/Makefile

    r56b962d r84439d7  
    3838        print/print3.c \
    3939        print/print4.c \
     40        print/print5.c \
    4041        console/console1.c \
    4142        stdio/stdio1.c \
     
    4950        ipc/connect.c \
    5051        loop/loop1.c \
    51         mm/malloc1.c
     52        mm/malloc1.c \
     53        hw/serial/serial1.c
    5254
    5355include $(USPACE_PREFIX)/Makefile.common
  • uspace/app/tester/hw/serial/serial1.c

    r56b962d r84439d7  
    2727 */
    2828
    29 /** @addtogroup test_serial
    30  * @brief       test the serial port driver - read from the serial port
     29/** @addtogroup tester
     30 * @brief Test the serial port driver - loopback test
    3131 * @{
    3232 */
     
    3535 */
    3636
     37#include <inttypes.h>
    3738#include <errno.h>
    3839#include <stdlib.h>
     
    4748#include <str.h>
    4849#include <ipc/serial_ctl.h>
    49 
    50 #define NAME            "test serial"
    51 
    52 
    53 static void print_usage(void)
     50#include "../../tester.h"
     51
     52#define DEFAULT_COUNT  1024
     53#define DEFAULT_SLEEP  100000
     54#define EOT            "####> End of transfer <####\n"
     55
     56const char *test_serial1(void)
    5457{
    55         printf("Usage: \n test_serial count \n where count is the number of "
    56             "characters to be read\n");
    57 }
    58 
    59 int main(int argc, char *argv[])
    60 {
    61         if (argc != 2) {
    62                 printf(NAME ": incorrect number of arguments.\n");
    63                 print_usage();
    64                 return 0;
    65         }
    66        
    67         long int cnt = strtol(argv[1], NULL, 10);
    68        
    69         int res;
    70         res = devman_get_phone(DEVMAN_CLIENT, IPC_FLAG_BLOCKING);
     58        size_t cnt;
     59       
     60        if (test_argc < 1)
     61                cnt = DEFAULT_COUNT;
     62        else
     63                switch (str_size_t(test_argv[0], NULL, 0, true, &cnt)) {
     64                case EOK:
     65                        break;
     66                case EINVAL:
     67                        return "Invalid argument, unsigned integer expected";
     68                case EOVERFLOW:
     69                        return "Argument size overflow";
     70                default:
     71                        return "Unexpected argument error";
     72                }
     73       
     74        int res = devman_get_phone(DEVMAN_CLIENT, IPC_FLAG_BLOCKING);
     75       
    7176        devman_handle_t handle;
    72        
    7377        res = devman_device_get_handle("/hw/pci0/00:01.0/com1", &handle,
    7478            IPC_FLAG_BLOCKING);
    75         if (EOK != res) {
    76                 printf(NAME ": could not get the device handle, errno = %d.\n",
    77                     -res);
    78                 return 1;
    79         }
    80        
    81         printf(NAME ": trying to read %d characters from device with handle "
    82             "%d.\n", cnt, handle);
     79        if (res != EOK)
     80                return "Could not get serial device handle";
    8381       
    8482        int phone = devman_device_connect(handle, IPC_FLAG_BLOCKING);
    85         if (0 > phone) {
    86                 printf(NAME ": could not connect to the device, errno = %d.\n",
    87                     -res);
    88                 devman_hangup_phone(DEVMAN_CLIENT);
    89                 return 2;
     83        if (phone < 0) {
     84                devman_hangup_phone(DEVMAN_CLIENT);
     85                return "Unable to connect to serial device";
    9086        }
    9187       
    9288        char *buf = (char *) malloc(cnt + 1);
    93         if (NULL == buf) {
    94                 printf(NAME ": failed to allocate the input buffer\n");
     89        if (buf == NULL) {
    9590                ipc_hangup(phone);
    9691                devman_hangup_phone(DEVMAN_CLIENT);
    97                 return 3;
    98         }
    99        
    100         ipcarg_t old_baud, old_par, old_stop, old_word_size;
     92                return "Failed to allocate input buffer";
     93        }
     94       
     95        ipcarg_t old_baud;
     96        ipcarg_t old_par;
     97        ipcarg_t old_stop;
     98        ipcarg_t old_word_size;
    10199       
    102100        res = ipc_call_sync_0_4(phone, SERIAL_GET_COM_PROPS, &old_baud,
    103101            &old_par, &old_word_size, &old_stop);
    104         if (EOK != res) {
    105                 printf(NAME ": failed to get old communication parameters, "
    106                     "errno = %d.\n", -res);
    107                 devman_hangup_phone(DEVMAN_CLIENT);
     102        if (res != EOK) {
     103                free(buf);
    108104                ipc_hangup(phone);
    109                 free(buf);
    110                 return 4;
     105                devman_hangup_phone(DEVMAN_CLIENT);
     106                return "Failed to get old serial communication parameters";
    111107        }
    112108       
     
    114110            SERIAL_NO_PARITY, 8, 1);
    115111        if (EOK != res) {
    116                 printf(NAME ": failed to set communication parameters, errno = "
    117                     "%d.\n", -res);
    118                 devman_hangup_phone(DEVMAN_CLIENT);
     112                free(buf);
    119113                ipc_hangup(phone);
    120                 free(buf);
    121                 return 4;
    122         }
    123        
    124         int total = 0;
    125         int read = 0;
     114                devman_hangup_phone(DEVMAN_CLIENT);
     115                return "Failed to set serial communication parameters";
     116        }
     117       
     118        TPRINTF("Trying to read %zu characters from serial device "
     119            "(handle=%" PRIun ")\n", cnt, handle);
     120       
     121        size_t total = 0;
    126122        while (total < cnt) {
    127                 read = read_dev(phone, buf, cnt - total);
    128                 if (0 > read) {
    129                         printf(NAME ": failed read from device, errno = %d.\n",
    130                             -read);
     123                ssize_t read = read_dev(phone, buf, cnt - total);
     124               
     125                if (read < 0) {
    131126                        ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
    132127                            old_par, old_word_size, old_stop);
     128                        free(buf);
    133129                        ipc_hangup(phone);
    134130                        devman_hangup_phone(DEVMAN_CLIENT);
     131                        return "Failed read from serial device";
     132                }
     133               
     134                if ((size_t) read > cnt - total) {
     135                        ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
     136                            old_par, old_word_size, old_stop);
    135137                        free(buf);
    136                         return 5;
    137                 }
    138                 total += read;
    139                 if (read > 0) {
     138                        ipc_hangup(phone);
     139                        devman_hangup_phone(DEVMAN_CLIENT);
     140                        return "Read more data than expected";
     141                }
     142               
     143                TPRINTF("Read %zd bytes\n", read);
     144               
     145                if (read == 0)
     146                        usleep(DEFAULT_SLEEP);
     147                else {
    140148                        buf[read] = 0;
    141                         printf(buf);
     149                       
    142150                        /*
    143151                         * Write data back to the device to test the opposite
    144152                         * direction of data transfer.
    145153                         */
    146                         write_dev(phone, buf, read);
    147                 } else {
    148                         usleep(100000);
    149                 }       
    150         }
    151        
    152         const char *the_end = "\n---------\nTHE END\n---------\n";
    153         write_dev(phone, (void *)the_end, str_size(the_end));
    154        
    155         /* restore original communication settings */
    156         ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud, old_par,
    157             old_word_size, old_stop);
     154                        ssize_t written = write_dev(phone, buf, read);
     155                       
     156                        if (written < 0) {
     157                                ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
     158                                    old_par, old_word_size, old_stop);
     159                                free(buf);
     160                                ipc_hangup(phone);
     161                                devman_hangup_phone(DEVMAN_CLIENT);
     162                                return "Failed write to serial device";
     163                        }
     164                       
     165                        if (written != read) {
     166                                ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
     167                                    old_par, old_word_size, old_stop);
     168                                free(buf);
     169                                ipc_hangup(phone);
     170                                devman_hangup_phone(DEVMAN_CLIENT);
     171                                return "Written less data than read from serial device";
     172                        }
     173                       
     174                        TPRINTF("Written %zd bytes\n", written);
     175                }
     176               
     177                total += read;
     178        }
     179       
     180        TPRINTF("Trying to write EOT banner to the serial device\n");
     181       
     182        size_t eot_size = str_size(EOT);
     183        ssize_t written = write_dev(phone, (void *) EOT, eot_size);
     184       
     185        ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
     186            old_par, old_word_size, old_stop);
     187        free(buf);
     188        ipc_hangup(phone);
    158189        devman_hangup_phone(DEVMAN_CLIENT);
    159         ipc_hangup(phone);
    160         free(buf);
    161        
    162         return 0;
     190       
     191        if (written < 0)
     192                return "Failed to write EOT banner to serial device";
     193       
     194        if ((size_t) written != eot_size)
     195                return "Written less data than the size of the EOT banner "
     196                    "to serial device";
     197       
     198        return NULL;
    163199}
    164200
  • uspace/app/tester/ipc/ping_pong.c

    r56b962d r84439d7  
    7272        }
    7373       
    74         TPRINTF("OK\nCompleted %llu round trips in %u seconds, %llu rt/s.\n",
     74        TPRINTF("OK\nCompleted %" PRIu64 " round trips in %u seconds, %" PRIu64 " rt/s.\n",
    7575            count, DURATION_SECS, count / DURATION_SECS);
    7676       
  • uspace/app/tester/ipc/register.c

    r56b962d r84439d7  
    2727 */
    2828
     29#include <inttypes.h>
    2930#include <stdio.h>
    3031#include <unistd.h>
     
    4142        unsigned int i;
    4243       
    43         TPRINTF("Connected phone %#x accepting\n", icall->in_phone_hash);
     44        TPRINTF("Connected phone %" PRIun " accepting\n", icall->in_phone_hash);
    4445        ipc_answer_0(iid, EOK);
    4546        for (i = 0; i < MAX_CONNECTIONS; i++) {
     
    5758                switch (IPC_GET_METHOD(call)) {
    5859                case IPC_M_PHONE_HUNGUP:
    59                         TPRINTF("Phone %#x hung up\n", icall->in_phone_hash);
     60                        TPRINTF("Phone %" PRIun " hung up\n", icall->in_phone_hash);
    6061                        retval = 0;
    6162                        break;
    6263                case IPC_TEST_METHOD:
    63                         TPRINTF("Received well known message from %#x: %#x\n",
     64                        TPRINTF("Received well known message from %" PRIun ": %" PRIun "\n",
    6465                            icall->in_phone_hash, callid);
    6566                        ipc_answer_0(callid, EOK);
    6667                        break;
    6768                default:
    68                         TPRINTF("Received unknown message from %#x: %#x\n",
     69                        TPRINTF("Received unknown message from %" PRIun ": %" PRIun "\n",
    6970                            icall->in_phone_hash, callid);
    7071                        ipc_answer_0(callid, ENOENT);
  • uspace/app/tester/print/print1.c

    r56b962d r84439d7  
    4949        TPRINTF("Real output:     \"%8.10s\"\n\n", "very long text");
    5050       
    51         TPRINTF("Testing printf(\"%%s\", NULL):\n");
    52         TPRINTF("Expected output: \"(NULL)\"\n");
    53         TPRINTF("Real output:     \"%s\"\n\n", NULL);
    54        
    5551        return NULL;
    5652}
  • uspace/app/tester/print/print2.c

    r56b962d r84439d7  
    3333const char *test_print2(void)
    3434{
    35         TPRINTF("Testing printf(\"%%c %%3.2c %%-3.2c %%2.3c %%-2.3c\", 'a', 'b', 'c', 'd', 'e'):\n");
    36         TPRINTF("Expected output: [a] [  b] [c  ] [ d] [e ]\n");
    37         TPRINTF("Real output:     [%c] [%3.2c] [%-3.2c] [%2.3c] [%-2.3c]\n\n", 'a', 'b', 'c', 'd', 'e');
     35        TPRINTF("Testing printf(\"%%c\", 'a'):\n");
     36        TPRINTF("Expected output: [a]\n");
     37        TPRINTF("Real output:     [%c]\n\n", 'a');
    3838       
    3939        TPRINTF("Testing printf(\"%%d %%3.2d %%-3.2d %%2.3d %%-2.3d\", 1, 2, 3, 4, 5):\n");
  • uspace/app/tester/print/print4.c

    r56b962d r84439d7  
    4545                TPRINTF("  ");
    4646                for (index = 0; index < 32; index++)
    47                         TPRINTF("%lc", (wchar_t) ((group << 5) + index));
     47                        TPRINTF("%lc", (wint_t) ((group << 5) + index));
    4848               
    4949                TPRINTF("\n");
     
    5757                uint8_t index;
    5858                for (index = 0; index < 32; index++)
    59                         TPRINTF("%lc", (wchar_t) ((group << 5) + index));
     59                        TPRINTF("%lc", (wint_t) ((group << 5) + index));
    6060               
    6161                TPRINTF("\n");
  • uspace/app/tester/stdio/stdio1.c

    r56b962d r84439d7  
    6060       
    6161        buf[cnt] = '\0';
    62         TPRINTF("Read %u bytes, string \"%s\"\n", cnt, buf);
     62        TPRINTF("Read %zu bytes, string \"%s\"\n", cnt, buf);
    6363       
    6464        TPRINTF("Seek to beginning...");
  • uspace/app/tester/tester.c

    r56b962d r84439d7  
    5151#include "print/print3.def"
    5252#include "print/print4.def"
     53#include "print/print5.def"
    5354#include "console/console1.def"
    5455#include "stdio/stdio1.def"
     
    6364#include "loop/loop1.def"
    6465#include "mm/malloc1.def"
     66#include "hw/serial/serial1.def"
    6567        {NULL, NULL, NULL, false}
    6668};
     
    110112        }
    111113       
     114        unsigned int _len = (unsigned int) len;
     115        if ((_len != len) || (((int) _len) < 0)) {
     116                printf("Command length overflow\n");
     117                return;
     118        }
     119       
    112120        for (test = tests; test->name != NULL; test++)
    113                 printf("%-*s %s%s\n", len, test->name, test->desc, (test->safe ? "" : " (unsafe)"));
     121                printf("%-*s %s%s\n", _len, test->name, test->desc,
     122                    (test->safe ? "" : " (unsafe)"));
    114123       
    115         printf("%-*s Run all safe tests\n", len, "*");
     124        printf("%-*s Run all safe tests\n", _len, "*");
    116125}
    117126
  • uspace/app/tester/tester.h

    r56b962d r84439d7  
    6868extern const char *test_print3(void);
    6969extern const char *test_print4(void);
     70extern const char *test_print5(void);
    7071extern const char *test_console1(void);
    7172extern const char *test_stdio1(void);
     
    8081extern const char *test_loop1(void);
    8182extern const char *test_malloc1(void);
     83extern const char *test_serial1(void);
    8284
    8385extern test_t tests[];
  • uspace/app/tester/thread/thread1.c

    r56b962d r84439d7  
    3535#include <stdio.h>
    3636#include <unistd.h>
     37#include <inttypes.h>
    3738#include "../tester.h"
    3839
     
    7475        atomic_set(&finish, 0);
    7576        while (atomic_get(&threads_finished) < total) {
    76                 TPRINTF("Threads left: %u\n", total - atomic_get(&threads_finished));
     77                TPRINTF("Threads left: %" PRIua "\n",
     78                    total - atomic_get(&threads_finished));
    7779                sleep(1);
    7880        }
  • uspace/app/tester/vfs/vfs1.c

    r56b962d r84439d7  
    105105        if (cnt < 0)
    106106                return "write() failed";
    107         TPRINTF("Written %d bytes\n", cnt);
     107        TPRINTF("Written %zd bytes\n", cnt);
    108108       
    109109        if (lseek(fd0, 0, SEEK_SET) != 0)
     
    116116                        return "read() failed";
    117117               
    118                 TPRINTF("Read %d bytes: \".*s\"\n", cnt, cnt, buf);
     118                int _cnt = (int) cnt;
     119                if (_cnt != cnt) {
     120                        /* Count overflow, just to be sure. */
     121                        TPRINTF("Read %zd bytes\n", cnt);
     122                } else {
     123                        TPRINTF("Read %zd bytes: \"%.*s\"\n", cnt, _cnt, buf);
     124                }
    119125        }
    120126       
  • uspace/app/top/screen.c

    r56b962d r84439d7  
    150150        screen_get_pos(&c, &r);
    151151       
    152         if (c < cols)
    153                 printf("%.*s", cols - c - 1, str);
     152        if (c < cols) {
     153                int pos = cols - c - 1;
     154                printf("%.*s", pos, str);
     155        }
    154156}
    155157
    156158static inline void print_global_head(data_t *data)
    157159{
    158         printf("top - %02lu:%02lu:%02lu up %u days, %02u:%02u:%02u, load average:",
     160        printf("top - %02lu:%02lu:%02lu up "
     161            "%" PRIun " days, %02" PRIun ":%02" PRIun ":%02" PRIun ", "
     162            "load average:",
    159163            data->hours, data->minutes, data->seconds,
    160164            data->udays, data->uhours, data->uminutes, data->useconds);
     
    171175static inline void print_task_summary(data_t *data)
    172176{
    173         printf("tasks: %u total", data->tasks_count);
     177        printf("tasks: %zu total", data->tasks_count);
    174178        screen_newline();
    175179}
     
    211215        }
    212216       
    213         printf("threads: %u total, %u running, %u ready, %u sleeping, %u lingering, "
    214             "%u other, %u invalid",
     217        printf("threads: %zu total, %zu running, %zu ready, "
     218            "%zu sleeping, %zu lingering, %zu other, %zu invalid",
    215219            total, running, ready, sleeping, lingering, other, invalid);
    216220        screen_newline();
     
    295299                order_suffix(task->virtmem, &virtmem, &virtmem_suffix);
    296300               
    297                 printf("%-8" PRIu64 " %9u %8" PRIu64 "%c ", task->task_id,
     301                printf("%-8" PRIu64 " %9zu %8" PRIu64 "%c ", task->task_id,
    298302                    task->threads, virtmem, virtmem_suffix);
    299303                print_percent(perc->virtmem, 2);
  • uspace/app/trace/ipcp.c

    r56b962d r84439d7  
    137137
    138138        if (oper != NULL) {
    139                 printf("%s (%ld)", oper->name, method);
     139                printf("%s (%" PRIun ")", oper->name, method);
    140140                return;
    141141        }
    142142
    143         printf("%ld", method);
     143        printf("%" PRIun, method);
    144144}
    145145
     
    201201
    202202        if ((display_mask & DM_IPC) != 0) {
    203                 printf("Call ID: %p, phone: %d, proto: %s, method: ", hash,
    204                         phone, (proto ? proto->name : "n/a"));
     203                printf("Call ID: %p, phone: %d, proto: %s, method: ",
     204                    (void *) hash, phone,
     205                    (proto ? proto->name : "n/a"));
    205206                ipc_m_print(proto, IPC_GET_METHOD(*call));
    206                 printf(" args: (%" PRIuIPCARG ", %" PRIuIPCARG ", %" PRIuIPCARG
    207                     ", %" PRIuIPCARG ", %" PRIuIPCARG ")\n", args[1], args[2],
    208                     args[3], args[4], args[5]);
     207                printf(" args: (%" PRIun ", %" PRIun ", %" PRIun ", "
     208                    "%" PRIun ", %" PRIun ")\n",
     209                    args[1], args[2], args[3], args[4], args[5]);
    209210        }
    210211
     
    281282
    282283        if ((display_mask & DM_IPC) != 0) {
    283                 printf("Response to %p: retval=%ld, args = (%" PRIuIPCARG
    284                     ", %" PRIuIPCARG ", %" PRIuIPCARG ", %" PRIuIPCARG
    285                     ", %" PRIuIPCARG ")\n",
    286                     hash, retval, IPC_GET_ARG1(*answer),
     284                printf("Response to %p: retval=%" PRIdn ", args = (%" PRIun ", "
     285                    "%" PRIun ", %" PRIun ", %" PRIun ", %" PRIun ")\n",
     286                    (void *) hash, retval, IPC_GET_ARG1(*answer),
    287287                    IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer),
    288288                    IPC_GET_ARG4(*answer), IPC_GET_ARG5(*answer));
     
    340340                /* Not a response */
    341341                if ((display_mask & DM_IPC) != 0) {
    342                         printf("Not a response (hash %p)\n", hash);
     342                        printf("Not a response (hash %p)\n", (void *) hash);
    343343                }
    344344                return;
  • uspace/app/trace/trace.c

    r56b962d r84439d7  
    161161        if (rc < 0) {
    162162                printf("Error connecting\n");
    163                 printf("ipc_connect_task(%" PRIdTASKID ") -> %d ", task_id, rc);
     163                printf("ipc_connect_task(%" PRIu64 ") -> %d ", task_id, rc);
    164164                return rc;
    165165        }
     
    200200        printf("Threads:");
    201201        for (i = 0; i < n_threads; i++) {
    202                 printf(" [%d] (hash %p)", 1+i, thread_hash_buf[i]);
    203         }
    204         printf("\ntotal of %u threads\n", tb_needed / sizeof(uintptr_t));
     202                printf(" [%d] (hash %p)", 1 + i, (void *) thread_hash_buf[i]);
     203        }
     204        printf("\ntotal of %zu threads\n", tb_needed / sizeof(uintptr_t));
    205205
    206206        return 0;
     
    224224        case V_HASH:
    225225        case V_PTR:
    226                 printf("%p", val);
     226                printf("%p", (void *) val);
    227227                break;
    228228
     
    248248        case V_CHAR:
    249249                if (sval >= 0x20 && sval < 0x7f) {
    250                         printf("'%c'", sval);
     250                        printf("'%c'", (char) sval);
    251251                } else {
    252252                        switch (sval) {
     
    257257                        case '\t': printf("'\\t'"); break;
    258258                        case '\\': printf("'\\\\'"); break;
    259                         default: printf("'\\x%02lX'", val); break;
     259                        default: printf("'\\x%02" PRIxn "'", val); break;
    260260                        }
    261261                }
     
    277277
    278278        putchar('(');
    279         if (n > 0) printf("%" PRIdSYSARG, sc_args[0]);
     279        if (n > 0) printf("%" PRIun, sc_args[0]);
    280280        for (i = 1; i < n; i++) {
    281                 printf(", %" PRIdSYSARG, sc_args[i]);
     281                printf(", %" PRIun, sc_args[i]);
    282282        }
    283283        putchar(')');
     
    489489{
    490490        async_serialize_start();
    491         printf("New thread, hash 0x%lx\n", hash);
     491        printf("New thread, hash %p\n", (void *) hash);
    492492        async_serialize_end();
    493493
     
    510510        }
    511511
    512         printf("Start tracing thread [%d] (hash %p).\n", thread_id, thread_hash);
     512        printf("Start tracing thread [%u] (hash %p).\n",
     513            thread_id, (void *) thread_hash);
    513514
    514515        while (!abort_trace) {
     
    516517                fibril_mutex_lock(&state_lock);
    517518                if (paused) {
    518                         printf("Thread [%d] paused. Press R to resume.\n",
     519                        printf("Thread [%u] paused. Press R to resume.\n",
    519520                            thread_id);
    520521
     
    522523                                fibril_condvar_wait(&state_cv, &state_lock);
    523524
    524                         printf("Thread [%d] resumed.\n", thread_id);
     525                        printf("Thread [%u] resumed.\n", thread_id);
    525526                }
    526527                fibril_mutex_unlock(&state_lock);
     
    554555                                break;
    555556                        case UDEBUG_EVENT_THREAD_E:
    556                                 printf("Thread %p exited.\n", val0);
     557                                printf("Thread %" PRIun " exited.\n", val0);
    557558                                fibril_mutex_lock(&state_lock);
    558559                                abort_trace = true;
     
    927928                                }
    928929                        } else {
    929                                 printf("Uknown option '%s'\n", arg[0]);
     930                                printf("Uknown option '%c'\n", arg[0]);
    930931                                print_syntax();
    931932                                return -1;
     
    984985        rc = connect_task(task_id);
    985986        if (rc < 0) {
    986                 printf("Failed connecting to task %" PRIdTASKID ".\n", task_id);
     987                printf("Failed connecting to task %" PRIu64 ".\n", task_id);
    987988                return 1;
    988989        }
    989990
    990         printf("Connected to task %" PRIdTASKID ".\n", task_id);
     991        printf("Connected to task %" PRIu64 ".\n", task_id);
    991992
    992993        if (task_ldr != NULL)
  • uspace/app/virtusbkbd/virtusbkbd.c

    r56b962d r84439d7  
    171171static void on_keyboard_change(kb_status_t *status)
    172172{
    173         printf("%s: Current keyboard status: %08hhb", NAME, status->modifiers);
     173        printf("%s: Current keyboard status: %02hhx", NAME, status->modifiers);
    174174        size_t i;
    175175        for (i = 0; i < KB_MAX_KEYS_AT_ONCE; i++) {
Note: See TracChangeset for help on using the changeset viewer.