fluffos/testsuite/include/socket_err.h
Yucong Sun ebc86aab02 Every efun has a test: ~130 new files close the whole spec inventory
Systematic review of all 326 spec-declared efuns against
testsuite/single/tests/efuns/; every efun now has a test file named
after it. Pure functions get exact behavioral pins (trig/log/vector
math with domain-error cases, trim family, pcre group semantics,
min/max index form, compress/encoding round trips, bit strings,
Levenshtein string_difference, class assembly/introspection, deep
copy() independence, dump_trace shape, save-string round trips);
environment-dependent efuns get honest contracts (sockets: real
create/bind/listen/connect lifecycle on ephemeral ports; interactive/
protocol/ed efuns: graceful no-interactive behavior; package-gated
efuns guarded by __PACKAGE_*__ / efun_defined()). testsuite/include
gains the driver-shipped socket.h/socket_err.h. Fixtures:
catch_tell_probe (catch_tell recorder + self-mover + make_living),
event_probe, shadow_probe, syntax_parent.

The new coverage flushed out SEVEN real driver bugs, all fixed:
- memory_summary: four division-by-zero sites in memory_share() when a
  value's refcount is 0 (UBSan)
- send_zmp/start_request_term_type: command_giver dereferenced before
  the null check -- crash with no interactive (UBSan)
- socket_create: LPC int loaded into enum socket_mode before
  validation -- UB for out-of-range modes; validated as int first
- async_db_exec: manual callback ref taken before handle validation --
  error() unwind leaked the function pointer (AGENTS.md section 4)
- link(): epilogue abandoned both string arguments -- two shared-string
  refs leaked per call
- assemble_class(): built through copy_array then retagged T_CLASS,
  skewing num_arrays/num_classes and the DEBUGMALLOC tag; now built
  with allocate_class_by_size
- parser_mark_verbs(): marked only the HEAD of each verb's rule list
  (later rules unaccounted), double-marked base verbs through synonym
  entries (verb_syn_t::real overlays the node slot), and computed
  header offsets off NULL for rule-less verbs (UBSan)
- pending resolve() queries had no DEBUGMALLOC accounting at all: new
  pending-query registry + mark_dns_requests(), mirroring
  mark_call_outs

Runner: uncaught errors are now PRINTED as well as recorded (a failing
file was otherwise silent about why).

Verified: testsuite x3 randomized (ASan Debug) + ctest 297, clang
RelWithDebInfo sanitizer full suite, RelWithDebInfo full ctest.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 20:48:48 -04:00

46 lines
2.1 KiB
C

/*
* socket_errors.h -- definitions for efun socket error return codes.
* 5-92 : Dwayne Fontenot (Jacques@TMI) : original coding.
* 10-92 : Dave Richards (Cynosure) : less original coding.
*/
#ifndef _SOCKET_ERRORS_H_
#define _SOCKET_ERRORS_H_
#define EESUCCESS 1 /* Call was successful */
#define EESOCKET -1 /* Problem creating socket */
#define EESETSOCKOPT -2 /* Problem with setsockopt */
#define EENONBLOCK -3 /* Problem setting non-blocking mode */
#define EENOSOCKS -4 /* UNUSED */
#define EEFDRANGE -5 /* Descriptor out of range */
#define EEBADF -6 /* Descriptor is invalid */
#define EESECURITY -7 /* Security violation attempted */
#define EEISBOUND -8 /* Socket is already bound */
#define EEADDRINUSE -9 /* Address already in use */
#define EEBIND -10 /* Problem with bind */
#define EEGETSOCKNAME -11 /* Problem with getsockname */
#define EEMODENOTSUPP -12 /* Socket mode not supported */
#define EENOADDR -13 /* Socket not bound to an address */
#define EEISCONN -14 /* Socket is already connected */
#define EELISTEN -15 /* Problem with listen */
#define EENOTLISTN -16 /* Socket not listening */
#define EEWOULDBLOCK -17 /* Operation would block */
#define EEINTR -18 /* Interrupted system call */
#define EEACCEPT -19 /* Problem with accept */
#define EEISLISTEN -20 /* Socket is listening */
#define EEBADADDR -21 /* Problem with address format */
#define EEALREADY -22 /* Operation already in progress */
#define EECONNREFUSED -23 /* Connection refused */
#define EECONNECT -24 /* Problem with connect */
#define EENOTCONN -25 /* Socket not connected */
#define EETYPENOTSUPP -26 /* Object type not supported */
#define EESENDTO -27 /* Problem with sendto */
#define EESEND -28 /* Problem with send */
#define EECALLBACK -29 /* Wait for callback */
#define EESOCKRLSD -30 /* Socket already released */
#define EESOCKNOTRLSD -31 /* Socket not released */
#define EEBADDATA -32 /* sending data with too many nested levels */
#define ERROR_STRINGS 33 /* sizeof (error_strings) */
#endif /* _SOCKET_ERRORS_H_ */