From owner-freebsd-hackers Mon Sep 16 16: 9:13 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9DC8837B401 for ; Mon, 16 Sep 2002 16:08:55 -0700 (PDT) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id 15E4343E6E for ; Mon, 16 Sep 2002 16:08:55 -0700 (PDT) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id E319DAE22C; Mon, 16 Sep 2002 16:08:54 -0700 (PDT) Date: Mon, 16 Sep 2002 16:08:54 -0700 From: Alfred Perlstein To: hackers@freebsd.org Subject: sem_* API Message-ID: <20020916230854.GA86737@elvis.mu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I got sort of bored so I wrote a kernel version of the POSIX sem_* functions so that we can support sem_open() and sem_init() when 'pshared' is set to true. Basically this is posix semaphores that can be used between processes. I haven't tested it as of yet (but I will be soon), here's the delta for it. Does anyone know a test suite for this API? Index: include/Makefile =================================================================== RCS file: /home/ncvs/src/include/Makefile,v retrieving revision 1.175 diff -u -r1.175 Makefile --- include/Makefile 8 Aug 2002 04:50:36 -0000 1.175 +++ include/Makefile 16 Sep 2002 19:07:38 -0000 @@ -27,7 +27,7 @@ MHDRS= float.h floatingpoint.h stdarg.h varargs.h # posix4/aio.h conflicts with dysons and isn't installed: -PHDRS= mqueue.h sched.h semaphore.h # aio.h +PHDRS= mqueue.h sched.h semaphore.h _semaphore.h # aio.h LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \ termios.h ucontext.h Index: lib/libpthread/thread/thr_private.h =================================================================== RCS file: /home/ncvs/src/lib/libpthread/thread/thr_private.h,v retrieving revision 1.74 diff -u -r1.74 thr_private.h --- lib/libpthread/thread/thr_private.h 16 Sep 2002 08:45:35 -0000 1.74 +++ lib/libpthread/thread/thr_private.h 16 Sep 2002 22:41:20 -0000 @@ -60,6 +60,7 @@ #include #include #include +#include /* * Define machine dependent macros to get and set the stack pointer @@ -369,6 +370,11 @@ pthread_cond_t gtzero; u_int32_t count; u_int32_t nwaiters; +#define SEM_USER (NULL) + semid_t semid; /* semaphore id if kernel (shared) semaphore */ + int syssem; /* 1 if kernel (shared) semaphore */ + LIST_ENTRY(sem) entry; + sem_t *backpointer; }; /* Index: lib/libpthread/thread/thr_sem.c =================================================================== RCS file: /home/ncvs/src/lib/libpthread/thread/thr_sem.c,v retrieving revision 1.11 diff -u -r1.11 thr_sem.c --- lib/libpthread/thread/thr_sem.c 16 Sep 2002 08:45:36 -0000 1.11 +++ lib/libpthread/thread/thr_sem.c 16 Sep 2002 22:48:36 -0000 @@ -31,7 +31,9 @@ #include #include +#include #include +#include #include #include "thr_private.h" @@ -52,63 +54,86 @@ __weak_reference(_sem_post, sem_post); __weak_reference(_sem_getvalue, sem_getvalue); +static sem_t sem_alloc(unsigned int value, semid_t semid, int system_sem); +static void sem_free(sem_t sem); -int -_sem_init(sem_t *sem, int pshared, unsigned int value) +static void +sem_free(sem_t sem) { - int retval; - /* - * Range check the arguments. - */ - if (pshared != 0) { - /* - * The user wants a semaphore that can be shared among - * processes, which this implementation can't do. Sounds like a - * permissions problem to me (yeah right). - */ - errno = EPERM; - retval = -1; - goto RETURN; - } + pthread_mutex_destroy(&sem->lock); + pthread_cond_destroy(&sem->gtzero); + sem->magic = 0; + + free(sem); +} + +static sem_t +sem_alloc(unsigned int value, semid_t semid, int system_sem) +{ + sem_t sem; if (value > SEM_VALUE_MAX) { errno = EINVAL; - retval = -1; - goto RETURN; + return (NULL); } - *sem = (sem_t)malloc(sizeof(struct sem)); - if (*sem == NULL) { + sem = (sem_t)malloc(sizeof(struct sem)); + if (sem == NULL) { errno = ENOSPC; - retval = -1; - goto RETURN; + return (NULL); } /* * Initialize the semaphore. */ - if (pthread_mutex_init(&(*sem)->lock, NULL) != 0) { - free(*sem); + if (pthread_mutex_init(&sem->lock, NULL) != 0) { + free(sem); errno = ENOSPC; - retval = -1; - goto RETURN; + return (NULL); } - if (pthread_cond_init(&(*sem)->gtzero, NULL) != 0) { - pthread_mutex_destroy(&(*sem)->lock); - free(*sem); + if (pthread_cond_init(&sem->gtzero, NULL) != 0) { + pthread_mutex_destroy(&sem->lock); + free(sem); errno = ENOSPC; - retval = -1; - goto RETURN; + return (NULL); } - (*sem)->count = (u_int32_t)value; - (*sem)->nwaiters = 0; - (*sem)->magic = SEM_MAGIC; + sem->count = (u_int32_t)value; + sem->nwaiters = 0; + sem->magic = SEM_MAGIC; + sem->semid = semid; + sem->syssem = system_sem; + return (sem); +} - retval = 0; +int +_sem_init(sem_t *sem, int pshared, unsigned int value) +{ + int retval, got_system_sem; + semid_t semid; + + got_system_sem = 0; + semid = SEM_USER; + /* + * Range check the arguments. + */ + if (pshared != 0) { + retval = ksem_init(&semid, value); + if (retval == -1) + goto RETURN; + got_system_sem = 1; + } + + (*sem) = sem_alloc(value, semid, got_system_sem); + if ((*sem) == NULL) + retval = -1; + else + retval = 0; RETURN: + if (retval != 0 && got_system_sem) + ksem_destroy(semid); return retval; } @@ -119,46 +144,121 @@ _SEM_CHECK_VALIDITY(sem); - /* Make sure there are no waiters. */ pthread_mutex_lock(&(*sem)->lock); - if ((*sem)->nwaiters > 0) { + /* + * If this is a system semaphore let the kernel track it otherwise + * make sure there are no waiters. + */ + if ((*sem)->syssem != 0) { + retval = ksem_destroy((*sem)->semid); + if (retval == -1) { + pthread_mutex_unlock(&(*sem)->lock); + goto RETURN; + } + } else if ((*sem)->nwaiters > 0) { pthread_mutex_unlock(&(*sem)->lock); errno = EBUSY; retval = -1; goto RETURN; } pthread_mutex_unlock(&(*sem)->lock); - - pthread_mutex_destroy(&(*sem)->lock); - pthread_cond_destroy(&(*sem)->gtzero); - (*sem)->magic = 0; - free(*sem); + sem_free(*sem); retval = 0; RETURN: return retval; } +LIST_HEAD(, sem) named_sems = LIST_HEAD_INITIALIZER(&named_sems); +pthread_mutex_t named_sems_mtx = PTHREAD_MUTEX_INITIALIZER; + sem_t * _sem_open(const char *name, int oflag, ...) { - errno = ENOSYS; - return SEM_FAILED; + sem_t *sem; + sem_t s; + semid_t semid; + mode_t mode; + unsigned int value; + + mode = 0; + value = 0; + + if ((oflag & O_CREAT) != 0) { + va_list ap; + + va_start(ap, oflag); + mode = va_arg(ap, unsigned long); + value = va_arg(ap, unsigned int); + va_end(ap); + } + /* + * we can be lazy and let the kernel handle the "oflag", + * we'll just merge duplicate IDs into our list. + */ + if (ksem_open(&semid, name, oflag, mode, value) == -1) + return (SEM_FAILED); + /* + * search for a duplicate ID, we must return the same sem_t * + * if we locate one. + */ + pthread_mutex_lock(&named_sems_mtx); + LIST_FOREACH(s, &named_sems, entry) { + if (s->semid == semid) { + pthread_mutex_unlock(&named_sems_mtx); + return (s->backpointer); + } + } + sem = (sem_t *)malloc(sizeof(*sem)); + if (sem == NULL) + goto err; + *sem = sem_alloc(value, semid, 1); + if ((*sem) == NULL) + goto err; + pthread_mutex_unlock(&named_sems_mtx); + (*sem)->backpointer = sem; + return (sem); +err: + pthread_mutex_unlock(&named_sems_mtx); + ksem_close(semid); + if (sem != NULL) { + if (*sem != NULL) + sem_free(*sem); + else + errno = ENOSPC; + free(sem); + } else { + errno = ENOSPC; + } + return (SEM_FAILED); } int _sem_close(sem_t *sem) { - errno = ENOSYS; - return -1; + + if ((*sem)->syssem == 0) { + errno = EINVAL; + return (-1); + } + pthread_mutex_lock(&named_sems_mtx); + if (ksem_close((*sem)->semid) == -1) { + pthread_mutex_unlock(&named_sems_mtx); + return (-1); + } + LIST_REMOVE((*sem), entry); + pthread_mutex_unlock(&named_sems_mtx); + sem_free(*sem); + free(sem); + return (0); } int _sem_unlink(const char *name) { - errno = ENOSYS; - return -1; + + return (ksem_unlink(name)); } int @@ -170,6 +270,11 @@ _SEM_CHECK_VALIDITY(sem); + if ((*sem)->syssem != 0) { + retval = ksem_wait((*sem)->semid); + goto RETURN; + } + pthread_mutex_lock(&(*sem)->lock); while ((*sem)->count == 0) { @@ -194,6 +299,11 @@ _SEM_CHECK_VALIDITY(sem); + if ((*sem)->syssem != 0) { + retval = ksem_trywait((*sem)->semid); + goto RETURN; + } + pthread_mutex_lock(&(*sem)->lock); if ((*sem)->count > 0) { @@ -217,6 +327,11 @@ _SEM_CHECK_VALIDITY(sem); + if ((*sem)->syssem != 0) { + retval = ksem_post((*sem)->semid); + goto RETURN; + } + /* * sem_post() is required to be safe to call from within signal * handlers. Thus, we must defer signals. @@ -243,6 +358,11 @@ int retval; _SEM_CHECK_VALIDITY(sem); + + if ((*sem)->syssem != 0) { + retval = ksem_getvalue((*sem)->semid, sval); + goto RETURN; + } pthread_mutex_lock(&(*sem)->lock); *sval = (int)(*sem)->count; Index: sys/conf/NOTES =================================================================== RCS file: /home/ncvs/src/sys/conf/NOTES,v retrieving revision 1.1075 diff -u -r1.1075 NOTES --- sys/conf/NOTES 11 Sep 2002 05:33:09 -0000 1.1075 +++ sys/conf/NOTES 16 Sep 2002 23:00:26 -0000 @@ -746,6 +746,7 @@ options P1003_1B options _KPOSIX_PRIORITY_SCHEDULING options _KPOSIX_VERSION=199309L +options P1003_1B_SEMAPHORES ##################################################################### Index: sys/conf/files =================================================================== RCS file: /home/ncvs/src/sys/conf/files,v retrieving revision 1.698 diff -u -r1.698 files --- sys/conf/files 16 Sep 2002 04:13:48 -0000 1.698 +++ sys/conf/files 16 Sep 2002 16:37:48 -0000 @@ -1423,3 +1423,4 @@ vm/uma_core.c standard vm/uma_dbg.c standard vm/vnode_pager.c standard +kern/uipc_sem.c standard Index: sys/conf/options =================================================================== RCS file: /home/ncvs/src/sys/conf/options,v retrieving revision 1.348 diff -u -r1.348 options --- sys/conf/options 7 Sep 2002 22:07:10 -0000 1.348 +++ sys/conf/options 16 Sep 2002 18:37:11 -0000 @@ -132,6 +132,7 @@ P1003_1B opt_posix.h _KPOSIX_PRIORITY_SCHEDULING opt_posix.h _KPOSIX_VERSION opt_posix.h +P1003_1B_SEMAPHORES opt_posix.h ##################################################################### # SECURITY POLICY PARAMETERS Index: sys/kern/init_sysent.c =================================================================== RCS file: /home/ncvs/src/sys/kern/init_sysent.c,v retrieving revision 1.131 diff -u -r1.131 init_sysent.c --- sys/kern/init_sysent.c 19 Aug 2002 20:02:29 -0000 1.131 +++ sys/kern/init_sysent.c 16 Sep 2002 17:25:15 -0000 @@ -2,7 +2,7 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/kern/init_sysent.c,v 1.131 2002/08/19 20:02:29 rwatson Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.121 2002/08/19 20:01:31 rwatson Exp */ @@ -423,4 +423,18 @@ { AS(uuidgen_args), (sy_call_t *)uuidgen }, /* 392 = uuidgen */ { SYF_MPSAFE | AS(sendfile_args), (sy_call_t *)sendfile }, /* 393 = sendfile */ { SYF_MPSAFE | AS(mac_syscall_args), (sy_call_t *)mac_syscall }, /* 394 = mac_syscall */ + { 0, (sy_call_t *)nosys }, /* 395 = nosys */ + { 0, (sy_call_t *)nosys }, /* 396 = nosys */ + { 0, (sy_call_t *)nosys }, /* 397 = nosys */ + { 0, (sy_call_t *)nosys }, /* 398 = nosys */ + { 0, (sy_call_t *)nosys }, /* 399 = nosys */ + { SYF_MPSAFE | AS(ksem_close_args), (sy_call_t *)lkmressys }, /* 400 = ksem_close */ + { SYF_MPSAFE | AS(ksem_post_args), (sy_call_t *)lkmressys }, /* 401 = ksem_post */ + { SYF_MPSAFE | AS(ksem_wait_args), (sy_call_t *)lkmressys }, /* 402 = ksem_wait */ + { SYF_MPSAFE | AS(ksem_trywait_args), (sy_call_t *)lkmressys }, /* 403 = ksem_trywait */ + { SYF_MPSAFE | AS(ksem_init_args), (sy_call_t *)lkmressys }, /* 404 = ksem_init */ + { SYF_MPSAFE | AS(ksem_open_args), (sy_call_t *)lkmressys }, /* 405 = ksem_open */ + { SYF_MPSAFE | AS(ksem_unlink_args), (sy_call_t *)lkmressys }, /* 406 = ksem_unlink */ + { SYF_MPSAFE | AS(ksem_getvalue_args), (sy_call_t *)lkmressys }, /* 407 = ksem_getvalue */ + { SYF_MPSAFE | AS(ksem_destroy_args), (sy_call_t *)lkmressys }, /* 408 = ksem_destroy */ }; Index: sys/kern/makesyscalls.sh =================================================================== RCS file: /home/ncvs/src/sys/kern/makesyscalls.sh,v retrieving revision 1.56 diff -u -r1.56 makesyscalls.sh --- sys/kern/makesyscalls.sh 12 Jul 2002 06:38:34 -0000 1.56 +++ sys/kern/makesyscalls.sh 16 Sep 2002 05:59:59 -0000 @@ -115,8 +115,9 @@ printf " * created from%s\n */\n\n", $0 > sysarg printf "#ifndef %s\n", sysproto_h > sysarg printf "#define\t%s\n\n", sysproto_h > sysarg - printf "#include \n\n" > sysarg - printf "#include \n\n" > sysarg + printf "#include \n" > sysarg + printf "#include \n" > sysarg + printf "#include \n\n" > sysarg printf "struct proc;\n\n" > sysarg printf "struct thread;\n\n" > sysarg printf "#define\tPAD_(t)\t(sizeof(register_t) <= sizeof(t) ? \\\n" > sysarg Index: sys/kern/syscalls.c =================================================================== RCS file: /home/ncvs/src/sys/kern/syscalls.c,v retrieving revision 1.117 diff -u -r1.117 syscalls.c --- sys/kern/syscalls.c 19 Aug 2002 20:02:29 -0000 1.117 +++ sys/kern/syscalls.c 16 Sep 2002 17:25:15 -0000 @@ -2,7 +2,7 @@ * System call names. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/kern/syscalls.c,v 1.117 2002/08/19 20:02:29 rwatson Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.121 2002/08/19 20:01:31 rwatson Exp */ @@ -402,4 +402,18 @@ "uuidgen", /* 392 = uuidgen */ "sendfile", /* 393 = sendfile */ "mac_syscall", /* 394 = mac_syscall */ + "#395", /* 395 = nosys */ + "#396", /* 396 = nosys */ + "#397", /* 397 = nosys */ + "#398", /* 398 = nosys */ + "#399", /* 399 = nosys */ + "ksem_close", /* 400 = ksem_close */ + "ksem_post", /* 401 = ksem_post */ + "ksem_wait", /* 402 = ksem_wait */ + "ksem_trywait", /* 403 = ksem_trywait */ + "ksem_init", /* 404 = ksem_init */ + "ksem_open", /* 405 = ksem_open */ + "ksem_unlink", /* 406 = ksem_unlink */ + "ksem_getvalue", /* 407 = ksem_getvalue */ + "ksem_destroy", /* 408 = ksem_destroy */ }; Index: sys/kern/syscalls.master =================================================================== RCS file: /home/ncvs/src/sys/kern/syscalls.master,v retrieving revision 1.121 diff -u -r1.121 syscalls.master --- sys/kern/syscalls.master 19 Aug 2002 20:01:31 -0000 1.121 +++ sys/kern/syscalls.master 16 Sep 2002 17:25:09 -0000 @@ -569,3 +569,18 @@ struct sf_hdtr *hdtr, off_t *sbytes, int flags); } 394 MSTD BSD { int mac_syscall(const char *policy, int call, \ void *arg); } +395 UNIMPL NOHIDE nosys +396 UNIMPL NOHIDE nosys +397 UNIMPL NOHIDE nosys +398 UNIMPL NOHIDE nosys +399 UNIMPL NOHIDE nosys +400 MNOSTD BSD { int ksem_close(semid_t id); } +401 MNOSTD BSD { int ksem_post(semid_t id); } +402 MNOSTD BSD { int ksem_wait(semid_t id); } +403 MNOSTD BSD { int ksem_trywait(semid_t id); } +404 MNOSTD BSD { int ksem_init(semid_t *idp, unsigned int value); } +405 MNOSTD BSD { int ksem_open(semid_t *idp, const char *name, \ + int oflag, mode_t mode, unsigned int value); } +406 MNOSTD BSD { int ksem_unlink(const char *name); } +407 MNOSTD BSD { int ksem_getvalue(semid_t id, int *val); } +408 MNOSTD BSD { int ksem_destroy(semid_t id); } cvs diff: sys/kern/uipc_sem.c is a new entry, no comparison available Index: sys/modules/Makefile =================================================================== RCS file: /home/ncvs/src/sys/modules/Makefile,v retrieving revision 1.257 diff -u -r1.257 Makefile --- sys/modules/Makefile 16 Sep 2002 08:32:48 -0000 1.257 +++ sys/modules/Makefile 16 Sep 2002 18:39:19 -0000 @@ -69,6 +69,7 @@ pcn \ plip \ portalfs \ + posix4 \ ppbus \ ppi \ pps \ cvs diff: sys/modules/posix4/Makefile is a new entry, no comparison available cvs diff: sys/modules/posix4/sem/Makefile is a new entry, no comparison available cvs diff: sys/posix4/_semaphore.h is a new entry, no comparison available Index: sys/posix4/posix4.h =================================================================== RCS file: /home/ncvs/src/sys/posix4/posix4.h,v retrieving revision 1.8 diff -u -r1.8 posix4.h --- sys/posix4/posix4.h 19 Mar 2002 22:18:09 -0000 1.8 +++ sys/posix4/posix4.h 16 Sep 2002 17:50:58 -0000 @@ -64,6 +64,7 @@ int p31b_proc(struct proc *, pid_t, struct proc **); void p31b_setcfg(int, int); +int p31b_getcfg(int); #ifdef _KPOSIX_PRIORITY_SCHEDULING Index: sys/posix4/posix4_mib.c =================================================================== RCS file: /home/ncvs/src/sys/posix4/posix4_mib.c,v retrieving revision 1.4 diff -u -r1.4 posix4_mib.c --- sys/posix4/posix4_mib.c 22 Apr 2000 15:13:06 -0000 1.4 +++ sys/posix4/posix4_mib.c 16 Sep 2002 17:49:57 -0000 @@ -92,10 +92,21 @@ /* p31b_setcfg: Set the configuration */ -void p31b_setcfg(int num, int value) +void +p31b_setcfg(int num, int value) { + if (num >= 1 && num < CTL_P1003_1B_MAXID) facility[num - 1] = value; +} + +int +p31b_getcfg(int num) +{ + + if (num >= 1 && num < CTL_P1003_1B_MAXID) + return (facility[num - 1]); + return (0); } /* Index: sys/sys/syscall.h =================================================================== RCS file: /home/ncvs/src/sys/sys/syscall.h,v retrieving revision 1.116 diff -u -r1.116 syscall.h --- sys/sys/syscall.h 19 Aug 2002 20:02:29 -0000 1.116 +++ sys/sys/syscall.h 16 Sep 2002 17:25:15 -0000 @@ -2,7 +2,7 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/sys/syscall.h,v 1.116 2002/08/19 20:02:29 rwatson Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.121 2002/08/19 20:01:31 rwatson Exp */ @@ -308,4 +308,13 @@ #define SYS_uuidgen 392 #define SYS_sendfile 393 #define SYS_mac_syscall 394 -#define SYS_MAXSYSCALL 395 +#define SYS_ksem_close 400 +#define SYS_ksem_post 401 +#define SYS_ksem_wait 402 +#define SYS_ksem_trywait 403 +#define SYS_ksem_init 404 +#define SYS_ksem_open 405 +#define SYS_ksem_unlink 406 +#define SYS_ksem_getvalue 407 +#define SYS_ksem_destroy 408 +#define SYS_MAXSYSCALL 409 Index: sys/sys/syscall.mk =================================================================== RCS file: /home/ncvs/src/sys/sys/syscall.mk,v retrieving revision 1.71 diff -u -r1.71 syscall.mk --- sys/sys/syscall.mk 19 Aug 2002 20:02:29 -0000 1.71 +++ sys/sys/syscall.mk 16 Sep 2002 17:25:15 -0000 @@ -1,6 +1,6 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. -# $FreeBSD: src/sys/sys/syscall.mk,v 1.71 2002/08/19 20:02:29 rwatson Exp $ +# $FreeBSD$ # created from FreeBSD: src/sys/kern/syscalls.master,v 1.121 2002/08/19 20:01:31 rwatson Exp MIASM = \ syscall.o \ @@ -256,4 +256,13 @@ lchflags.o \ uuidgen.o \ sendfile.o \ - mac_syscall.o + mac_syscall.o \ + ksem_close.o \ + ksem_post.o \ + ksem_wait.o \ + ksem_trywait.o \ + ksem_init.o \ + ksem_open.o \ + ksem_unlink.o \ + ksem_getvalue.o \ + ksem_destroy.o Index: sys/sys/sysproto.h =================================================================== RCS file: /home/ncvs/src/sys/sys/sysproto.h,v retrieving revision 1.108 diff -u -r1.108 sysproto.h --- sys/sys/sysproto.h 19 Aug 2002 20:02:29 -0000 1.108 +++ sys/sys/sysproto.h 16 Sep 2002 17:25:15 -0000 @@ -2,7 +2,7 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/sys/sysproto.h,v 1.108 2002/08/19 20:02:29 rwatson Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.121 2002/08/19 20:01:31 rwatson Exp */ @@ -10,8 +10,8 @@ #define _SYS_SYSPROTO_H_ #include - #include +#include struct proc; @@ -1124,6 +1124,39 @@ char call_l_[PADL_(int)]; int call; char call_r_[PADR_(int)]; char arg_l_[PADL_(void *)]; void * arg; char arg_r_[PADR_(void *)]; }; +struct ksem_close_args { + char id_l_[PADL_(semid_t)]; semid_t id; char id_r_[PADR_(semid_t)]; +}; +struct ksem_post_args { + char id_l_[PADL_(semid_t)]; semid_t id; char id_r_[PADR_(semid_t)]; +}; +struct ksem_wait_args { + char id_l_[PADL_(semid_t)]; semid_t id; char id_r_[PADR_(semid_t)]; +}; +struct ksem_trywait_args { + char id_l_[PADL_(semid_t)]; semid_t id; char id_r_[PADR_(semid_t)]; +}; +struct ksem_init_args { + char idp_l_[PADL_(semid_t *)]; semid_t * idp; char idp_r_[PADR_(semid_t *)]; + char value_l_[PADL_(unsigned int)]; unsigned int value; char value_r_[PADR_(unsigned int)]; +}; +struct ksem_open_args { + char idp_l_[PADL_(semid_t *)]; semid_t * idp; char idp_r_[PADR_(semid_t *)]; + char name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)]; + char oflag_l_[PADL_(int)]; int oflag; char oflag_r_[PADR_(int)]; + char mode_l_[PADL_(mode_t)]; mode_t mode; char mode_r_[PADR_(mode_t)]; + char value_l_[PADL_(unsigned int)]; unsigned int value; char value_r_[PADR_(unsigned int)]; +}; +struct ksem_unlink_args { + char name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)]; +}; +struct ksem_getvalue_args { + char id_l_[PADL_(semid_t)]; semid_t id; char id_r_[PADR_(semid_t)]; + char val_l_[PADL_(int *)]; int * val; char val_r_[PADR_(int *)]; +}; +struct ksem_destroy_args { + char id_l_[PADL_(semid_t)]; semid_t id; char id_r_[PADR_(semid_t)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_exit(struct thread *, struct sys_exit_args *); int fork(struct thread *, struct fork_args *); @@ -1377,6 +1410,15 @@ int uuidgen(struct thread *, struct uuidgen_args *); int sendfile(struct thread *, struct sendfile_args *); int mac_syscall(struct thread *, struct mac_syscall_args *); +int ksem_close(struct thread *, struct ksem_close_args *); +int ksem_post(struct thread *, struct ksem_post_args *); +int ksem_wait(struct thread *, struct ksem_wait_args *); +int ksem_trywait(struct thread *, struct ksem_trywait_args *); +int ksem_init(struct thread *, struct ksem_init_args *); +int ksem_open(struct thread *, struct ksem_open_args *); +int ksem_unlink(struct thread *, struct ksem_unlink_args *); +int ksem_getvalue(struct thread *, struct ksem_getvalue_args *); +int ksem_destroy(struct thread *, struct ksem_destroy_args *); #ifdef COMPAT_43 -- -Alfred Perlstein [alfred@freebsd.org] 'Instead of asking why a piece of software is using "1970s technology," start asking why software is ignoring 30 years of accumulated wisdom.' To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message