Ticket #1050 (new bug)

Opened 5 years ago

Last modified 3 years ago

[TODO] [C] Use strerror_r instead of strerror

Reported by: doughera Owned by:
Priority: normal Milestone:
Component: core Version: 1.6.0
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:

Description

This is still probably a good idea. There are several generations of patches in RT, but the interface to strerror_r varies enough among platforms that it will take a bit of Configure.pl magic to get everything working smoothly.

See  Original RT for more details

Change History

Changed 3 years ago by jkeenan

Here are our current uses of strerror:

$ ack strerror *      
docs/pdds/pdd23_exceptions.pod
263:Message is the return value of the standard C function C<strerror()>.

include/parrot/platform_interface.h
60:STRING *Parrot_platform_strerror(PARROT_INTERP, INTVAL error);

src/dynpmc/file.pmc
175:                const char * const errmsg = strerror(errno);
182:            const char * const errmsg = strerror(errno);

src/dynpmc/file.c
311:            const char * const errmsg = strerror(errno);
318:        const char * const errmsg = strerror(errno);

src/ops/core_ops.c
21487:    const char  * const  tmp = strerror(errno);
21496:    const char  * const  tmp = strerror(IREG(2));
21505:    const char  * const  tmp = strerror(ICONST(2));

src/ops/sys.ops
73:    const char * const tmp = strerror(errno);
79:    const char * const tmp = strerror($2);

src/pmc/mappedbytearray.pmc
144:                        "mmap failed: %s", strerror(errno));
329:                    "mmap failed: %s", strerror(errno));

src/pmc/mappedbytearray.c
332:                "mmap failed: %s", strerror(errno));
595:                    "mmap failed: %s", strerror(errno));

src/platform/darwin/sysmem.c
53:        err_msg = strerror(err);

src/platform/generic/exec.c
289:        "Error executing process: %s", strerror(errno));

src/platform/generic/io.c
362:                    "Read error: %s", strerror(errno));
404:                        "Write error: %s", strerror(errno));

src/platform/generic/socket.c
267:                Parrot_platform_strerror(interp, PIO_SOCK_ERRNO));
477:                Parrot_platform_strerror(interp, PIO_SOCK_ERRNO));
516:                    Parrot_platform_strerror(interp, PIO_SOCK_ERRNO));
539:                Parrot_platform_strerror(interp, PIO_SOCK_ERRNO));
559:                Parrot_platform_strerror(interp, PIO_SOCK_ERRNO));
590:                Parrot_platform_strerror(interp, PIO_SOCK_ERRNO));
639:                    Parrot_platform_strerror(interp, PIO_SOCK_ERRNO));
674:                    Parrot_platform_strerror(interp, PIO_SOCK_ERRNO));
724:                        Parrot_platform_strerror(interp, PIO_SOCK_ERRNO));

src/platform/generic/file.c
27:/* TT #1050 apparently, strerror_r is thread-safe and should be used instead.*/
29:    EXCEPTION_EXTERNAL_ERROR, "%s failed: %s", (msg), strerror(errno))

src/platform/generic/sysmem.c
85:        const char * const err_msg = strerror(err);

src/platform/generic/error.c
29:=item C<STRING * Parrot_platform_strerror(PARROT_INTERP, INTVAL error)>
39:Parrot_platform_strerror(PARROT_INTERP, INTVAL error)
41:    const char *msg = strerror(error);

src/platform/win32/io.c
325:                    Parrot_platform_strerror(interp, err));
385:            "Write error: %Ss", Parrot_platform_strerror(interp, err));
420:                    Parrot_platform_strerror(interp, err));
450:                    Parrot_platform_strerror(interp, err));

src/platform/win32/error.c
31:=item C<STRING * Parrot_platform_strerror(PARROT_INTERP, INTVAL error)>
40:Parrot_platform_strerror(PARROT_INTERP, INTVAL error)

src/platform/win32/file.c
33:    Parrot_platform_strerror(interp, GetLastError()))

tools/dev/lib_deps.pl
596:strerror    string.h

Changed 3 years ago by jkeenan

  • component changed from none to core
Note: See TracTickets for help on using tickets.