Opened 14 years ago

Closed 10 years ago

#7008 closed bug (fixed)

Implement missing <search.h>, <stdio.h>, <stdlib.h>, <wchar.h> functions and definitions

Reported by: scottmc Owned by: bonefish
Priority: normal Milestone: Unscheduled
Component: System/POSIX Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

These are present in the search.h header, but not yet implemented, so you'll need to implement these:

search.h:

hcreate hdestroy hsearch

The following issues also need to be adressed in <search.h>, <stdio.h>, <stdlib.h> and <wchar.h> This list may or may not be complete and correct, so further research may be required, when in doubt, consult the opengroup spec. http://www.opengroup.org/onlinepubs/9699919799/basedefs/stdio.h.html http://www.opengroup.org/onlinepubs/9699919799/basedefs/stdlib.h.html http://www.opengroup.org/onlinepubs/9699919799/basedefs/search.h.html http://www.opengroup.org/onlinepubs/9699919799/basedefs/wchar.h.html

stdio.h

  1. Cannot find the definition of FILE data type as explained at opengroup.org:

"A structure containing information about a file, defined through typedef."

There's also a few more that are POSIX required but missing in the headers and need to be implemented:

wchar.h

  1. The tag "tm" is not declared as described at opengroup.org.

stdlib.h

  1. "<sys/wait.h>" seems not to be included, so

"WNOHANG WUNTRACED WEXITSTATUS WIFEXITED WIFSIGNALED WIFSTOPPED WSTOPSIG WTERMSIG" definition is missing, (probably just need to #include <sys/wait.h>)

  1. Definition/Declaration of "long a64l(const char *);" is missing.
  2. Definition/Declaration of "int atexit(void (*)(void));" is missing.
  3. Definition/Declaration of "div_t div(int, int);" is missing.
  4. Definition/Declaration of "char* l64a(long);" is missing.

This has been posted as a GCI task: http://www.google-melange.com/gci/task/show/google/gci2010/haiku/t129139814475

Attachments (6)

a64l.c (1.4 KB ) - added by TriEdgeAI 12 years ago.
Implements a64l()
l64a.c (1.5 KB ) - added by TriEdgeAI 12 years ago.
Implements l64a()
div.c.patch (1.2 KB ) - added by TriEdgeAI 12 years ago.
Suggests fixes on implementation of div(), ldiv(), lldiv()
stdlib.h.patch (726 bytes ) - added by TriEdgeAI 12 years ago.
Adds a few missing lines to stdlib.h
wchar.h.patch (314 bytes ) - added by TriEdgeAI 12 years ago.
Adds a missing line in wchar.h
tests.h (930 bytes ) - added by TriEdgeAI 12 years ago.
The file I used to test the correctness of the implemented and the fixed functions.

Download all attachments as: .zip

Change History (19)

comment:1 by korli, 14 years ago

The part on FILE is wrong. It's defined in stdio_pre.h which is included in stdio.h.

Adding a "struct tm;" covers the wchar.h part indeed.

comment:2 by kaliber, 13 years ago

Implemented in hrev43470

comment:3 by scottmc, 13 years ago

Milestone: R1R1/beta1

by TriEdgeAI, 12 years ago

Attachment: a64l.c added

Implements a64l()

by TriEdgeAI, 12 years ago

Attachment: l64a.c added

Implements l64a()

by TriEdgeAI, 12 years ago

Attachment: div.c.patch added

Suggests fixes on implementation of div(), ldiv(), lldiv()

by TriEdgeAI, 12 years ago

Attachment: stdlib.h.patch added

Adds a few missing lines to stdlib.h

by TriEdgeAI, 12 years ago

Attachment: wchar.h.patch added

Adds a missing line in wchar.h

by TriEdgeAI, 12 years ago

Attachment: tests.h added

The file I used to test the correctness of the implemented and the fixed functions.

comment:4 by TriEdgeAI, 12 years ago

Summary of work for Google Code-In task:


The hashtable functions were already implemented. Same goes for atexit(). div() was implemented, but was giving incorrect results, so I made a patch for it. a64l() and l64a() were not implemented, so I am providing both as standalone files. There are also patches for stdlib.h and wchar.h.

comment:5 by mmadia, 12 years ago

patch: 01

comment:6 by mmadia, 12 years ago

Owner: changed from nobody to bonefish
Status: newassigned

comment:7 by scottmc, 11 years ago

Can someone check and apply these and then close this one out?

comment:8 by korli, 11 years ago

Owner: changed from bonefish to korli

comment:9 by korli, 11 years ago

Resolution: fixed
Status: assignedclosed

Applied in hrev46161.

comment:10 by korli, 11 years ago

Resolution: fixed
Status: closedreopened

Wrong bug....

comment:11 by korli, 11 years ago

Owner: changed from korli to bonefish
Status: reopenedassigned

and assigning back :)

comment:12 by luroh, 10 years ago

Milestone: R1/beta1Unscheduled

Move POSIX compatibility related tickets out of R1 milestone (FutureHaiku/Features).

comment:13 by korli, 10 years ago

Resolution: fixed
Status: assignedclosed

Applied patches with the help of Puck Meerburg in hrev48500.

Note: See TracTickets for help on using tickets.