Commit Graph

46 Commits

Author SHA1 Message Date
Pete Delaney
7ddc46bf9f [MIPS] Allow errno safe logging
Change-Id: I35b4a9007572bec15ab7ba81aad3756fa96c5eb2
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
2013-02-25 22:52:02 -08:00
Pete Delaney
183963db80 [MIPS] Portable versions of setjmp, sigsetjmp, ...
The portable (ARM) jmp_buf and sigjmp_buf structures are smaller than the native
(MIPS) structures so it is not safe to simply call the standard bionic routines.

Luckily there is a lot of redundant space in the standard MIPS structures
and it is possible to save all of the needed registers in the area provided by the
ARM application.

Change-Id: I694a90516cdf96d581863e833776092830afe3cc
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Paul Lind <paul.lind@imgtec.com>
2013-02-20 20:07:33 -08:00
Pete Delaney
860342e989 [MIPS] Added support for STDIO sflags().
sflags() returns open() flags via a pointer passed to sflags().

Change-Id: I854dc4302bf09318e97eb3129a8debf98dbe8735
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Paul Lind <paul.lind@imgtec.com>
2013-02-20 20:06:46 -08:00
Pete Delaney
998548881e [MIPS] Fixed a bug and improved fcntl_portable.
Improved Logging, tweaked func names, fixed double mappings
of mips_command.

While debugging the LTP fcntl07* set of failures I modified
a few ALOGV() calls to make logging more helpful in
fcntl_cmd_pton().

Change-Id: Idc9a7c8dd27883dff1e555769d6a8e331f4fdeb9
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Paul Lind <paul.lind@imgtec.com>
2013-02-20 20:06:13 -08:00
Pete Delaney
b7b5e9d3fb [MIPS] Extend Signal Mapping to include RT Signals.
Both MIPS and ARM use signals 32 to 64 for real-time signals.
ARM signals 32 to 64 can't be masked due to the signal
mask being limited to 32 bits. MIPS signals 32 to 64 can be
masked, and Lib-Portable correctly supports this feature.

Fixes LTP tests rt_sigaction01 and ptrace05.

Fixed a few signal problems; Ex last Real Time Signal

1.  The signal handler for signal number 64, the last real
    time signal, wasn't being intercepted. Now catching
    signal number 64.

2.  sigaction() to only change *oldact when return
    value is zero.

3.  Fixed rt_sigqueue_portable() to set errno when
    returning a -1.

4.  Fixed a few cases where signal 0 was being added
    to the table of signal handlers for signal remapping.
    Harmless but a bit silly.

Change-Id: I1a71113d7ce4b60f3a587dae4e243dc88dd6d6bc
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Paul Lind <paul.lind@imgtec.com>
2013-02-20 20:05:46 -08:00
Pete Delaney
c684613e19 [MIPS] Added support for file descriptor related system calls.
Specifically these functions are now supported:
    signalfd4(), eventfd(), timerfd_create(),
    pipe(), and inotify_init1()

Modified syscall_portable() to call signalfd4_portable(),
eventfd_portable(), eventfd2_portable(), and timerfd_create().
These system calls enable the read system calls to access
kernel data structures.

The signalfd4() enables read to return a signalfd_siginfo structure
which have the signal number and errno mapped until an execve().
This is similar to the maintaining a table of signal handlers to
map the signal numbers done earlier. This mapping is extended to
the process after an execve() by passing the final set of mapped
file descriptors via a pair of environment variables.

Disabling signal and file descriptor read mapping in parent
if the child would break the mapping algorithms.

This code passes at least all of the non-POSIX LTP tests,
including an updated LTP signalfd4 test that posts SIGNALS
and uses this read() mechanism to get signal info.

inotify_init1 is similar to signalfd(), timerfd() and other
filefd functions which map read() calls. Unlike signalfd(), and
similar to timerfd(), the reads don't appear to need to be mapped.

The members of the inotify_event structure appear to be generic.
The mask bits like IN_MOVE_FROM and IN_MOVE_TO are defined in
generic files. The LTP test in testcases/kernel/syscalls/inotify
test for the inotify_event structure being inotify_event structure
being read and does seem to check it contents being correct.

Change-Id: I3f2dcd4e33437ac953cd9f67f56dccc6ec6e5e6f
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Paul Lind <paul.lind@imgtec.com>
2013-02-20 20:05:19 -08:00
Pete Delaney
dbbf0045b6 [MIPS] Fixed LTP Tests 9 and 20 of getaddrinfo_01.
Just mapping struct addrinfo socktype member; everything else is
identical in ARM vs MIPS cpp comparison.

Lots of tests in getaddrinfo_01 fail on Android, but test 9 and 20
were breaking with lib-portable only. This fix corrects that
difference in the test results.

