Commit graph

11 commits

Author SHA1 Message Date
Mark Salyzyn
23ed4c242a libcutils: Replace cutils/log.h with android/log.h
Replace references to cutils/log.h and log/log.h with android/log.h.
Point cutils/log.h to android/log.h. Adjust header order to comply
with Android Coding standards.

Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I4b00c0dff3a0a50cbb54301fdc5a6c29c21dab65
2016-09-30 12:47:05 -07:00
Mark Salyzyn
ee431112ff libcutils: Add ashmem_valid() function
Bug: 30310689
Change-Id: I14c52c5d52745a725799652b87c86281ac214899
2016-08-23 15:29:28 -07:00
Mark Salyzyn
53c0ca6520 libcutils: abort for invalid fd
If ashmem accessors are being called with a file descriptor that
belongs to anything other than ashmem, we need to stop it right
now so that they can fix the caller.

Bug: 26871259
Change-Id: Icf9aafc3631a80b9af6fe0fea03599d61e285d21
2016-02-03 15:09:20 -08:00
Mark Salyzyn
e37111d751 libcutils: ashmem print error message for invalid fd
NB: We decided to not sniff for the constant saved __ashmem_rdev in
the early error path; requiring either the use of atomic operations,
or acquiring a lock to do it correctly. The heroics are not worth it.

Bug: 26871259
Change-Id: I46249838850ae32063eb5b7d08c731c5bb0fbf6b
2016-02-03 15:06:45 -08:00
Mark Salyzyn
1186f3a5ad libcutils: ashmem check fd validity
- collect st_rdev on open, or when required, for /dev/ashmem.
- check in all cases if fd is a character device and matches rdev.
- requires that we have open, read and write access to /dev/ashmem
  to check, assumption being that if we can not, then we have no
  right playing with the associated misdirected file descriptor.

NB: ashmem libcutil library entry points can no longer be called in
    signal context.

Bug: 26871259
Change-Id: I9a17e33317a9be795131473a51c16f761b5f7407
2016-02-03 13:05:22 -08:00
Mark Salyzyn
c2d8aad8d7 libcutils: ashmem fortify and comply with Android coding standard
- sort header order and in groups
- remove all tabs, use only spaces
- use TEMP_FAILURE_RETRY in system calls
- preserve errno for -1 return

Bug: 26871259
Change-Id: I94fffbcaeba01fcc18a3ed07c02389c06c54d3b7
2016-02-02 12:38:06 -08:00
Jin Wei
b815701247 fix valgrind ioctl warning.
Initialize local variable to avoid syscall ioctl warning.

Change-Id: Ibad5b86cd799f147c71f182d654e61318e2ac15e
Origin-Change-Id: Iedf5b128ae1743f633d2821ac3e402942ad6642b
Signed-off-by: Jin Wei <wei.a.jin@intel.com>
Signed-off-by: Jian Luo <jian.luo@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 62797
2013-08-31 18:57:46 -04:00
Bjorn Bringert
7be52b1a0e Added ashmem_get_size_region() function.
This is needed by the MemoryFile changes in
https://android-git.corp.google.com/g/2714
where it is used to find out whether a file descriptor
refers to an ashmem region.
2009-06-02 00:55:30 +01:00
The Android Open Source Project
dd7bc3319d auto import from //depot/cupcake/@135843 2009-03-03 19:32:55 -08:00
The Android Open Source Project
e54eebbf1a auto import from //depot/cupcake/@135843 2009-03-03 18:29:04 -08:00
The Android Open Source Project
4f6e8d7a00 Initial Contribution 2008-10-21 07:00:00 -07:00