11dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/*
21dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Copyright (C) 2008 The Android Open Source Project
31dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * All rights reserved.
41dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *
51dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Redistribution and use in source and binary forms, with or without
61dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * modification, are permitted provided that the following conditions
71dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * are met:
81dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *  * Redistributions of source code must retain the above copyright
91dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *    notice, this list of conditions and the following disclaimer.
101dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *  * Redistributions in binary form must reproduce the above copyright
111dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *    notice, this list of conditions and the following disclaimer in
121dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *    the documentation and/or other materials provided with the
131dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *    distribution.
141dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *
151dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
161dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
171dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
181dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
191dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
201dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
211dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
221dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
231dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
241dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
251dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
261dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * SUCH DAMAGE.
271dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */
2817a8b0db63d54e9d79bf11112ace0c4fe9606289Elliott Hughes
291dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#include <sys/wait.h>
301dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#include <stddef.h>
311dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
3217a8b0db63d54e9d79bf11112ace0c4fe9606289Elliott Hughesextern "C" int __waitid(idtype_t which, id_t id, siginfo_t* info, int options, struct rusage* ru);
3317a8b0db63d54e9d79bf11112ace0c4fe9606289Elliott Hughes
3417a8b0db63d54e9d79bf11112ace0c4fe9606289Elliott Hughespid_t wait(int* status) {
3517a8b0db63d54e9d79bf11112ace0c4fe9606289Elliott Hughes  return wait4(-1, status, 0, NULL);
3617a8b0db63d54e9d79bf11112ace0c4fe9606289Elliott Hughes}
371dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
3817a8b0db63d54e9d79bf11112ace0c4fe9606289Elliott Hughespid_t waitpid(pid_t pid, int* status, int options) {
3917a8b0db63d54e9d79bf11112ace0c4fe9606289Elliott Hughes  return wait4(pid, status, options, NULL);
401dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project}
411dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
4217a8b0db63d54e9d79bf11112ace0c4fe9606289Elliott Hughesint waitid(idtype_t which, id_t id, siginfo_t* info, int options) {
4311952073af22568bba0b661f7a9d4402c443a888Elliott Hughes  // The system call takes an optional struct rusage that we don't need.
4417a8b0db63d54e9d79bf11112ace0c4fe9606289Elliott Hughes  return __waitid(which, id, info, options, NULL);
451dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project}
46