Change-Id: I93c7948cc206ec60b867844857e3e19350c5f5e9
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Paul Lind <paul.lind@imgtec.com>
2013-02-20 20:04:01 -08:00
Pete Delaney
a89a549987 [MIPS] Added missing _NR_* system call support and cleaned up.
Change-Id: I18499a73ad3732a16edb941c4db9fc2811dfe5d5
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Paul Lind <paul.lind@imgtec.com>
2013-02-20 20:03:24 -08:00
Pete Delaney
6732a917fd [MIPS] Add Real Time Signal Functions and minor bug fixes.
1. Added:
        rt_sigaction(),
        rt_sigprocmask(), and
        rt_sigtimedwait portable syscalls.

    2. Fixed a bug in signal.c.

    3. Added a new pair of functions to map siginfo_t
       between portable and native formats.

    4. Fixed LTP rt_siqqueueinfo01 and siqqueue() test failures.

    5. Using these new siginfo_t mapping functions in functions
       that were previously doing this functionality internally:
          a. mips_sigaction_handler()
          b. __rt_sigtimedwait_portable()

    6. Modified rt_sigqueueinfo_portable():
      a. Added a call to this new siginfo_pton() function.
      b. Fixed native_sig calculation; it was converting
         with the wrong function (ntop instead of pton).

    7. Added the Thread Group Flavor of Real Time version of
       sigqueueinfo().

    8. Added and tested the sigqueue() implementation thought it's
       not supported by Android yet. Using a LTP library function
       to implement it via syscall for now.  Android has a
       sysconf() regression that will be addressed in a separate
       commit.

    9. Modified some of the variable names in:

          __rt_sigtimedwait_portable()

       to make it easier/faster to read.

    10. Fixed a SIGTERM --> SIGTERM_PORTABLE mapping bug.

Most LTP Posix sigqueue() tests and the rt_sigqueueinfo01() test
now pass with this commit.

