84d9c625bf
- Fix for possible unset uid/gid in toproto - Fix for default mtree style - Update libelf - Importing libexecinfo - Resynchronize GCC, mpc, gmp, mpfr - build.sh: Replace params with show-params. This has been done as the make target has been renamed in the same way, while a new target named params has been added. This new target generates a file containing all the parameters, instead of printing it on the console. - Update test48 with new etc/services (Fix by Ben Gras <ben@minix3.org) get getservbyport() out of the inner loop Change-Id: Ie6ad5226fa2621ff9f0dee8782ea48f9443d2091
41 lines
846 B
C
41 lines
846 B
C
#include <sys/cdefs.h>
|
|
#include "namespace.h"
|
|
#include <lib.h>
|
|
|
|
#include <string.h>
|
|
#include <fcntl.h>
|
|
#include <stdarg.h>
|
|
|
|
int fcntl(int fd, int cmd, ...)
|
|
{
|
|
va_list argp;
|
|
message m;
|
|
|
|
va_start(argp, cmd);
|
|
|
|
/* Set up for the sensible case where there is no variable parameter. This
|
|
* covers F_GETFD, F_GETFL and invalid commands.
|
|
*/
|
|
memset(&m, 0, sizeof(m));
|
|
|
|
/* Adjust for the stupid cases. */
|
|
switch(cmd) {
|
|
case F_DUPFD:
|
|
case F_SETFD:
|
|
case F_SETFL:
|
|
m.VFS_FCNTL_ARG_INT = va_arg(argp, int);
|
|
break;
|
|
case F_GETLK:
|
|
case F_SETLK:
|
|
case F_SETLKW:
|
|
case F_FREESP:
|
|
m.VFS_FCNTL_ARG_PTR = (char *) va_arg(argp, struct flock *);
|
|
break;
|
|
}
|
|
|
|
/* Clean up and make the system call. */
|
|
va_end(argp);
|
|
m.VFS_FCNTL_FD = fd;
|
|
m.VFS_FCNTL_CMD = cmd;
|
|
return(_syscall(VFS_PROC_NR, VFS_FCNTL, &m));
|
|
}
|