Change-Id: I5a2c28c4f5863cc013fe0c7fce819fa5b7a6dcc7
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Douglas Leung <douglas.leung@imgtec.com>
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Paul Lind <paul.lind@imgtec.com>
2013-02-20 20:02:52 -08:00
Pete Delaney
4977f77e79 [MIPS] Unify around a consistent *_ntop/*_pton style.
Unifying around the <class>_ntop() style;
changing ntop_*() and pton_* to *_ntop() and *_pton().

Also added portable versions of strerror() and strerror_r()
while updating the errno.c file.

Change-Id: I2a0f40963f293ef9387b0dbcb3426276d301a17c
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Paul Lind <paul.lind@imgtec.com>
2013-02-20 20:02:09 -08:00
Pete Delaney
2928edfab9 [MIPS] Tighten up code to fit within 100 characters lines.
File poll.c had a wide line and the reason for the asymmetric
mapping of the event flags wasn't obvious on my reviewing
this code. Seemed to justify adding some clarification.

Both signal.c and socket.c were using lengthy function names
for Portable <--> Native mappings. Switch to the newer *_ntop()
style in wide files and made the ALOGV() messages more useful.

Also changed mapping of portable SIGSTKFLT to native SIGEMT
while editing a wide line in the signal.c file.  MIPS has no
SIGSTKFLT signal, nor ARM a signal SIGEMT. Using SIGEMT as a
proxy for SIGSTKFLT_PORTABLE for Lib-Portable applications.
This makes the signal mapping reversible during signal handling.

Fixed ALOGV() Entry/Exit brackets to match.

Change-Id: I9a91992e67ab24322db608424bf69c47fad8e18d
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Paul Lind <paul.lind@imgtec.com>
2013-02-20 20:01:15 -08:00
Pete Delaney
8930ac5534 [MIPS] Expand TABS and remove redundant return parenthesis.
Also fixed syscall.c to use curly brackets in case
statements to be more like bionic.

Change-Id: I20ffab9a474a2132b47fb4e765966c956aab2aff
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Paul Lind <paul.lind@imgtec.com>
2013-02-20 20:00:23 -08:00
Lai Wei-Chih
2c9e934fc5 Let users could query cpu features on device.
Change-Id: I9f5d7c66fb4248f5f8cbbf4c350b82a5b8c3aee9
2012-10-23 10:05:22 +08:00
Pete Delaney
bf03a1b304 [MIPS] Add support for waitpid.
Change-Id: I7b3b90f9a64d40c5aa72c74cac6881f1189c1462
Signed-off-by: Chris Dearman <chris@mips.com>
Signed-off-by: Pete Delaney  <piet@mips.com>
2012-10-05 02:18:27 -07:00
Pete Delaney
79d42207b8 [MIPS] Add Support pthread library functions.
Signals needed to be mapped.

Change-Id: I946308f17cf7bc945287f716d0da50f515ac8fc4
Signed-off-by: Pete Delaney  <piet@mips.com>\
Signed-off-by: Chris Dearman <chris@mips.com>
2012-10-05 02:18:04 -07:00
Pete Delaney
fbedea894c [MIPS] Add Support clone.
Change-Id: I3320c38e4228ba0aba37fe5af93e6f467c2e1b12
Signed-off-by: Chris Dearman <chris@mips.com>
Signed-off-by: Pete Delaney  <piet@mips.com>
2012-10-05 02:17:39 -07:00
Pete Delaney
9ea8cc7e99 [MIPS] Updated support for statfs and fstatfs.
Change-Id: I0d8385cdb6599c572b25abae28498166582b33ca
Signed-off-by: Chris Dearman <chris@mips.com>
Signed-off-by: Pete Delaney  <piet@mips.com>
2012-10-05 02:17:22 -07:00
Pete Delaney
2c4605a5a4 [MIPS] Updated support for stat.
Change-Id: Ica3b92edb6718c19308da7370ced145ccaeb8d6d
Signed-off-by: Chris Dearman <chris@mips.com>
Signed-off-by: Pete Delaney  <piet@mips.com>
2012-10-05 02:16:59 -07:00
Pete Delaney
e3e0db1051 [MIPS] Updated support for socket and added support for socket_pair.
Socket type can also contain SOCK_NONBLOCK and SOCK_CLOEXEC flags.
NDK headers do not export these values but they seem to be aliases
of O_NONBLOCK and O_CLOEXEC. NDK headers do not define O_CLOEXEC.

Change-Id: If97fcb9f1ff130ea11a0da6452454a256f769809
Signed-off-by: Chris Dearman <chris@mips.com>
Signed-off-by: Pete Delaney  <piet@mips.com>
2012-10-05 02:16:25 -07:00
Pete Delaney
b10b6f2baf [MIPS] Update Support for fcntl.
Change-Id: I743837793a84e6f4dbbc192b29b19a6eae78a5da
Signed-off-by: Pete Delaney  <piet@mips.com>
Signed-off-by: Chris Dearman <chris@mips.com>
2012-10-05 00:23:49 -07:00
Pete Delaney
9b350a5d22 [MIPS] Add Support for syscall.
Change-Id: Ib9c13ea152fdfe58b36362442eeef88e4a463c31
Signed-off-by: Chris Dearman <chris@mips.com>
Signed-off-by: Pete Delaney  <piet@mips.com>
2012-10-05 00:23:49 -07:00
Pete Delaney
0d05107265 [MIPS] Add Support timer_create.
Signals needed to be mapped.

Change-Id: Id0748924f16ac6787b87062d774e837a14d1233c
Signed-off-by: Chris Dearman <chris@mips.com>
Signed-off-by: Pete Delaney  <piet@mips.com>
2012-10-05 00:23:49 -07:00
Pete Delaney
79b607b432 [MIPS] Add Support signal.
Change-Id: Ie2aa6cd24a119f96cd01c6b3d6352f011a0825b5
Signed-off-by: Pete Delaney  <piet@mips.com>
Signed-off-by: Chris Dearman <chris@mips.com>
2012-10-05 00:23:49 -07:00
Pete Delaney
25cabbf92e [MIPS] Add Support errno, Added Logging, sorted Android.mk files.
Change-Id: Ibeeab51feb77be07ea8ccacf2f448bb5135d7373
Signed-off-by: Chris Dearman <chris@mips.com>
Signed-off-by: Pete Delaney   <piet@mips.com>
2012-10-05 00:23:49 -07:00
Chao-Ying Fu
4cad8d6fdf Support asm/sockios.h for MIPS.
Change-Id: I5ae75b0a8c2ff5698ca46f02bb371e710fb1fee0
2012-08-22 13:37:26 -07:00
Chao-Ying Fu
9f49f16bdf Support getrlimit and setrlimit for MIPS.
Change-Id: Iff030a0eb2444bd1ba75dff9ba6b76c7cf9e0e7d
2012-08-21 17:24:01 -07:00
Chao-Ying Fu
4cd3283046 Support poll for MIPS.
Change-Id: I1299817ea06c9f9ff5701dce0c6166370ef9e87d
2012-08-21 15:27:38 -07:00
Chao-Ying Fu
5f79ffb271 Support fcntl for MIPS with different cmd.
Change-Id: I8d180ab9e18d69f0fd2748ad317319b691a86f35
2012-08-20 18:08:30 -07:00
Chao-Ying Fu
1d34dd0c27 Fix flags to *_PORTABLE in open_portable(), and support openat_portable().
Change-Id: Ib889899250fdfc6e7caded2506228f640fcdff3a
2012-08-20 17:07:27 -07:00
Chao-Ying Fu
f43f982232 Support mprotect.
Change-Id: Ic786eb35f69d44379129faec02b1023ab2c3282a
2012-08-20 16:02:41 -07:00
Andrew Hsieh
bd37ac2e42 Merge "Make sys/ioctl_compat.h portable." 2012-08-17 17:38:04 -07:00
Chao-Ying Fu
584ef7f14c Make sys/ioctl_compat.h portable.
Change-Id: Id9c4c68c8422d46d463b9c987be180ea50c05099
2012-08-17 17:11:23 -07:00
Chao-Ying Fu
64c217eb07 Add portable support for stuct statfs and two functions.
Change-Id: I1e34428574a11bedb3a5a35a45dc519fcae3cd03
2012-08-17 12:22:39 -07:00
Andrew Hsieh
84061fa198 Merge "Support all portable requests." 2012-08-16 19:50:56 -07:00
Chao-Ying Fu
25899fcec1 Support all MAP flags and update mmap_portable.
Change-Id: I17600e70028d35dc2f2da05ed4a1b3d7ad051a63
2012-08-16 18:46:17 -07:00
Chao-Ying Fu
0bcbd32a9a Support all portable requests.
Change-Id: I1032362a48456a961f258e624df313e7841b3d81
2012-08-16 17:52:19 -07:00
Chao-Ying Fu
3e1d447f43 Add portable support for errno.h.
Change-Id: Ia232caff586a1296b4330f450e4cfe4fec51198b
2012-08-15 11:58:43 -07:00
Chao-ying Fu
639c9f49ce MIPS doesn't have __st_ino, so store 0 for this field in p_stat structure
Change-Id: Ia9ed9e5b90291e199b0b351eba65d22a6966a1c9
2012-08-14 11:14:08 -07:00
Shih-wei Liao
bf1b1e6c7f Move libportable from ndk.git to development.git.
libportable should be in development.git instead of ndk.git.

Change-Id: Ic369ca6a0e4ffbd2741777c8d9ec578e8ce5abbd
2012-08-14 01:43:15 -07:00
David 'Digit' Turner
98f56b100c ndk: disable logs in release builds of native_app_glue library.
This patch disables all the logs from the 'native_app_glue' helper
library (used to implement native activities with the NDK), unless
you're building a debug build.

Change-Id: Iaad9d7c48a392ec119704074ab76e131d7806adb
2012-01-05 16:41:09 +01:00
David 'Digit' Turner
95ae335fd5 native_app_glue: fix APP_CMD_TERM_WINDOW pre-hook
The window field must not be set to NULL in the pre-hook, only the
post-one. See http://code.google.com/p/android/issues/detail?id=14352

Change-Id: Ib6214d47c97766bf4a5e148b6b6707e08366fe36
2011-02-02 00:54:02 +01:00
David 'Digit' Turner
3c7c38b2bb NDK: Last cleanup of the platform headers
- fix a declaration omission in 3/<grp.h>
- add missing 8/<err.h>
- simplify 8/<stdio.h>
- update 9/ headers to the latest Bionic versions
- fix a typo in android_native_app_glue.h
- use __BEGIN_DECLS .. __END_DECLS whenever possible.
- remove C++-style comments from headers

Change-Id: I58b98b3973cde494436206194ba33416a11ca8ee
2010-11-04 04:07:16 -07:00
Jeff Brown
9f44e97108 Update NDK headers and samples to sync up with looper API changes.
Change-Id: I7082603bf280888be90dc4df687521aaae9b1d02
2010-09-14 02:02:15 -07:00
Dianne Hackborn
d3d58cf7d3 Update to follow ALooper ident change.
Also the native-activity sample also has some very simple code showing
how to listen to the accelerometer.

Change-Id: I0629b8bc40cddd66233c1675cd5e8b42a9b722d8
2010-09-07 15:47:35 -07:00
Dianne Hackborn
79b946e8f2 Some native activity sample code cleanup.
Update to include newest headers and library, tweak glue code to
work better with state saving and add support for config changes.

Change-Id: I4d27bd4a0f542f217efaec86cf4f219aca020426
2010-08-11 00:31:37 -07:00
David 'Digit' Turner
4948c16366 Remove prebuilt static library "libthreaded_app.a".
Make the "glue library" part of the NDK as an importable module,
this has several benefits:

- no need to distribute a binary here with no easy way to regenerate it

- no need to explicitely list -lthreaded_app in your LOCAL_LDLIBS
  (this is handled automatically by the module import capability)

- allows easier native debugging of what's really happening.

Note that the header is renamed <threaded_native_app.h>

+ Modify the native-activity sample to use and import the new module
+ Start documenting usage in the header file. We probably need something
  better, and will probably put it under development/ndk/docs/ at some
  point.

After this patch, we should be able to get rid of the code under
framework/base/native/{include.glue}

Change-Id: I6e81d70a225a6ca006beabf6e8b42529e8f371b9
2010-07-13 23:50:02 -07:00